esp32p4/pmu/
touch_pwr_cntl.rs

1#[doc = "Register `TOUCH_PWR_CNTL` reader"]
2pub type R = crate::R<TOUCH_PWR_CNTL_SPEC>;
3#[doc = "Register `TOUCH_PWR_CNTL` writer"]
4pub type W = crate::W<TOUCH_PWR_CNTL_SPEC>;
5#[doc = "Field `TOUCH_WAIT_CYCLES` reader - need_des"]
6pub type TOUCH_WAIT_CYCLES_R = crate::FieldReader<u16>;
7#[doc = "Field `TOUCH_WAIT_CYCLES` writer - need_des"]
8pub type TOUCH_WAIT_CYCLES_W<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
9#[doc = "Field `TOUCH_SLEEP_CYCLES` reader - need_des"]
10pub type TOUCH_SLEEP_CYCLES_R = crate::FieldReader<u16>;
11#[doc = "Field `TOUCH_SLEEP_CYCLES` writer - need_des"]
12pub type TOUCH_SLEEP_CYCLES_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
13#[doc = "Field `TOUCH_FORCE_DONE` reader - need_des"]
14pub type TOUCH_FORCE_DONE_R = crate::BitReader;
15#[doc = "Field `TOUCH_FORCE_DONE` writer - need_des"]
16pub type TOUCH_FORCE_DONE_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `TOUCH_SLEEP_TIMER_EN` reader - need_des"]
18pub type TOUCH_SLEEP_TIMER_EN_R = crate::BitReader;
19#[doc = "Field `TOUCH_SLEEP_TIMER_EN` writer - need_des"]
20pub type TOUCH_SLEEP_TIMER_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22    #[doc = "Bits 5:13 - need_des"]
23    #[inline(always)]
24    pub fn touch_wait_cycles(&self) -> TOUCH_WAIT_CYCLES_R {
25        TOUCH_WAIT_CYCLES_R::new(((self.bits >> 5) & 0x01ff) as u16)
26    }
27    #[doc = "Bits 14:29 - need_des"]
28    #[inline(always)]
29    pub fn touch_sleep_cycles(&self) -> TOUCH_SLEEP_CYCLES_R {
30        TOUCH_SLEEP_CYCLES_R::new(((self.bits >> 14) & 0xffff) as u16)
31    }
32    #[doc = "Bit 30 - need_des"]
33    #[inline(always)]
34    pub fn touch_force_done(&self) -> TOUCH_FORCE_DONE_R {
35        TOUCH_FORCE_DONE_R::new(((self.bits >> 30) & 1) != 0)
36    }
37    #[doc = "Bit 31 - need_des"]
38    #[inline(always)]
39    pub fn touch_sleep_timer_en(&self) -> TOUCH_SLEEP_TIMER_EN_R {
40        TOUCH_SLEEP_TIMER_EN_R::new(((self.bits >> 31) & 1) != 0)
41    }
42}
43#[cfg(feature = "impl-register-debug")]
44impl core::fmt::Debug for R {
45    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
46        f.debug_struct("TOUCH_PWR_CNTL")
47            .field(
48                "touch_wait_cycles",
49                &format_args!("{}", self.touch_wait_cycles().bits()),
50            )
51            .field(
52                "touch_sleep_cycles",
53                &format_args!("{}", self.touch_sleep_cycles().bits()),
54            )
55            .field(
56                "touch_force_done",
57                &format_args!("{}", self.touch_force_done().bit()),
58            )
59            .field(
60                "touch_sleep_timer_en",
61                &format_args!("{}", self.touch_sleep_timer_en().bit()),
62            )
63            .finish()
64    }
65}
66#[cfg(feature = "impl-register-debug")]
67impl core::fmt::Debug for crate::generic::Reg<TOUCH_PWR_CNTL_SPEC> {
68    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
69        core::fmt::Debug::fmt(&self.read(), f)
70    }
71}
72impl W {
73    #[doc = "Bits 5:13 - need_des"]
74    #[inline(always)]
75    #[must_use]
76    pub fn touch_wait_cycles(&mut self) -> TOUCH_WAIT_CYCLES_W<TOUCH_PWR_CNTL_SPEC> {
77        TOUCH_WAIT_CYCLES_W::new(self, 5)
78    }
79    #[doc = "Bits 14:29 - need_des"]
80    #[inline(always)]
81    #[must_use]
82    pub fn touch_sleep_cycles(&mut self) -> TOUCH_SLEEP_CYCLES_W<TOUCH_PWR_CNTL_SPEC> {
83        TOUCH_SLEEP_CYCLES_W::new(self, 14)
84    }
85    #[doc = "Bit 30 - need_des"]
86    #[inline(always)]
87    #[must_use]
88    pub fn touch_force_done(&mut self) -> TOUCH_FORCE_DONE_W<TOUCH_PWR_CNTL_SPEC> {
89        TOUCH_FORCE_DONE_W::new(self, 30)
90    }
91    #[doc = "Bit 31 - need_des"]
92    #[inline(always)]
93    #[must_use]
94    pub fn touch_sleep_timer_en(&mut self) -> TOUCH_SLEEP_TIMER_EN_W<TOUCH_PWR_CNTL_SPEC> {
95        TOUCH_SLEEP_TIMER_EN_W::new(self, 31)
96    }
97}
98#[doc = "need_des\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`touch_pwr_cntl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`touch_pwr_cntl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct TOUCH_PWR_CNTL_SPEC;
100impl crate::RegisterSpec for TOUCH_PWR_CNTL_SPEC {
101    type Ux = u32;
102}
103#[doc = "`read()` method returns [`touch_pwr_cntl::R`](R) reader structure"]
104impl crate::Readable for TOUCH_PWR_CNTL_SPEC {}
105#[doc = "`write(|w| ..)` method takes [`touch_pwr_cntl::W`](W) writer structure"]
106impl crate::Writable for TOUCH_PWR_CNTL_SPEC {
107    type Safety = crate::Unsafe;
108    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
109    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
110}
111#[doc = "`reset()` method sets TOUCH_PWR_CNTL to value 0x0019_0140"]
112impl crate::Resettable for TOUCH_PWR_CNTL_SPEC {
113    const RESET_VALUE: u32 = 0x0019_0140;
114}