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; ))] pub mod pdm; #[cfg(not(feature = "_nrf54l"))] // TODO +#[cfg(feature = "nrf52840")] +pub mod power; +#[cfg(not(feature = "_nrf54l"))] // TODO pub mod ppi; #[cfg(not(feature = "_nrf54l"))] // TODO #[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 @@ +//! Power + +use crate::chip::pac::{NFCT, POWER}; + +/// Puts the MCU into "System Off" mode with a power usage 0f 0.4 uA +pub fn set_system_off() { + POWER.systemoff().write(|w| w.set_systemoff(true)); +} + +/// Wake the system if there if an NFC field close to the nrf52840's antenna +pub fn wake_on_nfc_sense() { + NFCT.tasks_sense().write_value(0x01); +}