diff options
Diffstat (limited to 'examples/boot/application/nrf/src')
| -rw-r--r-- | examples/boot/application/nrf/src/bin/a.rs | 24 | ||||
| -rw-r--r-- | examples/boot/application/nrf/src/bin/b.rs | 4 |
2 files changed, 21 insertions, 7 deletions
diff --git a/examples/boot/application/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs index f317414fc..035ffe214 100644 --- a/examples/boot/application/nrf/src/bin/a.rs +++ b/examples/boot/application/nrf/src/bin/a.rs | |||
| @@ -23,14 +23,20 @@ static APP_B: &[u8] = include_bytes!("../../b.bin"); | |||
| 23 | async fn main(_spawner: Spawner) { | 23 | async fn main(_spawner: Spawner) { |
| 24 | let p = embassy_nrf::init(Default::default()); | 24 | let p = embassy_nrf::init(Default::default()); |
| 25 | 25 | ||
| 26 | #[cfg(not(feature = "nrf54"))] | ||
| 26 | let mut button = Input::new(p.P0_11, Pull::Up); | 27 | let mut button = Input::new(p.P0_11, Pull::Up); |
| 28 | #[cfg(not(feature = "nrf54"))] | ||
| 27 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 29 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 30 | #[cfg(not(feature = "nrf54"))] | ||
| 28 | let mut led_reverted = Output::new(p.P0_14, Level::High, OutputDrive::Standard); | 31 | let mut led_reverted = Output::new(p.P0_14, Level::High, OutputDrive::Standard); |
| 29 | 32 | ||
| 30 | // nRF54 DK | 33 | // nRF54 DK |
| 31 | // let mut button = Input::new(p.P1_13, Pull::Up); | 34 | #[cfg(feature = "nrf54")] |
| 32 | // let mut led = Output::new(p.P1_14, Level::Low, OutputDrive::Standard); | 35 | let mut button = Input::new(p.P1_13, Pull::Up); |
| 33 | // let mut led_reverted = Output::new(p.P2_09, Level::High, OutputDrive::Standard); | 36 | #[cfg(feature = "nrf54")] |
| 37 | let mut led = Output::new(p.P1_14, Level::Low, OutputDrive::Standard); | ||
| 38 | #[cfg(feature = "nrf54")] | ||
| 39 | let mut led_reverted = Output::new(p.P2_09, Level::High, OutputDrive::Standard); | ||
| 34 | 40 | ||
| 35 | //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); | 41 | //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); |
| 36 | //let mut button = Input::new(p.P1_02, Pull::Up); | 42 | //let mut button = Input::new(p.P1_02, Pull::Up); |
| @@ -45,8 +51,12 @@ async fn main(_spawner: Spawner) { | |||
| 45 | // the watchdog will cause the device to reset as per its configured timeout in the bootloader. | 51 | // the watchdog will cause the device to reset as per its configured timeout in the bootloader. |
| 46 | // This helps is avoid a situation where new firmware might be bad and block our executor. | 52 | // This helps is avoid a situation where new firmware might be bad and block our executor. |
| 47 | // If firmware is bad in this way then the bootloader will revert to any previous version. | 53 | // If firmware is bad in this way then the bootloader will revert to any previous version. |
| 48 | let wdt_config = wdt::Config::try_new(&p.WDT0).unwrap(); | 54 | #[cfg(feature = "nrf54")] |
| 49 | let (_wdt, [_wdt_handle]) = match Watchdog::try_new(p.WDT0, wdt_config) { | 55 | let wdt = p.WDT0; |
| 56 | #[cfg(not(feature = "nrf54"))] | ||
| 57 | let wdt = p.WDT; | ||
| 58 | let wdt_config = wdt::Config::try_new(&wdt).unwrap(); | ||
| 59 | let (_wdt, [_wdt_handle]) = match Watchdog::try_new(wdt, wdt_config) { | ||
| 50 | Ok(x) => x, | 60 | Ok(x) => x, |
| 51 | Err(_) => { | 61 | Err(_) => { |
| 52 | // Watchdog already active with the wrong number of handles, waiting for it to timeout... | 62 | // Watchdog already active with the wrong number of handles, waiting for it to timeout... |
| @@ -57,7 +67,9 @@ async fn main(_spawner: Spawner) { | |||
| 57 | }; | 67 | }; |
| 58 | 68 | ||
| 59 | // RRAMC for nRF54 | 69 | // RRAMC for nRF54 |
| 60 | // let nvmc = Nvmc::new(p.RRAMC); | 70 | #[cfg(feature = "nrf54")] |
| 71 | let nvmc = Nvmc::new(p.RRAMC); | ||
| 72 | #[cfg(not(feature = "nrf54"))] | ||
| 61 | let nvmc = Nvmc::new(p.NVMC); | 73 | let nvmc = Nvmc::new(p.NVMC); |
| 62 | let nvmc = Mutex::new(BlockingAsync::new(nvmc)); | 74 | let nvmc = Mutex::new(BlockingAsync::new(nvmc)); |
| 63 | 75 | ||
diff --git a/examples/boot/application/nrf/src/bin/b.rs b/examples/boot/application/nrf/src/bin/b.rs index 7ed78ea85..6718df5a1 100644 --- a/examples/boot/application/nrf/src/bin/b.rs +++ b/examples/boot/application/nrf/src/bin/b.rs | |||
| @@ -10,13 +10,15 @@ use panic_reset as _; | |||
| 10 | #[embassy_executor::main] | 10 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner) { | 11 | async fn main(_spawner: Spawner) { |
| 12 | let p = embassy_nrf::init(Default::default()); | 12 | let p = embassy_nrf::init(Default::default()); |
| 13 | #[cfg(not(feature = "nrf54"))] | ||
| 13 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); | 14 | let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); |
| 14 | // let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); | 15 | // let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); |
| 15 | 16 | ||
| 16 | // nRF91 DK | 17 | // nRF91 DK |
| 17 | // let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard); | 18 | // let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard); |
| 18 | // nrf54l15 dk | 19 | // nrf54l15 dk |
| 19 | // let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); | 20 | #[cfg(feature = "nrf54")] |
| 21 | let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); | ||
| 20 | 22 | ||
| 21 | loop { | 23 | loop { |
| 22 | led.set_high(); | 24 | led.set_high(); |
