Skip to content

Commit

Permalink
Fix #277 (re)setting GPIOTE interrupts for channels
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-hochreiner committed Dec 29, 2020
1 parent d2eacea commit 965cc34
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions nrf-hal-common/src/gpiote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,21 @@ impl<'a, P: GpioteInputPin> GpioteChannelEvent<'_, P> {
config_channel_event_pin(self.gpiote, self.channel, self.pin, EventPolarity::None);
self
}

/// Enables GPIOTE interrupt for pin.
/// Enables GPIOTE interrupt for channel.
pub fn enable_interrupt(&self) -> &Self {
unsafe {
self.gpiote
.intenset
.modify(|r, w| w.bits(r.bits() | self.pin.pin() as u32))
.write(|w| w.bits(1 << self.channel))
}
self
}

/// Disables GPIOTE interrupt for pin.
/// Disables GPIOTE interrupt for channel.
pub fn disable_interrupt(&self) -> &Self {
unsafe {
self.gpiote
.intenclr
.write(|w| w.bits(self.pin.pin() as u32))
.write(|w| w.bits(1 << self.channel))
}
self
}
Expand Down

0 comments on commit 965cc34

Please sign in to comment.