esp32s2_ulp/rtc_io/
touch_pad.rs

1#[doc = "Register `TOUCH_PAD%s` reader"]
2pub type R = crate::R<TOUCH_PAD_SPEC>;
3#[doc = "Register `TOUCH_PAD%s` writer"]
4pub type W = crate::W<TOUCH_PAD_SPEC>;
5#[doc = "Field `FUN_IE` reader - Input enable in normal execution."]
6pub type FUN_IE_R = crate::BitReader;
7#[doc = "Field `FUN_IE` writer - Input enable in normal execution."]
8pub type FUN_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `SLP_OE` reader - Output enable in sleep mode."]
10pub type SLP_OE_R = crate::BitReader;
11#[doc = "Field `SLP_OE` writer - Output enable in sleep mode."]
12pub type SLP_OE_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `SLP_IE` reader - Input enable in sleep mode."]
14pub type SLP_IE_R = crate::BitReader;
15#[doc = "Field `SLP_IE` writer - Input enable in sleep mode."]
16pub type SLP_IE_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SLP_SEL` reader - 0: no sleep mode. 1: enable sleep mode."]
18pub type SLP_SEL_R = crate::BitReader;
19#[doc = "Field `SLP_SEL` writer - 0: no sleep mode. 1: enable sleep mode."]
20pub type SLP_SEL_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `FUN_SEL` reader - Function selection."]
22pub type FUN_SEL_R = crate::FieldReader;
23#[doc = "Field `FUN_SEL` writer - Function selection."]
24pub type FUN_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `MUX_SEL` reader - Connect the RTC pad input to digital pad input. 0 is available."]
26pub type MUX_SEL_R = crate::BitReader;
27#[doc = "Field `MUX_SEL` writer - Connect the RTC pad input to digital pad input. 0 is available."]
28pub type MUX_SEL_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `XPD` reader - Touch sensor power on."]
30pub type XPD_R = crate::BitReader;
31#[doc = "Field `XPD` writer - Touch sensor power on."]
32pub type XPD_W<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `TIE_OPT` reader - The tie option of touch sensor. 0: tie low. 1: tie high."]
34pub type TIE_OPT_R = crate::BitReader;
35#[doc = "Field `TIE_OPT` writer - The tie option of touch sensor. 0: tie low. 1: tie high."]
36pub type TIE_OPT_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `START` reader - Start touch sensor."]
38pub type START_R = crate::BitReader;
39#[doc = "Field `START` writer - Start touch sensor."]
40pub type START_W<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `DAC` reader - Touch sensor slope control. 3-bit for each touch pad, defaults to 0x4."]
42pub type DAC_R = crate::FieldReader;
43#[doc = "Field `DAC` writer - Touch sensor slope control. 3-bit for each touch pad, defaults to 0x4."]
44pub type DAC_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
45#[doc = "Field `RUE` reader - Pull-down enable of the pad. 1: internal pull-down enabled. 0: internal pull-down disabled."]
46pub type RUE_R = crate::BitReader;
47#[doc = "Field `RUE` writer - Pull-down enable of the pad. 1: internal pull-down enabled. 0: internal pull-down disabled."]
48pub type RUE_W<'a, REG> = crate::BitWriter<'a, REG>;
49#[doc = "Field `RDE` reader - Pull-up enable of the pad. 1: internal pull-up enabled. 0: internal pull-up disabled."]
50pub type RDE_R = crate::BitReader;
51#[doc = "Field `RDE` writer - Pull-up enable of the pad. 1: internal pull-up enabled. 0: internal pull-up disabled."]
52pub type RDE_W<'a, REG> = crate::BitWriter<'a, REG>;
53#[doc = "Field `DRV` reader - Select the drive strength of the pad. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
54pub type DRV_R = crate::FieldReader;
55#[doc = "Field `DRV` writer - Select the drive strength of the pad. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
56pub type DRV_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
57impl R {
58    #[doc = "Bit 13 - Input enable in normal execution."]
59    #[inline(always)]
60    pub fn fun_ie(&self) -> FUN_IE_R {
61        FUN_IE_R::new(((self.bits >> 13) & 1) != 0)
62    }
63    #[doc = "Bit 14 - Output enable in sleep mode."]
64    #[inline(always)]
65    pub fn slp_oe(&self) -> SLP_OE_R {
66        SLP_OE_R::new(((self.bits >> 14) & 1) != 0)
67    }
68    #[doc = "Bit 15 - Input enable in sleep mode."]
69    #[inline(always)]
70    pub fn slp_ie(&self) -> SLP_IE_R {
71        SLP_IE_R::new(((self.bits >> 15) & 1) != 0)
72    }
73    #[doc = "Bit 16 - 0: no sleep mode. 1: enable sleep mode."]
74    #[inline(always)]
75    pub fn slp_sel(&self) -> SLP_SEL_R {
76        SLP_SEL_R::new(((self.bits >> 16) & 1) != 0)
77    }
78    #[doc = "Bits 17:18 - Function selection."]
79    #[inline(always)]
80    pub fn fun_sel(&self) -> FUN_SEL_R {
81        FUN_SEL_R::new(((self.bits >> 17) & 3) as u8)
82    }
83    #[doc = "Bit 19 - Connect the RTC pad input to digital pad input. 0 is available."]
84    #[inline(always)]
85    pub fn mux_sel(&self) -> MUX_SEL_R {
86        MUX_SEL_R::new(((self.bits >> 19) & 1) != 0)
87    }
88    #[doc = "Bit 20 - Touch sensor power on."]
89    #[inline(always)]
90    pub fn xpd(&self) -> XPD_R {
91        XPD_R::new(((self.bits >> 20) & 1) != 0)
92    }
93    #[doc = "Bit 21 - The tie option of touch sensor. 0: tie low. 1: tie high."]
94    #[inline(always)]
95    pub fn tie_opt(&self) -> TIE_OPT_R {
96        TIE_OPT_R::new(((self.bits >> 21) & 1) != 0)
97    }
98    #[doc = "Bit 22 - Start touch sensor."]
99    #[inline(always)]
100    pub fn start(&self) -> START_R {
101        START_R::new(((self.bits >> 22) & 1) != 0)
102    }
103    #[doc = "Bits 23:25 - Touch sensor slope control. 3-bit for each touch pad, defaults to 0x4."]
104    #[inline(always)]
105    pub fn dac(&self) -> DAC_R {
106        DAC_R::new(((self.bits >> 23) & 7) as u8)
107    }
108    #[doc = "Bit 27 - Pull-down enable of the pad. 1: internal pull-down enabled. 0: internal pull-down disabled."]
109    #[inline(always)]
110    pub fn rue(&self) -> RUE_R {
111        RUE_R::new(((self.bits >> 27) & 1) != 0)
112    }
113    #[doc = "Bit 28 - Pull-up enable of the pad. 1: internal pull-up enabled. 0: internal pull-up disabled."]
114    #[inline(always)]
115    pub fn rde(&self) -> RDE_R {
116        RDE_R::new(((self.bits >> 28) & 1) != 0)
117    }
118    #[doc = "Bits 29:30 - Select the drive strength of the pad. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
119    #[inline(always)]
120    pub fn drv(&self) -> DRV_R {
121        DRV_R::new(((self.bits >> 29) & 3) as u8)
122    }
123}
124#[cfg(feature = "impl-register-debug")]
125impl core::fmt::Debug for R {
126    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
127        f.debug_struct("TOUCH_PAD")
128            .field("fun_ie", &self.fun_ie())
129            .field("slp_oe", &self.slp_oe())
130            .field("slp_ie", &self.slp_ie())
131            .field("slp_sel", &self.slp_sel())
132            .field("fun_sel", &self.fun_sel())
133            .field("mux_sel", &self.mux_sel())
134            .field("xpd", &self.xpd())
135            .field("tie_opt", &self.tie_opt())
136            .field("start", &self.start())
137            .field("dac", &self.dac())
138            .field("rue", &self.rue())
139            .field("rde", &self.rde())
140            .field("drv", &self.drv())
141            .finish()
142    }
143}
144impl W {
145    #[doc = "Bit 13 - Input enable in normal execution."]
146    #[inline(always)]
147    #[must_use]
148    pub fn fun_ie(&mut self) -> FUN_IE_W<TOUCH_PAD_SPEC> {
149        FUN_IE_W::new(self, 13)
150    }
151    #[doc = "Bit 14 - Output enable in sleep mode."]
152    #[inline(always)]
153    #[must_use]
154    pub fn slp_oe(&mut self) -> SLP_OE_W<TOUCH_PAD_SPEC> {
155        SLP_OE_W::new(self, 14)
156    }
157    #[doc = "Bit 15 - Input enable in sleep mode."]
158    #[inline(always)]
159    #[must_use]
160    pub fn slp_ie(&mut self) -> SLP_IE_W<TOUCH_PAD_SPEC> {
161        SLP_IE_W::new(self, 15)
162    }
163    #[doc = "Bit 16 - 0: no sleep mode. 1: enable sleep mode."]
164    #[inline(always)]
165    #[must_use]
166    pub fn slp_sel(&mut self) -> SLP_SEL_W<TOUCH_PAD_SPEC> {
167        SLP_SEL_W::new(self, 16)
168    }
169    #[doc = "Bits 17:18 - Function selection."]
170    #[inline(always)]
171    #[must_use]
172    pub fn fun_sel(&mut self) -> FUN_SEL_W<TOUCH_PAD_SPEC> {
173        FUN_SEL_W::new(self, 17)
174    }
175    #[doc = "Bit 19 - Connect the RTC pad input to digital pad input. 0 is available."]
176    #[inline(always)]
177    #[must_use]
178    pub fn mux_sel(&mut self) -> MUX_SEL_W<TOUCH_PAD_SPEC> {
179        MUX_SEL_W::new(self, 19)
180    }
181    #[doc = "Bit 20 - Touch sensor power on."]
182    #[inline(always)]
183    #[must_use]
184    pub fn xpd(&mut self) -> XPD_W<TOUCH_PAD_SPEC> {
185        XPD_W::new(self, 20)
186    }
187    #[doc = "Bit 21 - The tie option of touch sensor. 0: tie low. 1: tie high."]
188    #[inline(always)]
189    #[must_use]
190    pub fn tie_opt(&mut self) -> TIE_OPT_W<TOUCH_PAD_SPEC> {
191        TIE_OPT_W::new(self, 21)
192    }
193    #[doc = "Bit 22 - Start touch sensor."]
194    #[inline(always)]
195    #[must_use]
196    pub fn start(&mut self) -> START_W<TOUCH_PAD_SPEC> {
197        START_W::new(self, 22)
198    }
199    #[doc = "Bits 23:25 - Touch sensor slope control. 3-bit for each touch pad, defaults to 0x4."]
200    #[inline(always)]
201    #[must_use]
202    pub fn dac(&mut self) -> DAC_W<TOUCH_PAD_SPEC> {
203        DAC_W::new(self, 23)
204    }
205    #[doc = "Bit 27 - Pull-down enable of the pad. 1: internal pull-down enabled. 0: internal pull-down disabled."]
206    #[inline(always)]
207    #[must_use]
208    pub fn rue(&mut self) -> RUE_W<TOUCH_PAD_SPEC> {
209        RUE_W::new(self, 27)
210    }
211    #[doc = "Bit 28 - Pull-up enable of the pad. 1: internal pull-up enabled. 0: internal pull-up disabled."]
212    #[inline(always)]
213    #[must_use]
214    pub fn rde(&mut self) -> RDE_W<TOUCH_PAD_SPEC> {
215        RDE_W::new(self, 28)
216    }
217    #[doc = "Bits 29:30 - Select the drive strength of the pad. 0: ~5 mA. 1: ~10 mA. 2: ~20 mA. 3: ~40 mA."]
218    #[inline(always)]
219    #[must_use]
220    pub fn drv(&mut self) -> DRV_W<TOUCH_PAD_SPEC> {
221        DRV_W::new(self, 29)
222    }
223}
224#[doc = "Touch pad %s configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`touch_pad::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`touch_pad::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
225pub struct TOUCH_PAD_SPEC;
226impl crate::RegisterSpec for TOUCH_PAD_SPEC {
227    type Ux = u32;
228}
229#[doc = "`read()` method returns [`touch_pad::R`](R) reader structure"]
230impl crate::Readable for TOUCH_PAD_SPEC {}
231#[doc = "`write(|w| ..)` method takes [`touch_pad::W`](W) writer structure"]
232impl crate::Writable for TOUCH_PAD_SPEC {
233    type Safety = crate::Unsafe;
234    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
235    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
236}
237#[doc = "`reset()` method sets TOUCH_PAD%s to value 0x5200_0000"]
238impl crate::Resettable for TOUCH_PAD_SPEC {
239    const RESET_VALUE: u32 = 0x5200_0000;
240}