esp32c6_lp/lp_uart/
sleep_conf2.rs

1#[doc = "Register `SLEEP_CONF2` reader"]
2pub type R = crate::R<SLEEP_CONF2_SPEC>;
3#[doc = "Register `SLEEP_CONF2` writer"]
4pub type W = crate::W<SLEEP_CONF2_SPEC>;
5#[doc = "Field `ACTIVE_THRESHOLD` reader - The uart is activated from light sleeping mode when the input rxd edge changes more times than this register value."]
6pub type ACTIVE_THRESHOLD_R = crate::FieldReader<u16>;
7#[doc = "Field `ACTIVE_THRESHOLD` writer - The uart is activated from light sleeping mode when the input rxd edge changes more times than this register value."]
8pub type ACTIVE_THRESHOLD_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
9#[doc = "Field `RX_WAKE_UP_THRHD` reader - In wake up mode 1 this field is used to set the received data number threshold to wake up chip."]
10pub type RX_WAKE_UP_THRHD_R = crate::FieldReader;
11#[doc = "Field `RX_WAKE_UP_THRHD` writer - In wake up mode 1 this field is used to set the received data number threshold to wake up chip."]
12pub type RX_WAKE_UP_THRHD_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
13#[doc = "Field `WK_CHAR_NUM` reader - This register is used to select number of wake up char."]
14pub type WK_CHAR_NUM_R = crate::FieldReader;
15#[doc = "Field `WK_CHAR_NUM` writer - This register is used to select number of wake up char."]
16pub type WK_CHAR_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
17#[doc = "Field `WK_CHAR_MASK` reader - This register is used to mask wake up char."]
18pub type WK_CHAR_MASK_R = crate::FieldReader;
19#[doc = "Field `WK_CHAR_MASK` writer - This register is used to mask wake up char."]
20pub type WK_CHAR_MASK_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
21#[doc = "Field `WK_MODE_SEL` reader - This register is used to select wake up mode. 0: RXD toggling to wake up. 1: received data number larger than"]
22pub type WK_MODE_SEL_R = crate::FieldReader;
23#[doc = "Field `WK_MODE_SEL` writer - This register is used to select wake up mode. 0: RXD toggling to wake up. 1: received data number larger than"]
24pub type WK_MODE_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25impl R {
26    #[doc = "Bits 0:9 - The uart is activated from light sleeping mode when the input rxd edge changes more times than this register value."]
27    #[inline(always)]
28    pub fn active_threshold(&self) -> ACTIVE_THRESHOLD_R {
29        ACTIVE_THRESHOLD_R::new((self.bits & 0x03ff) as u16)
30    }
31    #[doc = "Bits 13:17 - In wake up mode 1 this field is used to set the received data number threshold to wake up chip."]
32    #[inline(always)]
33    pub fn rx_wake_up_thrhd(&self) -> RX_WAKE_UP_THRHD_R {
34        RX_WAKE_UP_THRHD_R::new(((self.bits >> 13) & 0x1f) as u8)
35    }
36    #[doc = "Bits 18:20 - This register is used to select number of wake up char."]
37    #[inline(always)]
38    pub fn wk_char_num(&self) -> WK_CHAR_NUM_R {
39        WK_CHAR_NUM_R::new(((self.bits >> 18) & 7) as u8)
40    }
41    #[doc = "Bits 21:25 - This register is used to mask wake up char."]
42    #[inline(always)]
43    pub fn wk_char_mask(&self) -> WK_CHAR_MASK_R {
44        WK_CHAR_MASK_R::new(((self.bits >> 21) & 0x1f) as u8)
45    }
46    #[doc = "Bits 26:27 - This register is used to select wake up mode. 0: RXD toggling to wake up. 1: received data number larger than"]
47    #[inline(always)]
48    pub fn wk_mode_sel(&self) -> WK_MODE_SEL_R {
49        WK_MODE_SEL_R::new(((self.bits >> 26) & 3) 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("SLEEP_CONF2")
56            .field("active_threshold", &self.active_threshold())
57            .field("rx_wake_up_thrhd", &self.rx_wake_up_thrhd())
58            .field("wk_char_num", &self.wk_char_num())
59            .field("wk_char_mask", &self.wk_char_mask())
60            .field("wk_mode_sel", &self.wk_mode_sel())
61            .finish()
62    }
63}
64impl W {
65    #[doc = "Bits 0:9 - The uart is activated from light sleeping mode when the input rxd edge changes more times than this register value."]
66    #[inline(always)]
67    #[must_use]
68    pub fn active_threshold(&mut self) -> ACTIVE_THRESHOLD_W<SLEEP_CONF2_SPEC> {
69        ACTIVE_THRESHOLD_W::new(self, 0)
70    }
71    #[doc = "Bits 13:17 - In wake up mode 1 this field is used to set the received data number threshold to wake up chip."]
72    #[inline(always)]
73    #[must_use]
74    pub fn rx_wake_up_thrhd(&mut self) -> RX_WAKE_UP_THRHD_W<SLEEP_CONF2_SPEC> {
75        RX_WAKE_UP_THRHD_W::new(self, 13)
76    }
77    #[doc = "Bits 18:20 - This register is used to select number of wake up char."]
78    #[inline(always)]
79    #[must_use]
80    pub fn wk_char_num(&mut self) -> WK_CHAR_NUM_W<SLEEP_CONF2_SPEC> {
81        WK_CHAR_NUM_W::new(self, 18)
82    }
83    #[doc = "Bits 21:25 - This register is used to mask wake up char."]
84    #[inline(always)]
85    #[must_use]
86    pub fn wk_char_mask(&mut self) -> WK_CHAR_MASK_W<SLEEP_CONF2_SPEC> {
87        WK_CHAR_MASK_W::new(self, 21)
88    }
89    #[doc = "Bits 26:27 - This register is used to select wake up mode. 0: RXD toggling to wake up. 1: received data number larger than"]
90    #[inline(always)]
91    #[must_use]
92    pub fn wk_mode_sel(&mut self) -> WK_MODE_SEL_W<SLEEP_CONF2_SPEC> {
93        WK_MODE_SEL_W::new(self, 26)
94    }
95}
96#[doc = "UART sleep configure register 2\n\nYou can [`read`](crate::Reg::read) this register and get [`sleep_conf2::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sleep_conf2::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
97pub struct SLEEP_CONF2_SPEC;
98impl crate::RegisterSpec for SLEEP_CONF2_SPEC {
99    type Ux = u32;
100}
101#[doc = "`read()` method returns [`sleep_conf2::R`](R) reader structure"]
102impl crate::Readable for SLEEP_CONF2_SPEC {}
103#[doc = "`write(|w| ..)` method takes [`sleep_conf2::W`](W) writer structure"]
104impl crate::Writable for SLEEP_CONF2_SPEC {
105    type Safety = crate::Unsafe;
106    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
107    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
108}
109#[doc = "`reset()` method sets SLEEP_CONF2 to value 0x0014_20f0"]
110impl crate::Resettable for SLEEP_CONF2_SPEC {
111    const RESET_VALUE: u32 = 0x0014_20f0;
112}