diff options
| author | nerwalt <[email protected]> | 2025-08-12 09:56:50 -0600 |
|---|---|---|
| committer | nerwalt <[email protected]> | 2025-08-12 09:56:50 -0600 |
| commit | 985cdba7b3763346da78890f10a7330e56b3d19b (patch) | |
| tree | 3292eb04fd3342dff8e207390a7384ed24ea1f42 | |
| parent | 7672229ffe00189fd2258020f933fab6146889cb (diff) | |
Enable temp support on the nrf54l15
Alphabetize ther peripherals in the pac
| -rw-r--r-- | embassy-nrf/src/chips/nrf54l15_app.rs | 27 | ||||
| -rw-r--r-- | embassy-nrf/src/lib.rs | 1 | ||||
| -rw-r--r-- | examples/nrf54l15/src/bin/temp.rs | 25 |
3 files changed, 40 insertions, 13 deletions
diff --git a/embassy-nrf/src/chips/nrf54l15_app.rs b/embassy-nrf/src/chips/nrf54l15_app.rs index 2bc346092..ff05bbec0 100644 --- a/embassy-nrf/src/chips/nrf54l15_app.rs +++ b/embassy-nrf/src/chips/nrf54l15_app.rs | |||
| @@ -206,18 +206,6 @@ pub const EASY_DMA_SIZE: usize = (1 << 16) - 1; | |||
| 206 | pub const FLASH_SIZE: usize = 1536 * 1024; | 206 | pub const FLASH_SIZE: usize = 1536 * 1024; |
| 207 | 207 | ||
| 208 | embassy_hal_internal::peripherals! { | 208 | embassy_hal_internal::peripherals! { |
| 209 | // WDT | ||
| 210 | #[cfg(feature = "_ns")] | ||
| 211 | WDT, | ||
| 212 | #[cfg(feature = "_s")] | ||
| 213 | WDT0, | ||
| 214 | #[cfg(feature = "_s")] | ||
| 215 | WDT1, | ||
| 216 | |||
| 217 | #[cfg(feature = "_s")] | ||
| 218 | // RRAMC | ||
| 219 | RRAMC, | ||
| 220 | |||
| 221 | // GPIO port 0 | 209 | // GPIO port 0 |
| 222 | P0_00, | 210 | P0_00, |
| 223 | P0_01, | 211 | P0_01, |
| @@ -259,6 +247,21 @@ embassy_hal_internal::peripherals! { | |||
| 259 | P2_08, | 247 | P2_08, |
| 260 | P2_09, | 248 | P2_09, |
| 261 | P2_10, | 249 | P2_10, |
| 250 | |||
| 251 | #[cfg(feature = "_s")] | ||
| 252 | // RRAMC | ||
| 253 | RRAMC, | ||
| 254 | |||
| 255 | // TEMP | ||
| 256 | TEMP, | ||
| 257 | |||
| 258 | // WDT | ||
| 259 | #[cfg(feature = "_ns")] | ||
| 260 | WDT, | ||
| 261 | #[cfg(feature = "_s")] | ||
| 262 | WDT0, | ||
| 263 | #[cfg(feature = "_s")] | ||
| 264 | WDT1, | ||
| 262 | } | 265 | } |
| 263 | 266 | ||
| 264 | impl_pin!(P0_00, 0, 0); | 267 | impl_pin!(P0_00, 0, 0); |
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 9c1211f0a..2b72debeb 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -152,7 +152,6 @@ pub mod spim; | |||
| 152 | #[cfg(not(feature = "_nrf54l"))] // TODO | 152 | #[cfg(not(feature = "_nrf54l"))] // TODO |
| 153 | #[cfg(not(feature = "_nrf51"))] | 153 | #[cfg(not(feature = "_nrf51"))] |
| 154 | pub mod spis; | 154 | pub mod spis; |
| 155 | #[cfg(not(feature = "_nrf54l"))] // TODO | ||
| 156 | #[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf91")))] | 155 | #[cfg(not(any(feature = "_nrf5340-app", feature = "_nrf91")))] |
| 157 | pub mod temp; | 156 | pub mod temp; |
| 158 | #[cfg(not(feature = "_nrf54l"))] // TODO | 157 | #[cfg(not(feature = "_nrf54l"))] // TODO |
diff --git a/examples/nrf54l15/src/bin/temp.rs b/examples/nrf54l15/src/bin/temp.rs new file mode 100644 index 000000000..1d28f8ecf --- /dev/null +++ b/examples/nrf54l15/src/bin/temp.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use defmt::info; | ||
| 5 | use embassy_executor::Spawner; | ||
| 6 | use embassy_nrf::temp::Temp; | ||
| 7 | use embassy_nrf::{bind_interrupts, temp}; | ||
| 8 | use embassy_time::Timer; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | ||
| 10 | |||
| 11 | bind_interrupts!(struct Irqs { | ||
| 12 | TEMP => temp::InterruptHandler; | ||
| 13 | }); | ||
| 14 | |||
| 15 | #[embassy_executor::main] | ||
| 16 | async fn main(_spawner: Spawner) { | ||
| 17 | let p = embassy_nrf::init(Default::default()); | ||
| 18 | let mut temp = Temp::new(p.TEMP, Irqs); | ||
| 19 | |||
| 20 | loop { | ||
| 21 | let value = temp.read().await; | ||
| 22 | info!("temperature: {}℃", value.to_num::<u16>()); | ||
| 23 | Timer::after_secs(1).await; | ||
| 24 | } | ||
| 25 | } | ||
