esp32s3/rtc_cntl/
touch_ctrl2.rs1#[doc = "Register `TOUCH_CTRL2` reader"]
2pub type R = crate::R<TOUCH_CTRL2_SPEC>;
3#[doc = "Register `TOUCH_CTRL2` writer"]
4pub type W = crate::W<TOUCH_CTRL2_SPEC>;
5#[doc = "Field `TOUCH_DRANGE` reader - TOUCH_DRANGE"]
6pub type TOUCH_DRANGE_R = crate::FieldReader;
7#[doc = "Field `TOUCH_DRANGE` writer - TOUCH_DRANGE"]
8pub type TOUCH_DRANGE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "Field `TOUCH_DREFL` reader - TOUCH_DREFL"]
10pub type TOUCH_DREFL_R = crate::FieldReader;
11#[doc = "Field `TOUCH_DREFL` writer - TOUCH_DREFL"]
12pub type TOUCH_DREFL_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `TOUCH_DREFH` reader - TOUCH_DREFH"]
14pub type TOUCH_DREFH_R = crate::FieldReader;
15#[doc = "Field `TOUCH_DREFH` writer - TOUCH_DREFH"]
16pub type TOUCH_DREFH_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `TOUCH_XPD_BIAS` reader - TOUCH_XPD_BIAS"]
18pub type TOUCH_XPD_BIAS_R = crate::BitReader;
19#[doc = "Field `TOUCH_XPD_BIAS` writer - TOUCH_XPD_BIAS"]
20pub type TOUCH_XPD_BIAS_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `TOUCH_REFC` reader - TOUCH pad0 reference cap"]
22pub type TOUCH_REFC_R = crate::FieldReader;
23#[doc = "Field `TOUCH_REFC` writer - TOUCH pad0 reference cap"]
24pub type TOUCH_REFC_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
25#[doc = "Field `TOUCH_DBIAS` reader - 1:use self bias 0:use bandgap bias"]
26pub type TOUCH_DBIAS_R = crate::BitReader;
27#[doc = "Field `TOUCH_DBIAS` writer - 1:use self bias 0:use bandgap bias"]
28pub type TOUCH_DBIAS_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `TOUCH_SLP_TIMER_EN` reader - touch timer enable bit"]
30pub type TOUCH_SLP_TIMER_EN_R = crate::BitReader;
31#[doc = "Field `TOUCH_SLP_TIMER_EN` writer - touch timer enable bit"]
32pub type TOUCH_SLP_TIMER_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `TOUCH_START_FSM_EN` reader - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm"]
34pub type TOUCH_START_FSM_EN_R = crate::BitReader;
35#[doc = "Field `TOUCH_START_FSM_EN` writer - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm"]
36pub type TOUCH_START_FSM_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `TOUCH_START_EN` reader - 1: start touch fsm"]
38pub type TOUCH_START_EN_R = crate::BitReader;
39#[doc = "Field `TOUCH_START_EN` writer - 1: start touch fsm"]
40pub type TOUCH_START_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `TOUCH_START_FORCE` reader - 1: to start touch fsm by SW"]
42pub type TOUCH_START_FORCE_R = crate::BitReader;
43#[doc = "Field `TOUCH_START_FORCE` writer - 1: to start touch fsm by SW"]
44pub type TOUCH_START_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `TOUCH_XPD_WAIT` reader - the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD"]
46pub type TOUCH_XPD_WAIT_R = crate::FieldReader;
47#[doc = "Field `TOUCH_XPD_WAIT` writer - the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD"]
48pub type TOUCH_XPD_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
49#[doc = "Field `TOUCH_SLP_CYC_DIV` reader - when a touch pad is active sleep cycle could be divided by this number"]
50pub type TOUCH_SLP_CYC_DIV_R = crate::FieldReader;
51#[doc = "Field `TOUCH_SLP_CYC_DIV` writer - when a touch pad is active sleep cycle could be divided by this number"]
52pub type TOUCH_SLP_CYC_DIV_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
53#[doc = "Field `TOUCH_TIMER_FORCE_DONE` reader - force touch timer done"]
54pub type TOUCH_TIMER_FORCE_DONE_R = crate::FieldReader;
55#[doc = "Field `TOUCH_TIMER_FORCE_DONE` writer - force touch timer done"]
56pub type TOUCH_TIMER_FORCE_DONE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
57#[doc = "Field `TOUCH_RESET` reader - reset upgrade touch"]
58pub type TOUCH_RESET_R = crate::BitReader;
59#[doc = "Field `TOUCH_RESET` writer - reset upgrade touch"]
60pub type TOUCH_RESET_W<'a, REG> = crate::BitWriter<'a, REG>;
61#[doc = "Field `TOUCH_CLK_FO` reader - touch clock force on"]
62pub type TOUCH_CLK_FO_R = crate::BitReader;
63#[doc = "Field `TOUCH_CLK_FO` writer - touch clock force on"]
64pub type TOUCH_CLK_FO_W<'a, REG> = crate::BitWriter<'a, REG>;
65#[doc = "Field `TOUCH_CLKGATE_EN` reader - touch clock enable"]
66pub type TOUCH_CLKGATE_EN_R = crate::BitReader;
67#[doc = "Field `TOUCH_CLKGATE_EN` writer - touch clock enable"]
68pub type TOUCH_CLKGATE_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
69impl R {
70 #[doc = "Bits 2:3 - TOUCH_DRANGE"]
71 #[inline(always)]
72 pub fn touch_drange(&self) -> TOUCH_DRANGE_R {
73 TOUCH_DRANGE_R::new(((self.bits >> 2) & 3) as u8)
74 }
75 #[doc = "Bits 4:5 - TOUCH_DREFL"]
76 #[inline(always)]
77 pub fn touch_drefl(&self) -> TOUCH_DREFL_R {
78 TOUCH_DREFL_R::new(((self.bits >> 4) & 3) as u8)
79 }
80 #[doc = "Bits 6:7 - TOUCH_DREFH"]
81 #[inline(always)]
82 pub fn touch_drefh(&self) -> TOUCH_DREFH_R {
83 TOUCH_DREFH_R::new(((self.bits >> 6) & 3) as u8)
84 }
85 #[doc = "Bit 8 - TOUCH_XPD_BIAS"]
86 #[inline(always)]
87 pub fn touch_xpd_bias(&self) -> TOUCH_XPD_BIAS_R {
88 TOUCH_XPD_BIAS_R::new(((self.bits >> 8) & 1) != 0)
89 }
90 #[doc = "Bits 9:11 - TOUCH pad0 reference cap"]
91 #[inline(always)]
92 pub fn touch_refc(&self) -> TOUCH_REFC_R {
93 TOUCH_REFC_R::new(((self.bits >> 9) & 7) as u8)
94 }
95 #[doc = "Bit 12 - 1:use self bias 0:use bandgap bias"]
96 #[inline(always)]
97 pub fn touch_dbias(&self) -> TOUCH_DBIAS_R {
98 TOUCH_DBIAS_R::new(((self.bits >> 12) & 1) != 0)
99 }
100 #[doc = "Bit 13 - touch timer enable bit"]
101 #[inline(always)]
102 pub fn touch_slp_timer_en(&self) -> TOUCH_SLP_TIMER_EN_R {
103 TOUCH_SLP_TIMER_EN_R::new(((self.bits >> 13) & 1) != 0)
104 }
105 #[doc = "Bit 14 - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm"]
106 #[inline(always)]
107 pub fn touch_start_fsm_en(&self) -> TOUCH_START_FSM_EN_R {
108 TOUCH_START_FSM_EN_R::new(((self.bits >> 14) & 1) != 0)
109 }
110 #[doc = "Bit 15 - 1: start touch fsm"]
111 #[inline(always)]
112 pub fn touch_start_en(&self) -> TOUCH_START_EN_R {
113 TOUCH_START_EN_R::new(((self.bits >> 15) & 1) != 0)
114 }
115 #[doc = "Bit 16 - 1: to start touch fsm by SW"]
116 #[inline(always)]
117 pub fn touch_start_force(&self) -> TOUCH_START_FORCE_R {
118 TOUCH_START_FORCE_R::new(((self.bits >> 16) & 1) != 0)
119 }
120 #[doc = "Bits 17:24 - the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD"]
121 #[inline(always)]
122 pub fn touch_xpd_wait(&self) -> TOUCH_XPD_WAIT_R {
123 TOUCH_XPD_WAIT_R::new(((self.bits >> 17) & 0xff) as u8)
124 }
125 #[doc = "Bits 25:26 - when a touch pad is active sleep cycle could be divided by this number"]
126 #[inline(always)]
127 pub fn touch_slp_cyc_div(&self) -> TOUCH_SLP_CYC_DIV_R {
128 TOUCH_SLP_CYC_DIV_R::new(((self.bits >> 25) & 3) as u8)
129 }
130 #[doc = "Bits 27:28 - force touch timer done"]
131 #[inline(always)]
132 pub fn touch_timer_force_done(&self) -> TOUCH_TIMER_FORCE_DONE_R {
133 TOUCH_TIMER_FORCE_DONE_R::new(((self.bits >> 27) & 3) as u8)
134 }
135 #[doc = "Bit 29 - reset upgrade touch"]
136 #[inline(always)]
137 pub fn touch_reset(&self) -> TOUCH_RESET_R {
138 TOUCH_RESET_R::new(((self.bits >> 29) & 1) != 0)
139 }
140 #[doc = "Bit 30 - touch clock force on"]
141 #[inline(always)]
142 pub fn touch_clk_fo(&self) -> TOUCH_CLK_FO_R {
143 TOUCH_CLK_FO_R::new(((self.bits >> 30) & 1) != 0)
144 }
145 #[doc = "Bit 31 - touch clock enable"]
146 #[inline(always)]
147 pub fn touch_clkgate_en(&self) -> TOUCH_CLKGATE_EN_R {
148 TOUCH_CLKGATE_EN_R::new(((self.bits >> 31) & 1) != 0)
149 }
150}
151#[cfg(feature = "impl-register-debug")]
152impl core::fmt::Debug for R {
153 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
154 f.debug_struct("TOUCH_CTRL2")
155 .field("touch_drange", &self.touch_drange())
156 .field("touch_drefl", &self.touch_drefl())
157 .field("touch_drefh", &self.touch_drefh())
158 .field("touch_xpd_bias", &self.touch_xpd_bias())
159 .field("touch_refc", &self.touch_refc())
160 .field("touch_dbias", &self.touch_dbias())
161 .field("touch_slp_timer_en", &self.touch_slp_timer_en())
162 .field("touch_start_fsm_en", &self.touch_start_fsm_en())
163 .field("touch_start_en", &self.touch_start_en())
164 .field("touch_start_force", &self.touch_start_force())
165 .field("touch_xpd_wait", &self.touch_xpd_wait())
166 .field("touch_slp_cyc_div", &self.touch_slp_cyc_div())
167 .field("touch_timer_force_done", &self.touch_timer_force_done())
168 .field("touch_reset", &self.touch_reset())
169 .field("touch_clk_fo", &self.touch_clk_fo())
170 .field("touch_clkgate_en", &self.touch_clkgate_en())
171 .finish()
172 }
173}
174impl W {
175 #[doc = "Bits 2:3 - TOUCH_DRANGE"]
176 #[inline(always)]
177 pub fn touch_drange(&mut self) -> TOUCH_DRANGE_W<TOUCH_CTRL2_SPEC> {
178 TOUCH_DRANGE_W::new(self, 2)
179 }
180 #[doc = "Bits 4:5 - TOUCH_DREFL"]
181 #[inline(always)]
182 pub fn touch_drefl(&mut self) -> TOUCH_DREFL_W<TOUCH_CTRL2_SPEC> {
183 TOUCH_DREFL_W::new(self, 4)
184 }
185 #[doc = "Bits 6:7 - TOUCH_DREFH"]
186 #[inline(always)]
187 pub fn touch_drefh(&mut self) -> TOUCH_DREFH_W<TOUCH_CTRL2_SPEC> {
188 TOUCH_DREFH_W::new(self, 6)
189 }
190 #[doc = "Bit 8 - TOUCH_XPD_BIAS"]
191 #[inline(always)]
192 pub fn touch_xpd_bias(&mut self) -> TOUCH_XPD_BIAS_W<TOUCH_CTRL2_SPEC> {
193 TOUCH_XPD_BIAS_W::new(self, 8)
194 }
195 #[doc = "Bits 9:11 - TOUCH pad0 reference cap"]
196 #[inline(always)]
197 pub fn touch_refc(&mut self) -> TOUCH_REFC_W<TOUCH_CTRL2_SPEC> {
198 TOUCH_REFC_W::new(self, 9)
199 }
200 #[doc = "Bit 12 - 1:use self bias 0:use bandgap bias"]
201 #[inline(always)]
202 pub fn touch_dbias(&mut self) -> TOUCH_DBIAS_W<TOUCH_CTRL2_SPEC> {
203 TOUCH_DBIAS_W::new(self, 12)
204 }
205 #[doc = "Bit 13 - touch timer enable bit"]
206 #[inline(always)]
207 pub fn touch_slp_timer_en(&mut self) -> TOUCH_SLP_TIMER_EN_W<TOUCH_CTRL2_SPEC> {
208 TOUCH_SLP_TIMER_EN_W::new(self, 13)
209 }
210 #[doc = "Bit 14 - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm"]
211 #[inline(always)]
212 pub fn touch_start_fsm_en(&mut self) -> TOUCH_START_FSM_EN_W<TOUCH_CTRL2_SPEC> {
213 TOUCH_START_FSM_EN_W::new(self, 14)
214 }
215 #[doc = "Bit 15 - 1: start touch fsm"]
216 #[inline(always)]
217 pub fn touch_start_en(&mut self) -> TOUCH_START_EN_W<TOUCH_CTRL2_SPEC> {
218 TOUCH_START_EN_W::new(self, 15)
219 }
220 #[doc = "Bit 16 - 1: to start touch fsm by SW"]
221 #[inline(always)]
222 pub fn touch_start_force(&mut self) -> TOUCH_START_FORCE_W<TOUCH_CTRL2_SPEC> {
223 TOUCH_START_FORCE_W::new(self, 16)
224 }
225 #[doc = "Bits 17:24 - the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD"]
226 #[inline(always)]
227 pub fn touch_xpd_wait(&mut self) -> TOUCH_XPD_WAIT_W<TOUCH_CTRL2_SPEC> {
228 TOUCH_XPD_WAIT_W::new(self, 17)
229 }
230 #[doc = "Bits 25:26 - when a touch pad is active sleep cycle could be divided by this number"]
231 #[inline(always)]
232 pub fn touch_slp_cyc_div(&mut self) -> TOUCH_SLP_CYC_DIV_W<TOUCH_CTRL2_SPEC> {
233 TOUCH_SLP_CYC_DIV_W::new(self, 25)
234 }
235 #[doc = "Bits 27:28 - force touch timer done"]
236 #[inline(always)]
237 pub fn touch_timer_force_done(&mut self) -> TOUCH_TIMER_FORCE_DONE_W<TOUCH_CTRL2_SPEC> {
238 TOUCH_TIMER_FORCE_DONE_W::new(self, 27)
239 }
240 #[doc = "Bit 29 - reset upgrade touch"]
241 #[inline(always)]
242 pub fn touch_reset(&mut self) -> TOUCH_RESET_W<TOUCH_CTRL2_SPEC> {
243 TOUCH_RESET_W::new(self, 29)
244 }
245 #[doc = "Bit 30 - touch clock force on"]
246 #[inline(always)]
247 pub fn touch_clk_fo(&mut self) -> TOUCH_CLK_FO_W<TOUCH_CTRL2_SPEC> {
248 TOUCH_CLK_FO_W::new(self, 30)
249 }
250 #[doc = "Bit 31 - touch clock enable"]
251 #[inline(always)]
252 pub fn touch_clkgate_en(&mut self) -> TOUCH_CLKGATE_EN_W<TOUCH_CTRL2_SPEC> {
253 TOUCH_CLKGATE_EN_W::new(self, 31)
254 }
255}
256#[doc = "configure touch controller\n\nYou can [`read`](crate::Reg::read) this register and get [`touch_ctrl2::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`touch_ctrl2::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
257pub struct TOUCH_CTRL2_SPEC;
258impl crate::RegisterSpec for TOUCH_CTRL2_SPEC {
259 type Ux = u32;
260}
261#[doc = "`read()` method returns [`touch_ctrl2::R`](R) reader structure"]
262impl crate::Readable for TOUCH_CTRL2_SPEC {}
263#[doc = "`write(|w| ..)` method takes [`touch_ctrl2::W`](W) writer structure"]
264impl crate::Writable for TOUCH_CTRL2_SPEC {
265 type Safety = crate::Unsafe;
266 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
267 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
268}
269#[doc = "`reset()` method sets TOUCH_CTRL2 to value 0x0008_40cc"]
270impl crate::Resettable for TOUCH_CTRL2_SPEC {
271 const RESET_VALUE: u32 = 0x0008_40cc;
272}