esp32c3/rtc_cntl/
retention_ctrl.rs1#[doc = "Register `RETENTION_CTRL` reader"]
2pub type R = crate::R<RETENTION_CTRL_SPEC>;
3#[doc = "Register `RETENTION_CTRL` writer"]
4pub type W = crate::W<RETENTION_CTRL_SPEC>;
5#[doc = "Field `RETENTION_CLK_SEL` reader - Retention clk sel"]
6pub type RETENTION_CLK_SEL_R = crate::BitReader;
7#[doc = "Field `RETENTION_CLK_SEL` writer - Retention clk sel"]
8pub type RETENTION_CLK_SEL_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `RETENTION_DONE_WAIT` reader - Retention done wait time"]
10pub type RETENTION_DONE_WAIT_R = crate::FieldReader;
11#[doc = "Field `RETENTION_DONE_WAIT` writer - Retention done wait time"]
12pub type RETENTION_DONE_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13#[doc = "Field `RETENTION_CLKOFF_WAIT` reader - Retention clkoff wait time"]
14pub type RETENTION_CLKOFF_WAIT_R = crate::FieldReader;
15#[doc = "Field `RETENTION_CLKOFF_WAIT` writer - Retention clkoff wait time"]
16pub type RETENTION_CLKOFF_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
17#[doc = "Field `RETENTION_EN` reader - enable cpu retention when light sleep"]
18pub type RETENTION_EN_R = crate::BitReader;
19#[doc = "Field `RETENTION_EN` writer - enable cpu retention when light sleep"]
20pub type RETENTION_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `RETENTION_WAIT` reader - wait cycles for rention operation"]
22pub type RETENTION_WAIT_R = crate::FieldReader;
23#[doc = "Field `RETENTION_WAIT` writer - wait cycles for rention operation"]
24pub type RETENTION_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
25impl R {
26    #[doc = "Bit 18 - Retention clk sel"]
27    #[inline(always)]
28    pub fn retention_clk_sel(&self) -> RETENTION_CLK_SEL_R {
29        RETENTION_CLK_SEL_R::new(((self.bits >> 18) & 1) != 0)
30    }
31    #[doc = "Bits 19:21 - Retention done wait time"]
32    #[inline(always)]
33    pub fn retention_done_wait(&self) -> RETENTION_DONE_WAIT_R {
34        RETENTION_DONE_WAIT_R::new(((self.bits >> 19) & 7) as u8)
35    }
36    #[doc = "Bits 22:25 - Retention clkoff wait time"]
37    #[inline(always)]
38    pub fn retention_clkoff_wait(&self) -> RETENTION_CLKOFF_WAIT_R {
39        RETENTION_CLKOFF_WAIT_R::new(((self.bits >> 22) & 0x0f) as u8)
40    }
41    #[doc = "Bit 26 - enable cpu retention when light sleep"]
42    #[inline(always)]
43    pub fn retention_en(&self) -> RETENTION_EN_R {
44        RETENTION_EN_R::new(((self.bits >> 26) & 1) != 0)
45    }
46    #[doc = "Bits 27:31 - wait cycles for rention operation"]
47    #[inline(always)]
48    pub fn retention_wait(&self) -> RETENTION_WAIT_R {
49        RETENTION_WAIT_R::new(((self.bits >> 27) & 0x1f) as u8)
50    }
51}
52#[cfg(feature = "impl-register-debug")]
53impl core::fmt::Debug for R {
54    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
55        f.debug_struct("RETENTION_CTRL")
56            .field("retention_clk_sel", &self.retention_clk_sel())
57            .field("retention_done_wait", &self.retention_done_wait())
58            .field("retention_clkoff_wait", &self.retention_clkoff_wait())
59            .field("retention_en", &self.retention_en())
60            .field("retention_wait", &self.retention_wait())
61            .finish()
62    }
63}
64impl W {
65    #[doc = "Bit 18 - Retention clk sel"]
66    #[inline(always)]
67    pub fn retention_clk_sel(&mut self) -> RETENTION_CLK_SEL_W<RETENTION_CTRL_SPEC> {
68        RETENTION_CLK_SEL_W::new(self, 18)
69    }
70    #[doc = "Bits 19:21 - Retention done wait time"]
71    #[inline(always)]
72    pub fn retention_done_wait(&mut self) -> RETENTION_DONE_WAIT_W<RETENTION_CTRL_SPEC> {
73        RETENTION_DONE_WAIT_W::new(self, 19)
74    }
75    #[doc = "Bits 22:25 - Retention clkoff wait time"]
76    #[inline(always)]
77    pub fn retention_clkoff_wait(&mut self) -> RETENTION_CLKOFF_WAIT_W<RETENTION_CTRL_SPEC> {
78        RETENTION_CLKOFF_WAIT_W::new(self, 22)
79    }
80    #[doc = "Bit 26 - enable cpu retention when light sleep"]
81    #[inline(always)]
82    pub fn retention_en(&mut self) -> RETENTION_EN_W<RETENTION_CTRL_SPEC> {
83        RETENTION_EN_W::new(self, 26)
84    }
85    #[doc = "Bits 27:31 - wait cycles for rention operation"]
86    #[inline(always)]
87    pub fn retention_wait(&mut self) -> RETENTION_WAIT_W<RETENTION_CTRL_SPEC> {
88        RETENTION_WAIT_W::new(self, 27)
89    }
90}
91#[doc = "rtc configure register\n\nYou can [`read`](crate::Reg::read) this register and get [`retention_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`retention_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
92pub struct RETENTION_CTRL_SPEC;
93impl crate::RegisterSpec for RETENTION_CTRL_SPEC {
94    type Ux = u32;
95}
96#[doc = "`read()` method returns [`retention_ctrl::R`](R) reader structure"]
97impl crate::Readable for RETENTION_CTRL_SPEC {}
98#[doc = "`write(|w| ..)` method takes [`retention_ctrl::W`](W) writer structure"]
99impl crate::Writable for RETENTION_CTRL_SPEC {
100    type Safety = crate::Unsafe;
101}
102#[doc = "`reset()` method sets RETENTION_CTRL to value 0xa0d0_0000"]
103impl crate::Resettable for RETENTION_CTRL_SPEC {
104    const RESET_VALUE: u32 = 0xa0d0_0000;
105}