diff options
Diffstat (limited to 'embassy-nxp/src/iomuxc.rs')
| -rw-r--r-- | embassy-nxp/src/iomuxc.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/embassy-nxp/src/iomuxc.rs b/embassy-nxp/src/iomuxc.rs new file mode 100644 index 000000000..c015ecbc2 --- /dev/null +++ b/embassy-nxp/src/iomuxc.rs | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #![macro_use] | ||
| 2 | |||
| 3 | /// An IOMUXC pad. | ||
| 4 | /// | ||
| 5 | /// This trait does not imply that GPIO can be used with this pad. [`Pin`](crate::gpio::Pin) must | ||
| 6 | /// also be implemented for GPIO. | ||
| 7 | #[allow(private_bounds)] | ||
| 8 | pub trait Pad: SealedPad {} | ||
| 9 | |||
| 10 | pub(crate) trait SealedPad { | ||
| 11 | /// Address of the pad register for this pad. | ||
| 12 | const PAD: *mut (); | ||
| 13 | |||
| 14 | /// Address of the mux register for this pad. | ||
| 15 | /// | ||
| 16 | /// Some pads do not allow muxing (e.g. ONOFF). | ||
| 17 | const MUX: Option<*mut ()>; | ||
| 18 | } | ||
| 19 | |||
| 20 | macro_rules! impl_iomuxc_pad { | ||
| 21 | ($name: ident, $pad: expr, $mux: expr) => { | ||
| 22 | impl crate::iomuxc::SealedPad for crate::peripherals::$name { | ||
| 23 | const PAD: *mut () = $pad as *mut (); | ||
| 24 | const MUX: Option<*mut ()> = Some($mux as *mut ()); | ||
| 25 | } | ||
| 26 | |||
| 27 | impl crate::iomuxc::Pad for crate::peripherals::$name {} | ||
| 28 | }; | ||
| 29 | } | ||
