Ad7172-2: u8 -> RefSource is Incorrect #210

Closed
opened 2025-10-08 15:16:01 +08:00 by linuswck · 0 comments
Owner

src/ad7172/mod.rs Lines 109 to 130 in 38e92c4042
/// Reference source for ADC conversion
#[repr(u8)]
pub enum RefSource {
/// External reference
External = 0b00,
/// Internal 2.5V reference
Internal = 0b10,
/// AVDD1 AVSS
Avdd1MinusAvss = 0b11,
Invalid = 0b01,
}
impl From<u8> for RefSource {
fn from(x: u8) -> Self {
match x {
0 => RefSource::External,
1 => RefSource::Internal,
2 => RefSource::Avdd1MinusAvss,
_ => RefSource::Invalid,
}
}
}

https://git.m-labs.hk/M-Labs/thermostat/src/commit/38e92c40424bb2e075e08fdf07c2dcb23fd6fc9d/src/ad7172/mod.rs#L109-L130
atse closed this issue 2025-10-09 10:21:08 +08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: M-Labs/thermostat#210
No description provided.