diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-04-05 00:35:25 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-04-05 00:48:46 +0200 |
| commit | a84b33995eacc32e0e13d70293fa9bd7b2bd75f8 (patch) | |
| tree | cfd48dbdad8885495cf20c4832f373444b867397 /embassy-rp/src/adc.rs | |
| parent | ab85eb4b60cd49ebcd43d2305f42327685f5e5a6 (diff) | |
rp: remove mod sealed.
Diffstat (limited to 'embassy-rp/src/adc.rs')
| -rw-r--r-- | embassy-rp/src/adc.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/embassy-rp/src/adc.rs b/embassy-rp/src/adc.rs index 4c01fe195..101c5b71f 100644 --- a/embassy-rp/src/adc.rs +++ b/embassy-rp/src/adc.rs | |||
| @@ -8,8 +8,7 @@ use core::task::Poll; | |||
| 8 | use embassy_hal_internal::{into_ref, PeripheralRef}; | 8 | use embassy_hal_internal::{into_ref, PeripheralRef}; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | 10 | ||
| 11 | use crate::gpio::sealed::Pin as GpioPin; | 11 | use crate::gpio::{self, AnyPin, Pull, SealedPin as GpioPin}; |
| 12 | use crate::gpio::{self, AnyPin, Pull}; | ||
| 13 | use crate::interrupt::typelevel::Binding; | 12 | use crate::interrupt::typelevel::Binding; |
| 14 | use crate::interrupt::InterruptExt; | 13 | use crate::interrupt::InterruptExt; |
| 15 | use crate::peripherals::{ADC, ADC_TEMP_SENSOR}; | 14 | use crate::peripherals::{ADC, ADC_TEMP_SENSOR}; |
| @@ -334,29 +333,28 @@ impl interrupt::typelevel::Handler<interrupt::typelevel::ADC_IRQ_FIFO> for Inter | |||
| 334 | } | 333 | } |
| 335 | } | 334 | } |
| 336 | 335 | ||
| 337 | mod sealed { | 336 | trait SealedAdcSample: crate::dma::Word {} |
| 338 | pub trait AdcSample: crate::dma::Word {} | 337 | trait SealedAdcChannel {} |
| 339 | |||
| 340 | pub trait AdcChannel {} | ||
| 341 | } | ||
| 342 | 338 | ||
| 343 | /// ADC sample. | 339 | /// ADC sample. |
| 344 | pub trait AdcSample: sealed::AdcSample {} | 340 | #[allow(private_bounds)] |
| 341 | pub trait AdcSample: SealedAdcSample {} | ||
| 345 | 342 | ||
| 346 | impl sealed::AdcSample for u16 {} | 343 | impl SealedAdcSample for u16 {} |
| 347 | impl AdcSample for u16 {} | 344 | impl AdcSample for u16 {} |
| 348 | 345 | ||
| 349 | impl sealed::AdcSample for u8 {} | 346 | impl SealedAdcSample for u8 {} |
| 350 | impl AdcSample for u8 {} | 347 | impl AdcSample for u8 {} |
| 351 | 348 | ||
| 352 | /// ADC channel. | 349 | /// ADC channel. |
| 353 | pub trait AdcChannel: sealed::AdcChannel {} | 350 | #[allow(private_bounds)] |
| 351 | pub trait AdcChannel: SealedAdcChannel {} | ||
| 354 | /// ADC pin. | 352 | /// ADC pin. |
| 355 | pub trait AdcPin: AdcChannel + gpio::Pin {} | 353 | pub trait AdcPin: AdcChannel + gpio::Pin {} |
| 356 | 354 | ||
| 357 | macro_rules! impl_pin { | 355 | macro_rules! impl_pin { |
| 358 | ($pin:ident, $channel:expr) => { | 356 | ($pin:ident, $channel:expr) => { |
| 359 | impl sealed::AdcChannel for peripherals::$pin {} | 357 | impl SealedAdcChannel for peripherals::$pin {} |
| 360 | impl AdcChannel for peripherals::$pin {} | 358 | impl AdcChannel for peripherals::$pin {} |
| 361 | impl AdcPin for peripherals::$pin {} | 359 | impl AdcPin for peripherals::$pin {} |
| 362 | }; | 360 | }; |
| @@ -367,5 +365,5 @@ impl_pin!(PIN_27, 1); | |||
| 367 | impl_pin!(PIN_28, 2); | 365 | impl_pin!(PIN_28, 2); |
| 368 | impl_pin!(PIN_29, 3); | 366 | impl_pin!(PIN_29, 3); |
| 369 | 367 | ||
| 370 | impl sealed::AdcChannel for peripherals::ADC_TEMP_SENSOR {} | 368 | impl SealedAdcChannel for peripherals::ADC_TEMP_SENSOR {} |
| 371 | impl AdcChannel for peripherals::ADC_TEMP_SENSOR {} | 369 | impl AdcChannel for peripherals::ADC_TEMP_SENSOR {} |
