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,
);
```
This commit is contained in:
parent
ca4f615b25
commit
a074cd0625
@ -419,6 +419,12 @@ macro_rules! impl_channel {
|
|||||||
$number as usize
|
$number as usize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl sealed::Channel for &mut peripherals::$type {}
|
||||||
|
impl Channel for &mut peripherals::$type {
|
||||||
|
fn number(&self) -> usize {
|
||||||
|
$number as usize
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user