diff options
| author | Alexander Walter <[email protected]> | 2024-12-14 00:11:32 +0100 |
|---|---|---|
| committer | Alexander Walter <[email protected]> | 2024-12-14 00:11:32 +0100 |
| commit | 6f08c62d5ddcbeba01e098e11b9bc4ed1dfa7cc2 (patch) | |
| tree | 32bd9d231ad604b8cd850bd60b0a838f59eaec85 /embassy-nrf | |
| parent | 415db448c7c476f8c2d81e157437657868d10158 (diff) | |
Add nrf9160
Diffstat (limited to 'embassy-nrf')
| -rw-r--r-- | embassy-nrf/src/lib.rs | 2 | ||||
| -rw-r--r-- | embassy-nrf/src/power.rs | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index b6283c7f5..ec5e9f864 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -107,7 +107,7 @@ pub mod nvmc; | |||
| 107 | ))] | 107 | ))] |
| 108 | pub mod pdm; | 108 | pub mod pdm; |
| 109 | #[cfg(not(feature = "_nrf54l"))] // TODO | 109 | #[cfg(not(feature = "_nrf54l"))] // TODO |
| 110 | #[cfg(feature = "nrf52840")] | 110 | #[cfg(any(feature = "nrf52840", feature = "nrf9160-s", feature = "nrf9160-ns"))] |
| 111 | pub mod power; | 111 | pub mod power; |
| 112 | #[cfg(not(feature = "_nrf54l"))] // TODO | 112 | #[cfg(not(feature = "_nrf54l"))] // TODO |
| 113 | pub mod ppi; | 113 | pub mod ppi; |
diff --git a/embassy-nrf/src/power.rs b/embassy-nrf/src/power.rs index 440028380..66dfbae65 100644 --- a/embassy-nrf/src/power.rs +++ b/embassy-nrf/src/power.rs | |||
| @@ -1,13 +1,24 @@ | |||
| 1 | //! Power | 1 | //! Power |
| 2 | 2 | ||
| 3 | use crate::chip::pac::{NFCT, POWER}; | 3 | #[cfg(feature = "nrf52840")] |
| 4 | use crate::chip::pac::NFCT; | ||
| 4 | 5 | ||
| 5 | /// Puts the MCU into "System Off" mode with a power usage 0f 0.4 uA | 6 | #[cfg(feature = "nrf52840")] |
| 7 | use crate::chip::pac::POWER; | ||
| 8 | |||
| 9 | #[cfg(any(feature = "nrf9160-s", feature = "nrf9160-ns"))] | ||
| 10 | use crate::chip::pac::REGULATORS; | ||
| 11 | |||
| 12 | /// Puts the MCU into "System Off" mode with minimal power usage | ||
| 6 | pub fn set_system_off() { | 13 | pub fn set_system_off() { |
| 14 | #[cfg(feature = "nrf52840")] | ||
| 7 | POWER.systemoff().write(|w| w.set_systemoff(true)); | 15 | POWER.systemoff().write(|w| w.set_systemoff(true)); |
| 16 | #[cfg(any(feature = "nrf9160-s", feature = "nrf9160-ns"))] | ||
| 17 | REGULATORS.systemoff().write(|w| w.set_systemoff(true)); | ||
| 8 | } | 18 | } |
| 9 | 19 | ||
| 10 | /// Wake the system if there if an NFC field close to the nrf52840's antenna | 20 | /// Wake the system if there if an NFC field close to the nrf52840's antenna |
| 21 | #[cfg(feature = "nrf52840")] | ||
| 11 | pub fn wake_on_nfc_sense() { | 22 | pub fn wake_on_nfc_sense() { |
| 12 | NFCT.tasks_sense().write_value(0x01); | 23 | NFCT.tasks_sense().write_value(0x01); |
| 13 | } | 24 | } |
