diff options
| author | Bob McWhirter <[email protected]> | 2021-06-03 14:25:17 -0400 |
|---|---|---|
| committer | Bob McWhirter <[email protected]> | 2021-06-03 14:25:17 -0400 |
| commit | 240616aa7238941afb0c663e3adfab3950257538 (patch) | |
| tree | d8c2dcb139ffb3a948968fd1cd63817fadf4c791 | |
| parent | d75bf143eb715db0855dff0bc10650de1b6d5ab9 (diff) | |
General clean-up and removal of dead code.
| -rw-r--r-- | embassy-stm32/src/exti.rs | 27 | ||||
| -rw-r--r-- | embassy-stm32/src/i2c/mod.rs | 4 | ||||
| -rw-r--r-- | embassy-stm32/src/lib.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rng.rs | 28 | ||||
| -rw-r--r-- | embassy-stm32/src/sdmmc/v2.rs | 6 |
5 files changed, 7 insertions, 60 deletions
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs index 0ee93bede..90d4afd56 100644 --- a/embassy-stm32/src/exti.rs +++ b/embassy-stm32/src/exti.rs | |||
| @@ -212,31 +212,6 @@ impl_exti!(EXTI13, 13); | |||
| 212 | impl_exti!(EXTI14, 14); | 212 | impl_exti!(EXTI14, 14); |
| 213 | impl_exti!(EXTI15, 15); | 213 | impl_exti!(EXTI15, 15); |
| 214 | 214 | ||
| 215 | pub(crate) unsafe fn init() {} | ||
| 216 | |||
| 217 | /* | ||
| 218 | macro_rules! impl_exti_irq { | ||
| 219 | ($($e:ident),+) => { | ||
| 220 | /// safety: must be called only once | ||
| 221 | pub(crate) unsafe fn init_exti() { | ||
| 222 | use embassy::interrupt::Interrupt; | ||
| 223 | use embassy::interrupt::InterruptExt; | ||
| 224 | |||
| 225 | $( | ||
| 226 | crate::interrupt::$e::steal().enable(); | ||
| 227 | )+ | ||
| 228 | } | ||
| 229 | |||
| 230 | $( | ||
| 231 | #[crate::interrupt] | ||
| 232 | unsafe fn $e() { | ||
| 233 | crate::exti::on_irq() | ||
| 234 | } | ||
| 235 | )+ | ||
| 236 | }; | ||
| 237 | } | ||
| 238 | */ | ||
| 239 | |||
| 240 | macro_rules! foreach_exti_irq { | 215 | macro_rules! foreach_exti_irq { |
| 241 | ($action:ident) => { | 216 | ($action:ident) => { |
| 242 | crate::pac::interrupts!( | 217 | crate::pac::interrupts!( |
| @@ -278,7 +253,7 @@ macro_rules! enable_irq { | |||
| 278 | } | 253 | } |
| 279 | 254 | ||
| 280 | /// safety: must be called only once | 255 | /// safety: must be called only once |
| 281 | pub(crate) unsafe fn init_exti() { | 256 | pub(crate) unsafe fn init() { |
| 282 | use embassy::interrupt::Interrupt; | 257 | use embassy::interrupt::Interrupt; |
| 283 | use embassy::interrupt::InterruptExt; | 258 | use embassy::interrupt::InterruptExt; |
| 284 | 259 | ||
diff --git a/embassy-stm32/src/i2c/mod.rs b/embassy-stm32/src/i2c/mod.rs index abda196a7..0f9414c53 100644 --- a/embassy-stm32/src/i2c/mod.rs +++ b/embassy-stm32/src/i2c/mod.rs | |||
| @@ -40,13 +40,13 @@ pub trait SdaPin<T: Instance>: sealed::SdaPin<T> + 'static {} | |||
| 40 | 40 | ||
| 41 | crate::pac::peripherals!( | 41 | crate::pac::peripherals!( |
| 42 | (i2c, $inst:ident) => { | 42 | (i2c, $inst:ident) => { |
| 43 | impl crate::i2c::sealed::Instance for peripherals::$inst { | 43 | impl sealed::Instance for peripherals::$inst { |
| 44 | fn regs() -> &'static crate::pac::i2c::I2c { | 44 | fn regs() -> &'static crate::pac::i2c::I2c { |
| 45 | &crate::pac::$inst | 45 | &crate::pac::$inst |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | impl crate::i2c::Instance for peripherals::$inst {} | 49 | impl Instance for peripherals::$inst {} |
| 50 | 50 | ||
| 51 | }; | 51 | }; |
| 52 | ); | 52 | ); |
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 54d46c5b9..c205bc49d 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -83,7 +83,7 @@ pub fn init(config: Config) -> Peripherals { | |||
| 83 | 83 | ||
| 84 | #[cfg(dma)] | 84 | #[cfg(dma)] |
| 85 | dma::init(); | 85 | dma::init(); |
| 86 | exti::init_exti(); | 86 | exti::init(); |
| 87 | rcc::init(config.rcc); | 87 | rcc::init(config.rcc); |
| 88 | } | 88 | } |
| 89 | 89 | ||
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 4dd26c671..704f1a97b 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs | |||
| @@ -185,31 +185,3 @@ crate::pac::interrupts!( | |||
| 185 | irq!(HASH_RNG); | 185 | irq!(HASH_RNG); |
| 186 | }; | 186 | }; |
| 187 | ); | 187 | ); |
| 188 | |||
| 189 | /* | ||
| 190 | macro_rules! impl_rng { | ||
| 191 | ($inst:ident, $irq:ident) => { | ||
| 192 | impl crate::rng::sealed::Instance for peripherals::RNG { | ||
| 193 | fn regs() -> crate::pac::rng::Rng { | ||
| 194 | crate::pac::RNG | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | impl crate::rng::Instance for peripherals::RNG {} | ||
| 199 | |||
| 200 | mod rng_irq { | ||
| 201 | use crate::interrupt; | ||
| 202 | |||
| 203 | #[interrupt] | ||
| 204 | unsafe fn $irq() { | ||
| 205 | let bits = $crate::pac::RNG.sr().read(); | ||
| 206 | if bits.drdy() || bits.seis() || bits.ceis() { | ||
| 207 | $crate::pac::RNG.cr().write(|reg| reg.set_ie(false)); | ||
| 208 | $crate::rng::RNG_WAKER.wake(); | ||
| 209 | } | ||
| 210 | } | ||
| 211 | } | ||
| 212 | }; | ||
| 213 | } | ||
| 214 | |||
| 215 | */ | ||
diff --git a/embassy-stm32/src/sdmmc/v2.rs b/embassy-stm32/src/sdmmc/v2.rs index 6d21091a9..2c7f8ac00 100644 --- a/embassy-stm32/src/sdmmc/v2.rs +++ b/embassy-stm32/src/sdmmc/v2.rs | |||
| @@ -1476,7 +1476,7 @@ crate::pac::peripherals!( | |||
| 1476 | type Interrupt = crate::interrupt::$inst; | 1476 | type Interrupt = crate::interrupt::$inst; |
| 1477 | 1477 | ||
| 1478 | fn inner() -> SdmmcInner { | 1478 | fn inner() -> SdmmcInner { |
| 1479 | const INNER: crate::sdmmc::SdmmcInner = crate::sdmmc::SdmmcInner(crate::pac::$inst); | 1479 | const INNER: SdmmcInner = SdmmcInner(crate::pac::$inst); |
| 1480 | INNER | 1480 | INNER |
| 1481 | } | 1481 | } |
| 1482 | 1482 | ||
| @@ -1492,11 +1492,11 @@ crate::pac::peripherals!( | |||
| 1492 | 1492 | ||
| 1493 | macro_rules! impl_pin { | 1493 | macro_rules! impl_pin { |
| 1494 | ($inst:ident, $pin:ident, $signal:ident, $af:expr) => { | 1494 | ($inst:ident, $pin:ident, $signal:ident, $af:expr) => { |
| 1495 | impl crate::sdmmc::sealed::$signal<peripherals::$inst> for peripherals::$pin { | 1495 | impl sealed::$signal<peripherals::$inst> for peripherals::$pin { |
| 1496 | const AF_NUM: u8 = $af; | 1496 | const AF_NUM: u8 = $af; |
| 1497 | } | 1497 | } |
| 1498 | 1498 | ||
| 1499 | impl crate::sdmmc::$signal<peripherals::$inst> for peripherals::$pin {} | 1499 | impl $signal<peripherals::$inst> for peripherals::$pin {} |
| 1500 | }; | 1500 | }; |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
