aboutsummaryrefslogtreecommitdiff
path: root/embassy-imxrt/src/lib.rs
diff options
context:
space:
mode:
authorFelipe Balbi <[email protected]>2025-04-10 10:39:54 -0700
committerFelipe Balbi <[email protected]>2025-05-15 07:22:49 -0700
commitd64ae225b30bc3a0f7a9b1277188b6e60fc97484 (patch)
tree6d446b021fa47dd7c62e7aa2e45df5bae1a1ef96 /embassy-imxrt/src/lib.rs
parentd1c2ce927ac41a3f81de0f47e0468523d562d1d1 (diff)
Add UART and DMA drivers
Both blocking and async versions are supported. Add separate examples for each mode.
Diffstat (limited to 'embassy-imxrt/src/lib.rs')
-rw-r--r--embassy-imxrt/src/lib.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/embassy-imxrt/src/lib.rs b/embassy-imxrt/src/lib.rs
index b1183d8fc..ad0d9e21c 100644
--- a/embassy-imxrt/src/lib.rs
+++ b/embassy-imxrt/src/lib.rs
@@ -19,6 +19,8 @@ pub(crate) mod fmt;
19 19
20pub mod clocks; 20pub mod clocks;
21pub mod crc; 21pub mod crc;
22pub mod dma;
23pub mod flexcomm;
22pub mod gpio; 24pub mod gpio;
23pub mod iopctl; 25pub mod iopctl;
24pub mod rng; 26pub mod rng;
@@ -129,14 +131,16 @@ pub fn init(config: config::Config) -> Peripherals {
129 // before doing anything important. 131 // before doing anything important.
130 let peripherals = Peripherals::take(); 132 let peripherals = Peripherals::take();
131 133
134 #[cfg(feature = "_time-driver")]
135 time_driver::init(config.time_interrupt_priority);
136
132 unsafe { 137 unsafe {
133 if let Err(e) = clocks::init(config.clocks) { 138 if let Err(e) = clocks::init(config.clocks) {
134 error!("unable to initialize Clocks for reason: {:?}", e); 139 error!("unable to initialize Clocks for reason: {:?}", e);
135 // Panic here? 140 // Panic here?
136 } 141 }
142 dma::init();
137 } 143 }
138 #[cfg(feature = "_time-driver")]
139 time_driver::init(config.time_interrupt_priority);
140 gpio::init(); 144 gpio::init();
141 145
142 peripherals 146 peripherals
@@ -145,3 +149,21 @@ pub fn init(config: config::Config) -> Peripherals {
145pub(crate) mod sealed { 149pub(crate) mod sealed {
146 pub trait Sealed {} 150 pub trait Sealed {}
147} 151}
152
153#[cfg(feature = "rt")]
154struct BitIter(u32);
155
156#[cfg(feature = "rt")]
157impl Iterator for BitIter {
158 type Item = u32;
159
160 fn next(&mut self) -> Option<Self::Item> {
161 match self.0.trailing_zeros() {
162 32 => None,
163 b => {
164 self.0 &= !(1 << b);
165 Some(b)
166 }
167 }
168 }
169}