diff options
| author | Ulf Lilleengen <[email protected]> | 2025-10-14 13:23:50 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2025-10-28 10:40:43 +0100 |
| commit | de5760cc81a00966c61d668c41f6e3e4709f0283 (patch) | |
| tree | 147a96fe4ae1e11b0eeef8ef61c84baaeb490255 /examples/nrf5340 | |
| parent | 5f0085fd89f3912de970d3496d481e537dc57422 (diff) | |
feat: improve nrf54 support using new nrf-pac
* Update nrf-pac to version that modifies nrf52 register layout to match
nrf54 to reduce the amount of cfg needed for nrf54 support.
* Make the following peripherals available on nrf54: twim, twis, spim,
spis, uart, buffered uarte, dppi, gpiote, pwm, saadc
* Add examples tested on the nrf54 dk
Some code is based on or copied from other pull requests, modified to match the new
nrf-pac layout.
Co-authored-by: Dmitry Tarnyagin <[email protected]>
Diffstat (limited to 'examples/nrf5340')
| -rw-r--r-- | examples/nrf5340/src/bin/gpiote_channel.rs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/examples/nrf5340/src/bin/gpiote_channel.rs b/examples/nrf5340/src/bin/gpiote_channel.rs index 23f6fca98..a085310ce 100644 --- a/examples/nrf5340/src/bin/gpiote_channel.rs +++ b/examples/nrf5340/src/bin/gpiote_channel.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::info; | 4 | use defmt::info; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_nrf::gpio::{Input, Pull}; | 6 | use embassy_nrf::gpio::Pull; |
| 7 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; | 7 | use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity}; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 8 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 9 | ||
| @@ -12,26 +12,10 @@ async fn main(_spawner: Spawner) { | |||
| 12 | let p = embassy_nrf::init(Default::default()); | 12 | let p = embassy_nrf::init(Default::default()); |
| 13 | info!("Starting!"); | 13 | info!("Starting!"); |
| 14 | 14 | ||
| 15 | let ch1 = InputChannel::new( | 15 | let ch1 = InputChannel::new(p.GPIOTE_CH0, p.P0_23, Pull::Up, InputChannelPolarity::HiToLo); |
| 16 | p.GPIOTE_CH0, | 16 | let ch2 = InputChannel::new(p.GPIOTE_CH1, p.P0_24, Pull::Up, InputChannelPolarity::LoToHi); |
| 17 | Input::new(p.P0_23, Pull::Up), | 17 | let ch3 = InputChannel::new(p.GPIOTE_CH2, p.P0_08, Pull::Up, InputChannelPolarity::Toggle); |
| 18 | InputChannelPolarity::HiToLo, | 18 | let ch4 = InputChannel::new(p.GPIOTE_CH3, p.P0_09, Pull::Up, InputChannelPolarity::Toggle); |
| 19 | ); | ||
| 20 | let ch2 = InputChannel::new( | ||
| 21 | p.GPIOTE_CH1, | ||
| 22 | Input::new(p.P0_24, Pull::Up), | ||
| 23 | InputChannelPolarity::LoToHi, | ||
| 24 | ); | ||
| 25 | let ch3 = InputChannel::new( | ||
| 26 | p.GPIOTE_CH2, | ||
| 27 | Input::new(p.P0_08, Pull::Up), | ||
| 28 | InputChannelPolarity::Toggle, | ||
| 29 | ); | ||
| 30 | let ch4 = InputChannel::new( | ||
| 31 | p.GPIOTE_CH3, | ||
| 32 | Input::new(p.P0_09, Pull::Up), | ||
| 33 | InputChannelPolarity::Toggle, | ||
| 34 | ); | ||
| 35 | 19 | ||
| 36 | let button1 = async { | 20 | let button1 = async { |
| 37 | loop { | 21 | loop { |
