aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Walter <[email protected]>2024-12-13 19:38:30 +0100
committerAlexander Walter <[email protected]>2024-12-13 19:38:30 +0100
commit415db448c7c476f8c2d81e157437657868d10158 (patch)
tree52c98094f1fbbc99d8fc783bb9c245e3c52daa7a
parent45d9bd57575d9391a68334a2f3966b92032d5dc6 (diff)
Added system off and wake-on-field
-rw-r--r--embassy-nrf/src/lib.rs3
-rw-r--r--embassy-nrf/src/power.rs13
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))]
108pub mod pdm; 108pub mod pdm;
109#[cfg(not(feature = "_nrf54l"))] // TODO 109#[cfg(not(feature = "_nrf54l"))] // TODO
110#[cfg(feature = "nrf52840")]
111pub mod power;
112#[cfg(not(feature = "_nrf54l"))] // TODO
110pub mod ppi; 113pub 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
3use crate::chip::pac::{NFCT, POWER};
4
5/// Puts the MCU into "System Off" mode with a power usage 0f 0.4 uA
6pub 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
11pub fn wake_on_nfc_sense() {
12 NFCT.tasks_sense().write_value(0x01);
13}