diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml index 420d8ced8..62df81f42 100644 --- a/embassy-nrf/Cargo.toml +++ b/embassy-nrf/Cargo.toml @@ -5,9 +5,6 @@ authors = ["Dario Nieuwenhuis "] edition = "2018" [features] -default = [ - "defmt-default", -] defmt-default = [] defmt-trace = [] defmt-debug = [] diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 5195f926a..ef25109ee 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -85,9 +85,9 @@ impl Gpiote { pub fn new_input_channel<'a, T>( &'a self, - pin: &'a Pin>, + pin: Pin>, trigger_mode: EventPolarity, - ) -> Result, NewChannelError> { + ) -> Result, NewChannelError> { interrupt::free(|_| { unsafe { INSTANCE = self }; let index = self.allocate_channel()?; @@ -113,6 +113,7 @@ impl Gpiote { Ok(InputChannel { gpiote: self, index, + pin, }) }) } @@ -157,21 +158,26 @@ impl Gpiote { } } -pub struct InputChannel<'a> { +pub struct InputChannel<'a, T> { gpiote: &'a Gpiote, + pin: Pin>, index: u8, } -impl<'a> Drop for InputChannel<'a> { +impl<'a, T> Drop for InputChannel<'a, T> { fn drop(&mut self) { self.gpiote.free_channel(self.index); } } -impl<'a> InputChannel<'a> { +impl<'a, T> InputChannel<'a, T> { pub async fn wait(&self) -> () { self.gpiote.signals[self.index as usize].wait().await; } + + pub fn pin(&self) -> &Pin> { + &self.pin + } } pub struct OutputChannel<'a> {