diff options
Diffstat (limited to 'embassy-mspm0/src/gpio.rs')
| -rw-r--r-- | embassy-mspm0/src/gpio.rs | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs index 9fbe34251..f77848888 100644 --- a/embassy-mspm0/src/gpio.rs +++ b/embassy-mspm0/src/gpio.rs | |||
| @@ -1090,7 +1090,9 @@ pub(crate) fn init(gpio: gpio::Gpio) { | |||
| 1090 | 1090 | ||
| 1091 | #[cfg(feature = "rt")] | 1091 | #[cfg(feature = "rt")] |
| 1092 | fn irq_handler(gpio: gpio::Gpio, wakers: &[AtomicWaker; 32]) { | 1092 | fn irq_handler(gpio: gpio::Gpio, wakers: &[AtomicWaker; 32]) { |
| 1093 | use crate::BitIter; | ||
| 1093 | // Only consider pins which have interrupts unmasked. | 1094 | // Only consider pins which have interrupts unmasked. |
| 1095 | |||
| 1094 | let bits = gpio.cpu_int().mis().read().0; | 1096 | let bits = gpio.cpu_int().mis().read().0; |
| 1095 | 1097 | ||
| 1096 | for i in BitIter(bits) { | 1098 | for i in BitIter(bits) { |
| @@ -1103,22 +1105,6 @@ fn irq_handler(gpio: gpio::Gpio, wakers: &[AtomicWaker; 32]) { | |||
| 1103 | } | 1105 | } |
| 1104 | } | 1106 | } |
| 1105 | 1107 | ||
| 1106 | struct BitIter(u32); | ||
| 1107 | |||
| 1108 | impl Iterator for BitIter { | ||
| 1109 | type Item = u32; | ||
| 1110 | |||
| 1111 | fn next(&mut self) -> Option<Self::Item> { | ||
| 1112 | match self.0.trailing_zeros() { | ||
| 1113 | 32 => None, | ||
| 1114 | b => { | ||
| 1115 | self.0 &= !(1 << b); | ||
| 1116 | Some(b) | ||
| 1117 | } | ||
| 1118 | } | ||
| 1119 | } | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | // C110x and L110x have a dedicated interrupts just for GPIOA. | 1108 | // C110x and L110x have a dedicated interrupts just for GPIOA. |
| 1123 | // | 1109 | // |
| 1124 | // These chips do not have a GROUP1 interrupt. | 1110 | // These chips do not have a GROUP1 interrupt. |
