Skip to content

Commit 965cc34

Browse files
Fix #277 (re)setting GPIOTE interrupts for channels
1 parent d2eacea commit 965cc34

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nrf-hal-common/src/gpiote.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,21 @@ impl<'a, P: GpioteInputPin> GpioteChannelEvent<'_, P> {
221221
config_channel_event_pin(self.gpiote, self.channel, self.pin, EventPolarity::None);
222222
self
223223
}
224-
225-
/// Enables GPIOTE interrupt for pin.
224+
/// Enables GPIOTE interrupt for channel.
226225
pub fn enable_interrupt(&self) -> &Self {
227226
unsafe {
228227
self.gpiote
229228
.intenset
230-
.modify(|r, w| w.bits(r.bits() | self.pin.pin() as u32))
229+
.write(|w| w.bits(1 << self.channel))
231230
}
232231
self
233232
}
234-
235-
/// Disables GPIOTE interrupt for pin.
233+
/// Disables GPIOTE interrupt for channel.
236234
pub fn disable_interrupt(&self) -> &Self {
237235
unsafe {
238236
self.gpiote
239237
.intenclr
240-
.write(|w| w.bits(self.pin.pin() as u32))
238+
.write(|w| w.bits(1 << self.channel))
241239
}
242240
self
243241
}

0 commit comments

Comments
 (0)