use super::{
Ext0WakeupSource,
Ext1WakeupSource,
TimerWakeupSource,
UlpWakeupSource,
WakeSource,
WakeTriggers,
WakeupLevel,
};
use crate::{
gpio::{RtcFunction, RtcPin},
peripherals::{EXTMEM, LPWR, RTC_IO, SENS, SPI0, SPI1, SYSTEM},
rtc_cntl::{Rtc, sleep::RtcioWakeupSource},
soc::regi2c,
};
pub const RTC_CNTL_DBIAS_0V90: u8 = 0;
pub const RTC_CNTL_DBIAS_0V95: u8 = 1;
pub const RTC_CNTL_DBIAS_1V00: u8 = 2;
pub const RTC_CNTL_DBIAS_1V05: u8 = 3;
pub const RTC_CNTL_DBIAS_1V10: u8 = 4;
pub const RTC_CNTL_DBIAS_1V15: u8 = 5;
pub const RTC_CNTL_DBIAS_1V20: u8 = 6;
pub const RTC_CNTL_DBIAS_1V25: u8 = 7;
pub const RTC_CNTL_DBG_ATTEN_MONITOR_DEFAULT: u8 = 0;
pub const RTC_CNTL_ULPCP_TOUCH_START_WAIT_IN_SLEEP: u16 = 0xFF;
pub const RTC_CNTL_ULPCP_TOUCH_START_WAIT_DEFAULT: u16 = 0x10;
pub const RTC_CNTL_PLL_BUF_WAIT_DEFAULT: u8 = 20;
pub const RTC_CNTL_CK8M_WAIT_DEFAULT: u8 = 20;
pub const RTC_CNTL_XTL_BUF_WAIT_DEFAULT: u8 = 100;
pub const RTC_CNTL_MIN_SLP_VAL_MIN: u8 = 2;
pub const RTC_CNTL_DBG_ATTEN_DEEPSLEEP_DEFAULT: u8 = 15;
pub const OTHER_BLOCKS_POWERUP: u8 = 1;
pub const OTHER_BLOCKS_WAIT: u16 = 1;
pub const WIFI_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
pub const WIFI_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
pub const RTC_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
pub const RTC_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
pub const DG_WRAP_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
pub const DG_WRAP_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
pub const DG_PERI_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
pub const DG_PERI_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
pub const RTC_MEM_POWERUP_CYCLES: u8 = OTHER_BLOCKS_POWERUP;
pub const RTC_MEM_WAIT_CYCLES: u16 = OTHER_BLOCKS_WAIT;
impl WakeSource for UlpWakeupSource {
fn apply(
&self,
_rtc: &Rtc<'_>,
triggers: &mut WakeTriggers,
sleep_config: &mut RtcSleepConfig,
) {
triggers.set_ulp(self.wake_on_interrupt);
triggers.set_ulp_riscv_trap(self.wake_on_trap);
if self.clear_interrupts_on_sleep {
self.clear_interrupts();
}
sleep_config.set_rtc_peri_pd_en(false);
}
}
impl WakeSource for TimerWakeupSource {
fn apply(
&self,
rtc: &Rtc<'_>,
triggers: &mut WakeTriggers,
_sleep_config: &mut RtcSleepConfig,
) {
triggers.set_timer(true);
let rtc_cntl = LPWR::regs();
let ticks = crate::clock::us_to_rtc_ticks(self.duration.as_micros() as u64);
let now = rtc.time_since_boot_raw();
let time_in_ticks = now + ticks;
unsafe {
rtc_cntl
.slp_timer0()
.write(|w| w.slp_val_lo().bits((time_in_ticks & 0xffffffff) as u32));
rtc_cntl
.int_clr()
.write(|w| w.main_timer().clear_bit_by_one());
rtc_cntl.slp_timer1().write(|w| {
w.slp_val_hi().bits(((time_in_ticks >> 32) & 0xffff) as u16);
w.main_timer_alarm_en().set_bit()
});
}
}
}
impl<P: RtcPin> WakeSource for Ext0WakeupSource<P> {
fn apply(
&self,
_rtc: &Rtc<'_>,
triggers: &mut WakeTriggers,
sleep_config: &mut RtcSleepConfig,
) {
sleep_config.set_rtc_peri_pd_en(false);
triggers.set_ext0(true);
SENS::regs()
.sar_io_mux_conf()
.modify(|_, w| w.iomux_clk_gate_en().set_bit());
self.pin
.borrow_mut()
.rtc_set_config(true, true, RtcFunction::Rtc);
unsafe {
let rtc_io = RTC_IO::regs();
rtc_io
.ext_wakeup0()
.modify(|_, w| w.sel().bits(self.pin.borrow().rtc_number()));
let rtc_cntl = LPWR::regs();
rtc_cntl
.ext_wakeup_conf()
.modify(|_r, w| w.ext_wakeup0_lv().bit(self.level == WakeupLevel::High));
}
}
}
impl<P: RtcPin> Drop for Ext0WakeupSource<P> {
fn drop(&mut self) {
self.pin
.borrow_mut()
.rtc_set_config(true, false, RtcFunction::Rtc);
}
}
impl WakeSource for Ext1WakeupSource<'_, '_> {
fn apply(
&self,
_rtc: &Rtc<'_>,
triggers: &mut WakeTriggers,
_sleep_config: &mut RtcSleepConfig,
) {
triggers.set_ext1(true);
SENS::regs()
.sar_io_mux_conf()
.modify(|_, w| w.iomux_clk_gate_en().set_bit());
let mut pins = self.pins.borrow_mut();
let mut bits = 0u32;
for pin in pins.iter_mut() {
pin.rtc_set_config(true, true, RtcFunction::Rtc);
pin.rtcio_pad_hold(true);
bits |= 1 << pin.rtc_number();
}
unsafe {
let rtc_cntl = LPWR::regs();
rtc_cntl
.ext_wakeup1()
.modify(|_, w| w.status_clr().set_bit());
rtc_cntl.ext_wakeup1().modify(|_, w| w.sel().bits(bits));
rtc_cntl
.ext_wakeup_conf()
.modify(|_r, w| w.ext_wakeup1_lv().bit(self.level == WakeupLevel::High));
}
}
}
impl Drop for Ext1WakeupSource<'_, '_> {
fn drop(&mut self) {
let mut pins = self.pins.borrow_mut();
for pin in pins.iter_mut() {
pin.rtc_set_config(true, false, RtcFunction::Rtc);
}
}
}
impl RtcioWakeupSource<'_, '_> {
fn apply_pin(&self, pin: &mut dyn RtcPin, level: WakeupLevel) {
let rtcio = RTC_IO::regs();
pin.rtc_set_config(true, true, RtcFunction::Rtc);
rtcio.pin(pin.number() as usize).modify(|_, w| unsafe {
w.gpio_pin_wakeup_enable().set_bit();
w.gpio_pin_int_type().bits(match level {
WakeupLevel::Low => 4,
WakeupLevel::High => 5,
})
});
}
}
impl WakeSource for RtcioWakeupSource<'_, '_> {
fn apply(
&self,
_rtc: &Rtc<'_>,
triggers: &mut WakeTriggers,
sleep_config: &mut RtcSleepConfig,
) {
let mut pins = self.pins.borrow_mut();
if pins.is_empty() {
return;
}
sleep_config.set_rtc_peri_pd_en(false);
triggers.set_gpio(true);
let sens = crate::peripherals::SENS::regs();
sens.sar_io_mux_conf()
.modify(|_, w| w.iomux_clk_gate_en().set_bit());
for (pin, level) in pins.iter_mut() {
self.apply_pin(*pin, *level);
}
}
}
impl Drop for RtcioWakeupSource<'_, '_> {
fn drop(&mut self) {
let mut pins = self.pins.borrow_mut();
for (pin, _level) in pins.iter_mut() {
pin.rtc_set_config(true, false, RtcFunction::Rtc);
}
}
}
bitfield::bitfield! {
#[derive(Clone, Copy)]
pub struct RtcSleepConfig(u64);
impl Debug;
pub lslp_mem_inf_fpu, set_lslp_mem_inf_fpu: 0;
pub rtc_mem_inf_follow_cpu, set_rtc_mem_inf_follow_cpu: 1;
pub rtc_fastmem_pd_en, set_rtc_fastmem_pd_en: 2;
pub rtc_slowmem_pd_en, set_rtc_slowmem_pd_en: 3;
pub rtc_peri_pd_en, set_rtc_peri_pd_en: 4;
pub wifi_pd_en, set_wifi_pd_en: 5;
pub int_8m_pd_en, set_int_8m_pd_en: 6;
pub deep_slp, set_deep_slp: 8;
pub wdt_flashboot_mod_en, set_wdt_flashboot_mod_en: 9;
pub u8, dig_dbias_slp, set_dig_dbias_slp: 12, 10;
pub u8, rtc_dbias_slp, set_rtc_dbias_slp: 16, 13;
pub bias_sleep_monitor, set_bias_sleep_monitor: 17;
pub u8, dbg_atten_slp, set_dbg_atten_slp: 22, 18;
pub bias_sleep_slp, set_bias_sleep_slp: 23;
pub pd_cur_monitor, set_pd_cur_monitor: 24;
pub pd_cur_slp, set_pd_cur_slp: 25;
pub vddsdio_pd_en, set_vddsdio_pd_en: 26;
pub xtal_fpu, set_xtal_fpu: 27;
pub rtc_regulator_fpu, set_rtc_regulator_fpu: 28;
pub deep_slp_reject, set_deep_slp_reject: 29;
pub light_slp_reject, set_light_slp_reject: 30;
}
impl Default for RtcSleepConfig {
fn default() -> Self {
let mut cfg = Self(Default::default());
cfg.set_deep_slp_reject(true);
cfg.set_light_slp_reject(true);
cfg.set_rtc_dbias_slp(RTC_CNTL_DBIAS_1V10);
cfg.set_dig_dbias_slp(RTC_CNTL_DBIAS_1V10);
cfg.set_rtc_slowmem_pd_en(true);
cfg.set_rtc_fastmem_pd_en(true);
cfg
}
}
fn rtc_sleep_pu(val: bool) {
let rtc_cntl = LPWR::regs();
let syscon = unsafe { &*esp32s2::SYSCON::ptr() };
let bb = unsafe { &*esp32s2::BB::ptr() };
let i2s = unsafe { &*esp32s2::I2S0::ptr() };
let nrx = unsafe { &*esp32s2::NRX::ptr() };
let fe = unsafe { &*esp32s2::FE::ptr() };
let fe2 = unsafe { &*esp32s2::FE2::ptr() };
rtc_cntl
.dig_pwc()
.modify(|_, w| w.lslp_mem_force_pu().bit(val));
rtc_cntl
.pwc()
.modify(|_, w| w.slowmem_force_lpu().bit(val).fastmem_force_lpu().bit(val));
i2s.pd_conf()
.write(|w| w.plc_mem_force_pu().bit(val).fifo_force_pu().bit(val));
syscon.front_end_mem_pd().modify(|_r, w| {
w.dc_mem_force_pu()
.bit(val)
.pbus_mem_force_pu()
.bit(val)
.agc_mem_force_pu()
.bit(val)
});
bb.bbpd_ctrl()
.modify(|_r, w| w.fft_force_pu().bit(val).dc_est_force_pu().bit(val));
nrx.nrxpd_ctrl().modify(|_, w| {
w.rx_rot_force_pu()
.bit(val)
.vit_force_pu()
.bit(val)
.demap_force_pu()
.bit(val)
});
fe.gen_ctrl().modify(|_, w| w.iq_est_force_pu().bit(val));
fe2.tx_interp_ctrl()
.modify(|_, w| w.tx_inf_force_pu().bit(val));
}
impl RtcSleepConfig {
pub fn deep() -> Self {
let mut cfg = Self::default();
cfg.set_lslp_mem_inf_fpu(false);
cfg.set_rtc_mem_inf_follow_cpu(true); cfg.set_rtc_fastmem_pd_en(true);
cfg.set_rtc_slowmem_pd_en(true);
cfg.set_rtc_peri_pd_en(true);
cfg.set_wifi_pd_en(true);
cfg.set_int_8m_pd_en(true);
cfg.set_vddsdio_pd_en(true);
cfg.set_dig_dbias_slp(0);
cfg.set_deep_slp(true);
cfg.set_wdt_flashboot_mod_en(false);
cfg.set_vddsdio_pd_en(true);
cfg.set_xtal_fpu(false);
cfg.set_deep_slp_reject(true);
cfg.set_light_slp_reject(true);
cfg.set_rtc_regulator_fpu(false);
cfg.set_dbg_atten_slp(RTC_CNTL_DBG_ATTEN_DEEPSLEEP_DEFAULT);
cfg.set_rtc_dbias_slp(0);
cfg.set_xtal_fpu(false);
cfg.set_bias_sleep_monitor(true);
cfg.set_pd_cur_monitor(true);
cfg.set_bias_sleep_slp(true);
cfg.set_pd_cur_slp(true);
cfg
}
pub(crate) fn base_settings(_rtc: &Rtc<'_>) {
unsafe {
let rtc_cntl = LPWR::regs();
let extmem = EXTMEM::regs();
let system = SYSTEM::regs();
rtc_cntl
.dig_pwc()
.modify(|_, w| w.wifi_force_pd().clear_bit());
rtc_cntl
.dig_iso()
.modify(|_, w| w.wifi_force_iso().clear_bit());
rtc_cntl.ana_conf().modify(|_, w| w.pvtmon_pu().clear_bit());
rtc_cntl.timer1().modify(|_, w| {
w.pll_buf_wait().bits(RTC_CNTL_PLL_BUF_WAIT_DEFAULT);
w.ck8m_wait().bits(RTC_CNTL_CK8M_WAIT_DEFAULT)
});
rtc_cntl
.timer5()
.modify(|_, w| w.min_slp_val().bits(RTC_CNTL_MIN_SLP_VAL_MIN));
rtc_cntl.timer3().modify(|_, w| {
w.wifi_powerup_timer().bits(WIFI_POWERUP_CYCLES);
w.wifi_wait_timer().bits(WIFI_WAIT_CYCLES)
});
rtc_cntl.timer4().modify(|_, w| {
w.powerup_timer().bits(RTC_POWERUP_CYCLES);
w.wait_timer().bits(RTC_WAIT_CYCLES);
w.dg_wrap_powerup_timer().bits(DG_WRAP_POWERUP_CYCLES);
w.dg_wrap_wait_timer().bits(DG_WRAP_WAIT_CYCLES)
});
rtc_cntl.timer5().modify(|_, w| {
w.rtcmem_powerup_timer().bits(RTC_MEM_POWERUP_CYCLES);
w.rtcmem_wait_timer().bits(RTC_MEM_WAIT_CYCLES)
});
rtc_cntl.bias_conf().modify(|_, w| {
w.dec_heartbeat_width().set_bit();
w.inc_heartbeat_period().set_bit()
});
rtc_cntl.reg().modify(|_, w| {
w.dbias_wak().bits(RTC_CNTL_DBIAS_1V10);
w.dbias_slp().bits(RTC_CNTL_DBIAS_1V10)
});
rtc_cntl.timer2().modify(|_, w| {
w.ulpcp_touch_start_wait()
.bits(RTC_CNTL_ULPCP_TOUCH_START_WAIT_DEFAULT)
});
{
extmem
.pro_cache_mmu_power_ctrl()
.modify(|_, w| w.pro_cache_mmu_mem_force_on().clear_bit());
extmem
.pro_dcache_tag_power_ctrl()
.modify(|_, w| w.pro_dcache_tag_mem_force_on().clear_bit());
extmem
.pro_icache_tag_power_ctrl()
.modify(|_, w| w.pro_icache_tag_mem_force_on().clear_bit());
system.rom_ctrl_0().modify(|_, w| w.rom_fo().bits(0));
system.sram_ctrl_0().modify(|_, w| w.sram_fo().bits(0));
SPI0::regs()
.clock_gate()
.modify(|_, w| w.clk_en().clear_bit());
SPI1::regs()
.clock_gate()
.modify(|_, w| w.clk_en().clear_bit());
}
{
rtc_cntl
.clk_conf()
.modify(|_, w| w.ck8m_force_pu().clear_bit());
rtc_cntl
.options0()
.modify(|_, w| w.xtl_force_pu().clear_bit());
rtc_cntl.ana_conf().modify(|_, w| {
w.plla_force_pu().clear_bit();
w.plla_force_pd().set_bit()
});
rtc_cntl.options0().modify(|_, w| {
w.bbpll_force_pu().clear_bit();
w.bbpll_i2c_force_pu().clear_bit();
w.bb_i2c_force_pu().clear_bit()
});
rtc_cntl.pwc().modify(|_, w| w.force_pu().clear_bit());
rtc_cntl.reg().modify(|_, w| {
w.regulator_force_pu().clear_bit();
w.dboost_force_pu().clear_bit()
});
rtc_cntl.pwc().modify(|_, w| {
w.slowmem_force_pu().clear_bit();
w.fastmem_force_pu().clear_bit();
w.slowmem_force_noiso().clear_bit();
w.fastmem_force_noiso().clear_bit()
});
rtc_cntl.reg().modify(|_, w| w.dboost_force_pd().set_bit());
rtc_cntl
.ana_conf()
.modify(|_, w| w.sar_i2c_force_pd().clear_bit());
rtc_cntl.pwc().modify(|_, w| {
w.slowmem_force_pu().clear_bit();
w.fastmem_force_pu().clear_bit()
});
system
.mem_pd_mask()
.modify(|_, w| w.lslp_mem_pd_mask().clear_bit());
rtc_sleep_pu(false);
rtc_cntl.dig_pwc().modify(|_, w| {
w.dg_wrap_force_pu().clear_bit();
w.wifi_force_pu().clear_bit()
});
rtc_cntl.dig_iso().modify(|_, w| {
w.dg_wrap_force_noiso().clear_bit();
w.dg_wrap_force_iso().clear_bit()
});
rtc_cntl.dig_iso().modify(|_, w| {
w.wifi_force_noiso().clear_bit();
w.wifi_force_iso().clear_bit()
});
rtc_cntl.pwc().modify(|_, w| w.force_noiso().clear_bit());
system
.cpu_per_conf()
.modify(|_, w| w.cpu_wait_mode_force_on().clear_bit());
rtc_cntl.dig_iso().modify(|_, w| {
w.dg_pad_force_unhold().clear_bit();
w.dg_pad_force_noiso().clear_bit()
});
}
rtc_cntl
.dig_iso()
.modify(|_, w| w.wifi_force_iso().set_bit());
rtc_cntl
.dig_pwc()
.modify(|_, w| w.wifi_force_pd().set_bit());
rtc_cntl.int_ena().write(|w| w.bits(0));
rtc_cntl.int_clr().write(|w| w.bits(u32::MAX));
}
}
pub(crate) fn apply(&self) {
let rtc_cntl = LPWR::regs();
if self.deep_slp() {
unsafe {
rtc_cntl.brown_out().modify(|_, w| {
w.int_wait().bits(2);
w.close_flash_ena().clear_bit();
w.pd_rf_ena().clear_bit();
w.cnt_clr().set_bit()
});
rtc_cntl.brown_out().modify(|_, w| {
w.cnt_clr().clear_bit();
w.rst_wait().bits(0x3fff);
w.rst_ena().clear_bit();
w.brown_out2_ena().set_bit();
w.rst_sel().set_bit()
});
regi2c::I2C_BOD_REG_THRESHOLD.write_field(0);
rtc_cntl.brown_out().modify(|_, w| w.ena().clear_bit());
rtc_cntl.int_ena().modify(|_, w| w.brown_out().clear_bit());
}
}
if self.lslp_mem_inf_fpu() {
rtc_sleep_pu(true);
}
let mem_folw_cpu = self.rtc_mem_inf_follow_cpu();
rtc_cntl.pwc().modify(|_, w| {
w.slowmem_folw_cpu().bit(mem_folw_cpu);
w.fastmem_folw_cpu().bit(mem_folw_cpu)
});
let rtc_fastmem_pd_en = self.rtc_fastmem_pd_en();
rtc_cntl.pwc().modify(|_, w| {
w.fastmem_pd_en().bit(rtc_fastmem_pd_en);
w.fastmem_force_pu().bit(!rtc_fastmem_pd_en);
w.fastmem_force_noiso().bit(!rtc_fastmem_pd_en)
});
let rtc_slowmem_pd_en = self.rtc_slowmem_pd_en();
rtc_cntl.pwc().modify(|_, w| {
w.slowmem_pd_en().bit(rtc_slowmem_pd_en);
w.slowmem_force_pu().bit(!rtc_slowmem_pd_en);
w.slowmem_force_noiso().bit(!rtc_slowmem_pd_en)
});
let rtc_peri_pd_en = self.rtc_peri_pd_en();
rtc_cntl.pwc().modify(|_, w| w.pd_en().bit(rtc_peri_pd_en));
if self.wifi_pd_en() {
rtc_cntl
.dig_iso()
.modify(|_, w| w.wifi_force_noiso().clear_bit());
rtc_cntl.dig_pwc().modify(|_, w| {
w.wifi_force_pu().clear_bit();
w.wifi_pd_en().set_bit()
});
} else {
rtc_cntl.dig_pwc().modify(|_, w| w.wifi_pd_en().clear_bit());
}
unsafe {
rtc_cntl.reg().modify(|_, w| {
w.dbias_slp().bits(self.rtc_dbias_slp());
w.dig_reg_dbias_slp().bits(self.dig_dbias_slp())
});
rtc_cntl.bias_conf().modify(|_, w| {
w.dbg_atten_monitor()
.bits(RTC_CNTL_DBG_ATTEN_MONITOR_DEFAULT);
w.bias_sleep_monitor().bit(self.bias_sleep_monitor());
w.bias_sleep_deep_slp().bit(self.bias_sleep_slp());
w.pd_cur_monitor().bit(self.pd_cur_monitor());
w.pd_cur_deep_slp().bit(self.pd_cur_slp());
w.dbg_atten_deep_slp().bits(self.dbg_atten_slp())
});
if self.deep_slp() {
rtc_cntl
.dig_pwc()
.modify(|_, w| w.dg_wrap_pd_en().set_bit());
rtc_cntl.ana_conf().modify(|_, w| {
w.ckgen_i2c_pu().clear_bit();
w.pll_i2c_pu().clear_bit();
w.rfrx_pbus_pu().clear_bit();
w.txrf_i2c_pu().clear_bit()
});
rtc_cntl
.options0()
.modify(|_, w| w.bb_i2c_force_pu().clear_bit());
} else {
rtc_cntl
.dig_pwc()
.modify(|_, w| w.dg_wrap_pd_en().clear_bit());
}
let rtc_regulator_fpu = self.rtc_regulator_fpu();
rtc_cntl
.reg()
.modify(|_, w| w.regulator_force_pu().bit(rtc_regulator_fpu));
let int_8m_pd_en = self.int_8m_pd_en();
rtc_cntl
.clk_conf()
.modify(|_, w| w.ck8m_force_pu().bit(!int_8m_pd_en));
rtc_cntl.sdio_conf().modify(|_, w| {
w.sdio_force().clear_bit();
w.sdio_reg_pd_en().bit(self.vddsdio_pd_en())
});
rtc_cntl.slp_reject_conf().modify(|_, w| {
w.deep_slp_reject_en().bit(self.deep_slp_reject());
w.light_slp_reject_en().bit(self.light_slp_reject())
});
rtc_cntl.timer2().modify(|_, w| {
w.ulpcp_touch_start_wait()
.bits(RTC_CNTL_ULPCP_TOUCH_START_WAIT_IN_SLEEP)
});
rtc_cntl
.options0()
.modify(|_, w| w.xtl_force_pu().bit(self.xtal_fpu()));
}
}
pub(crate) fn start_sleep(&self, wakeup_triggers: WakeTriggers) {
unsafe {
LPWR::regs()
.reset_state()
.modify(|_, w| w.procpu_stat_vector_sel().set_bit());
LPWR::regs()
.wakeup_state()
.modify(|_, w| w.wakeup_ena().bits(wakeup_triggers.0.into()));
LPWR::regs().state0().write(|w| {
w.sleep_en().set_bit();
w.slp_wakeup().set_bit()
});
}
}
pub(crate) fn finish_sleep(&self) {
unsafe {
LPWR::regs().int_clr().write(|w| {
w.slp_reject()
.clear_bit_by_one()
.slp_wakeup()
.clear_bit_by_one()
});
if self.lslp_mem_inf_fpu() {
rtc_sleep_pu(true);
}
LPWR::regs().timer2().modify(|_, w| {
w.ulpcp_touch_start_wait()
.bits(RTC_CNTL_ULPCP_TOUCH_START_WAIT_DEFAULT)
});
}
}
}