aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflippette <[email protected]>2025-01-30 00:13:56 +0200
committerflippette <[email protected]>2025-01-30 00:16:36 +0200
commit9d353d251c644cc039679a30c0f8ab563181c1b9 (patch)
treeb85986b2cb76c9560e7fd2ad87f6494e4e52a115
parentf6532e8f2cd20ed2e63d5c68c2027e959eec30d2 (diff)
Correct ADC channels for RP2350XB
-rw-r--r--embassy-rp/src/adc.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs
index 19441f194..8defb5231 100644
--- a/embassy-rp/src/adc.rs
+++ b/embassy-rp/src/adc.rs
@@ -58,11 +58,21 @@ impl<'p> Channel<'p> {
58 } 58 }
59 59
60 fn channel(&self) -> u8 { 60 fn channel(&self) -> u8 {
61 #[cfg(any(feature = "rp2040", feature = "rp235xa"))]
62 const CH_OFFSET: u8 = 26;
63 #[cfg(feature = "rp235xb")]
64 const CH_OFFSET: u8 = 40;
65
66 #[cfg(any(feature = "rp2040", feature = "rp235xa"))]
67 const TS_CHAN: u8 = 4;
68 #[cfg(feature = "rp235xb")]
69 const TS_CHAN: u8 = 8;
70
61 match &self.0 { 71 match &self.0 {
62 // this requires adc pins to be sequential and matching the adc channels, 72 // this requires adc pins to be sequential and matching the adc channels,
63 // which is the case for rp2040 73 // which is the case for rp2040/rp235xy
64 Source::Pin(p) => p._pin() - 26, 74 Source::Pin(p) => p._pin() - CH_OFFSET,
65 Source::TempSensor(_) => 4, 75 Source::TempSensor(_) => TS_CHAN,
66 } 76 }
67 } 77 }
68} 78}