diff options
| author | Alexander Walter <[email protected]> | 2024-12-13 19:38:30 +0100 |
|---|---|---|
| committer | Alexander Walter <[email protected]> | 2024-12-13 19:38:30 +0100 |
| commit | 415db448c7c476f8c2d81e157437657868d10158 (patch) | |
| tree | 52c98094f1fbbc99d8fc783bb9c245e3c52daa7a | |
| parent | 45d9bd57575d9391a68334a2f3966b92032d5dc6 (diff) | |
Added system off and wake-on-field
| -rw-r--r-- | embassy-nrf/src/lib.rs | 3 | ||||
| -rw-r--r-- | embassy-nrf/src/power.rs | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index e7ec4eb9d..b6283c7f5 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -107,6 +107,9 @@ 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")] | ||
| 111 | pub mod power; | ||
| 112 | #[cfg(not(feature = "_nrf54l"))] // TODO | ||
| 110 | pub mod ppi; | 113 | pub mod ppi; |
| 111 | #[cfg(not(feature = "_nrf54l"))] // TODO | 114 | #[cfg(not(feature = "_nrf54l"))] // TODO |
| 112 | #[cfg(not(any( | 115 | #[cfg(not(any( |
diff --git a/embassy-nrf/src/power.rs b/embassy-nrf/src/power.rs new file mode 100644 index 000000000..440028380 --- /dev/null +++ b/embassy-nrf/src/power.rs | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | //! Power | ||
| 2 | |||
| 3 | use crate::chip::pac::{NFCT, POWER}; | ||
| 4 | |||
| 5 | /// Puts the MCU into "System Off" mode with a power usage 0f 0.4 uA | ||
| 6 | pub fn set_system_off() { | ||
| 7 | POWER.systemoff().write(|w| w.set_systemoff(true)); | ||
| 8 | } | ||
| 9 | |||
| 10 | /// Wake the system if there if an NFC field close to the nrf52840's antenna | ||
| 11 | pub fn wake_on_nfc_sense() { | ||
| 12 | NFCT.tasks_sense().write_value(0x01); | ||
| 13 | } | ||
