mirror of
https://github.com/TomHarte/CLK.git
synced 2025-11-28 10:17:40 +00:00
Retain bit 2.
This commit is contained in:
@@ -41,8 +41,9 @@ void uPD7002::write(const uint16_t address, const uint8_t value) {
|
|||||||
const auto local_address = address & 3;
|
const auto local_address = address & 3;
|
||||||
if(!local_address) {
|
if(!local_address) {
|
||||||
interrupt_ = false;
|
interrupt_ = false;
|
||||||
channel_ = value & 3;
|
channel_ = value & 0b0000'0011;
|
||||||
high_precision_ = value & 8;
|
spare_ = value & 0b0000'0100;
|
||||||
|
high_precision_ = value & 0b0000'1000;
|
||||||
conversion_time_remaining_ = high_precision_ ? slow_period_ : fast_period_;
|
conversion_time_remaining_ = high_precision_ ? slow_period_ : fast_period_;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -64,6 +65,7 @@ uint8_t uPD7002::read(const uint16_t address) {
|
|||||||
uint8_t uPD7002::status() const {
|
uint8_t uPD7002::status() const {
|
||||||
return
|
return
|
||||||
channel_ |
|
channel_ |
|
||||||
|
spare_ |
|
||||||
(high_precision_ ? 0x08 : 0) |
|
(high_precision_ ? 0x08 : 0) |
|
||||||
((result_ >> 14) & 0x30) |
|
((result_ >> 14) & 0x30) |
|
||||||
(conversion_time_remaining_ > HalfCycles(0) ? 0x00 : 0x40) |
|
(conversion_time_remaining_ > HalfCycles(0) ? 0x00 : 0x40) |
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ private:
|
|||||||
uint16_t result_ = 0;
|
uint16_t result_ = 0;
|
||||||
bool interrupt_ = false;
|
bool interrupt_ = false;
|
||||||
|
|
||||||
uint8_t channel_ = 0;
|
uint8_t channel_ = 0, spare_ = 0;
|
||||||
bool high_precision_ = false;
|
bool high_precision_ = false;
|
||||||
|
|
||||||
HalfCycles conversion_time_remaining_;
|
HalfCycles conversion_time_remaining_{};
|
||||||
HalfCycles fast_period_, slow_period_;
|
HalfCycles fast_period_, slow_period_;
|
||||||
|
|
||||||
uint8_t status() const;
|
uint8_t status() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user