From a074cd0625d68e72694c6575063ae53a840d12dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ardelean=20C=C4=83lin=20Petru?= Date: Tue, 22 Nov 2022 16:56:04 +0200 Subject: [PATCH] Update gpiote.rs Adding these changes enables us to define a channel using a mutable reference to `GPIOTE_CH(n)`, similar to how we can do with other drivers. So instead of using: ```rust let freq_in = InputChannel::new( p.GPIOTE_CH0, Input::new(&mut p.P0_19, embassy_nrf::gpio::Pull::Up), embassy_nrf::gpiote::InputChannelPolarity::HiToLo, ); ``` we can use: ```rust let freq_in = InputChannel::new( &mut p.GPIOTE_CH0, Input::new(&mut p.P0_19, embassy_nrf::gpio::Pull::Up), embassy_nrf::gpiote::InputChannelPolarity::HiToLo, ); ``` --- embassy-nrf/src/gpiote.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index 25ad9049..4f11f33e 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs @@ -419,6 +419,12 @@ macro_rules! impl_channel { $number as usize } } + impl sealed::Channel for &mut peripherals::$type {} + impl Channel for &mut peripherals::$type { + fn number(&self) -> usize { + $number as usize + } + } }; }