Merge pull request #3645 from wackazong/power-wake-on-field
Add System Off and Wake on Field
This commit is contained in:
commit
c84996df8a
@ -107,6 +107,9 @@ pub mod nvmc;
|
||||
))]
|
||||
pub mod pdm;
|
||||
#[cfg(not(feature = "_nrf54l"))] // TODO
|
||||
#[cfg(any(feature = "nrf52840", feature = "nrf9160-s", feature = "nrf9160-ns"))]
|
||||
pub mod power;
|
||||
#[cfg(not(feature = "_nrf54l"))] // TODO
|
||||
pub mod ppi;
|
||||
#[cfg(not(feature = "_nrf54l"))] // TODO
|
||||
#[cfg(not(any(
|
||||
|
||||
@ -19,6 +19,7 @@ pub use vals::{Bitframesdd as SddPat, Discardmode as DiscardMode};
|
||||
|
||||
use crate::interrupt::InterruptExt;
|
||||
use crate::pac::nfct::vals;
|
||||
use crate::pac::NFCT;
|
||||
use crate::peripherals::NFCT;
|
||||
use crate::util::slice_in_ram;
|
||||
use crate::{interrupt, pac, Peripheral};
|
||||
@ -420,3 +421,8 @@ impl<'d> NfcT<'d> {
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
/// Wake the system if there if an NFC field close to the antenna
|
||||
pub fn wake_on_nfc_sense() {
|
||||
NFCT.tasks_sense().write_value(0x01);
|
||||
}
|
||||
|
||||
14
embassy-nrf/src/power.rs
Normal file
14
embassy-nrf/src/power.rs
Normal file
@ -0,0 +1,14 @@
|
||||
//! Power
|
||||
|
||||
#[cfg(feature = "nrf52840")]
|
||||
use crate::chip::pac::POWER;
|
||||
#[cfg(any(feature = "nrf9160-s", feature = "nrf9160-ns"))]
|
||||
use crate::chip::pac::REGULATORS;
|
||||
|
||||
/// Puts the MCU into "System Off" mode with minimal power usage
|
||||
pub fn set_system_off() {
|
||||
#[cfg(feature = "nrf52840")]
|
||||
POWER.systemoff().write(|w| w.set_systemoff(true));
|
||||
#[cfg(any(feature = "nrf9160-s", feature = "nrf9160-ns"))]
|
||||
REGULATORS.systemoff().write(|w| w.set_systemoff(true));
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user