1#[doc = "Register `INPUTSEL` reader"]
2pub struct R(crate::R<INPUTSEL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<INPUTSEL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<INPUTSEL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<INPUTSEL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `INPUTSEL` writer"]
17pub struct W(crate::W<INPUTSEL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<INPUTSEL_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<INPUTSEL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<INPUTSEL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Positive Input Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum POSSEL_A {
41 #[doc = "0: Channel 0 as positive input."]
42 CH0 = 0,
43 #[doc = "1: Channel 1 as positive input."]
44 CH1 = 1,
45 #[doc = "2: Channel 2 as positive input."]
46 CH2 = 2,
47 #[doc = "3: Channel 3 as positive input."]
48 CH3 = 3,
49 #[doc = "4: Channel 4 as positive input."]
50 CH4 = 4,
51 #[doc = "5: Channel 5 as positive input."]
52 CH5 = 5,
53 #[doc = "6: Channel 6 as positive input."]
54 CH6 = 6,
55 #[doc = "7: Channel 7 as positive input."]
56 CH7 = 7,
57}
58impl From<POSSEL_A> for u8 {
59 #[inline(always)]
60 fn from(variant: POSSEL_A) -> Self {
61 variant as _
62 }
63}
64#[doc = "Field `POSSEL` reader - Positive Input Select"]
65pub type POSSEL_R = crate::FieldReader<u8, POSSEL_A>;
66impl POSSEL_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> POSSEL_A {
70 match self.bits {
71 0 => POSSEL_A::CH0,
72 1 => POSSEL_A::CH1,
73 2 => POSSEL_A::CH2,
74 3 => POSSEL_A::CH3,
75 4 => POSSEL_A::CH4,
76 5 => POSSEL_A::CH5,
77 6 => POSSEL_A::CH6,
78 7 => POSSEL_A::CH7,
79 _ => unreachable!(),
80 }
81 }
82 #[doc = "Checks if the value of the field is `CH0`"]
83 #[inline(always)]
84 pub fn is_ch0(&self) -> bool {
85 *self == POSSEL_A::CH0
86 }
87 #[doc = "Checks if the value of the field is `CH1`"]
88 #[inline(always)]
89 pub fn is_ch1(&self) -> bool {
90 *self == POSSEL_A::CH1
91 }
92 #[doc = "Checks if the value of the field is `CH2`"]
93 #[inline(always)]
94 pub fn is_ch2(&self) -> bool {
95 *self == POSSEL_A::CH2
96 }
97 #[doc = "Checks if the value of the field is `CH3`"]
98 #[inline(always)]
99 pub fn is_ch3(&self) -> bool {
100 *self == POSSEL_A::CH3
101 }
102 #[doc = "Checks if the value of the field is `CH4`"]
103 #[inline(always)]
104 pub fn is_ch4(&self) -> bool {
105 *self == POSSEL_A::CH4
106 }
107 #[doc = "Checks if the value of the field is `CH5`"]
108 #[inline(always)]
109 pub fn is_ch5(&self) -> bool {
110 *self == POSSEL_A::CH5
111 }
112 #[doc = "Checks if the value of the field is `CH6`"]
113 #[inline(always)]
114 pub fn is_ch6(&self) -> bool {
115 *self == POSSEL_A::CH6
116 }
117 #[doc = "Checks if the value of the field is `CH7`"]
118 #[inline(always)]
119 pub fn is_ch7(&self) -> bool {
120 *self == POSSEL_A::CH7
121 }
122}
123#[doc = "Field `POSSEL` writer - Positive Input Select"]
124pub type POSSEL_W<'a> = crate::FieldWriterSafe<'a, u32, INPUTSEL_SPEC, u8, POSSEL_A, 3, 0>;
125impl<'a> POSSEL_W<'a> {
126 #[doc = "Channel 0 as positive input."]
127 #[inline(always)]
128 pub fn ch0(self) -> &'a mut W {
129 self.variant(POSSEL_A::CH0)
130 }
131 #[doc = "Channel 1 as positive input."]
132 #[inline(always)]
133 pub fn ch1(self) -> &'a mut W {
134 self.variant(POSSEL_A::CH1)
135 }
136 #[doc = "Channel 2 as positive input."]
137 #[inline(always)]
138 pub fn ch2(self) -> &'a mut W {
139 self.variant(POSSEL_A::CH2)
140 }
141 #[doc = "Channel 3 as positive input."]
142 #[inline(always)]
143 pub fn ch3(self) -> &'a mut W {
144 self.variant(POSSEL_A::CH3)
145 }
146 #[doc = "Channel 4 as positive input."]
147 #[inline(always)]
148 pub fn ch4(self) -> &'a mut W {
149 self.variant(POSSEL_A::CH4)
150 }
151 #[doc = "Channel 5 as positive input."]
152 #[inline(always)]
153 pub fn ch5(self) -> &'a mut W {
154 self.variant(POSSEL_A::CH5)
155 }
156 #[doc = "Channel 6 as positive input."]
157 #[inline(always)]
158 pub fn ch6(self) -> &'a mut W {
159 self.variant(POSSEL_A::CH6)
160 }
161 #[doc = "Channel 7 as positive input."]
162 #[inline(always)]
163 pub fn ch7(self) -> &'a mut W {
164 self.variant(POSSEL_A::CH7)
165 }
166}
167#[doc = "Negative Input Select\n\nValue on reset: 8"]
168#[derive(Clone, Copy, Debug, PartialEq)]
169#[repr(u8)]
170pub enum NEGSEL_A {
171 #[doc = "0: Channel 0 as negative input."]
172 CH0 = 0,
173 #[doc = "1: Channel 1 as negative input."]
174 CH1 = 1,
175 #[doc = "2: Channel 2 as negative input."]
176 CH2 = 2,
177 #[doc = "3: Channel 3 as negative input."]
178 CH3 = 3,
179 #[doc = "4: Channel 4 as negative input."]
180 CH4 = 4,
181 #[doc = "5: Channel 5 as negative input."]
182 CH5 = 5,
183 #[doc = "6: Channel 6 as negative input."]
184 CH6 = 6,
185 #[doc = "7: Channel 7 as negative input."]
186 CH7 = 7,
187 #[doc = "8: 1.25 V as negative input."]
188 _1V25 = 8,
189 #[doc = "9: 2.5 V as negative input."]
190 _2V5 = 9,
191 #[doc = "10: Scaled VDD as negative input."]
192 VDD = 10,
193 #[doc = "11: Capacitive sense mode."]
194 CAPSENSE = 11,
195}
196impl From<NEGSEL_A> for u8 {
197 #[inline(always)]
198 fn from(variant: NEGSEL_A) -> Self {
199 variant as _
200 }
201}
202#[doc = "Field `NEGSEL` reader - Negative Input Select"]
203pub type NEGSEL_R = crate::FieldReader<u8, NEGSEL_A>;
204impl NEGSEL_R {
205 #[doc = "Get enumerated values variant"]
206 #[inline(always)]
207 pub fn variant(&self) -> Option<NEGSEL_A> {
208 match self.bits {
209 0 => Some(NEGSEL_A::CH0),
210 1 => Some(NEGSEL_A::CH1),
211 2 => Some(NEGSEL_A::CH2),
212 3 => Some(NEGSEL_A::CH3),
213 4 => Some(NEGSEL_A::CH4),
214 5 => Some(NEGSEL_A::CH5),
215 6 => Some(NEGSEL_A::CH6),
216 7 => Some(NEGSEL_A::CH7),
217 8 => Some(NEGSEL_A::_1V25),
218 9 => Some(NEGSEL_A::_2V5),
219 10 => Some(NEGSEL_A::VDD),
220 11 => Some(NEGSEL_A::CAPSENSE),
221 _ => None,
222 }
223 }
224 #[doc = "Checks if the value of the field is `CH0`"]
225 #[inline(always)]
226 pub fn is_ch0(&self) -> bool {
227 *self == NEGSEL_A::CH0
228 }
229 #[doc = "Checks if the value of the field is `CH1`"]
230 #[inline(always)]
231 pub fn is_ch1(&self) -> bool {
232 *self == NEGSEL_A::CH1
233 }
234 #[doc = "Checks if the value of the field is `CH2`"]
235 #[inline(always)]
236 pub fn is_ch2(&self) -> bool {
237 *self == NEGSEL_A::CH2
238 }
239 #[doc = "Checks if the value of the field is `CH3`"]
240 #[inline(always)]
241 pub fn is_ch3(&self) -> bool {
242 *self == NEGSEL_A::CH3
243 }
244 #[doc = "Checks if the value of the field is `CH4`"]
245 #[inline(always)]
246 pub fn is_ch4(&self) -> bool {
247 *self == NEGSEL_A::CH4
248 }
249 #[doc = "Checks if the value of the field is `CH5`"]
250 #[inline(always)]
251 pub fn is_ch5(&self) -> bool {
252 *self == NEGSEL_A::CH5
253 }
254 #[doc = "Checks if the value of the field is `CH6`"]
255 #[inline(always)]
256 pub fn is_ch6(&self) -> bool {
257 *self == NEGSEL_A::CH6
258 }
259 #[doc = "Checks if the value of the field is `CH7`"]
260 #[inline(always)]
261 pub fn is_ch7(&self) -> bool {
262 *self == NEGSEL_A::CH7
263 }
264 #[doc = "Checks if the value of the field is `_1V25`"]
265 #[inline(always)]
266 pub fn is_1v25(&self) -> bool {
267 *self == NEGSEL_A::_1V25
268 }
269 #[doc = "Checks if the value of the field is `_2V5`"]
270 #[inline(always)]
271 pub fn is_2v5(&self) -> bool {
272 *self == NEGSEL_A::_2V5
273 }
274 #[doc = "Checks if the value of the field is `VDD`"]
275 #[inline(always)]
276 pub fn is_vdd(&self) -> bool {
277 *self == NEGSEL_A::VDD
278 }
279 #[doc = "Checks if the value of the field is `CAPSENSE`"]
280 #[inline(always)]
281 pub fn is_capsense(&self) -> bool {
282 *self == NEGSEL_A::CAPSENSE
283 }
284}
285#[doc = "Field `NEGSEL` writer - Negative Input Select"]
286pub type NEGSEL_W<'a> = crate::FieldWriter<'a, u32, INPUTSEL_SPEC, u8, NEGSEL_A, 4, 4>;
287impl<'a> NEGSEL_W<'a> {
288 #[doc = "Channel 0 as negative input."]
289 #[inline(always)]
290 pub fn ch0(self) -> &'a mut W {
291 self.variant(NEGSEL_A::CH0)
292 }
293 #[doc = "Channel 1 as negative input."]
294 #[inline(always)]
295 pub fn ch1(self) -> &'a mut W {
296 self.variant(NEGSEL_A::CH1)
297 }
298 #[doc = "Channel 2 as negative input."]
299 #[inline(always)]
300 pub fn ch2(self) -> &'a mut W {
301 self.variant(NEGSEL_A::CH2)
302 }
303 #[doc = "Channel 3 as negative input."]
304 #[inline(always)]
305 pub fn ch3(self) -> &'a mut W {
306 self.variant(NEGSEL_A::CH3)
307 }
308 #[doc = "Channel 4 as negative input."]
309 #[inline(always)]
310 pub fn ch4(self) -> &'a mut W {
311 self.variant(NEGSEL_A::CH4)
312 }
313 #[doc = "Channel 5 as negative input."]
314 #[inline(always)]
315 pub fn ch5(self) -> &'a mut W {
316 self.variant(NEGSEL_A::CH5)
317 }
318 #[doc = "Channel 6 as negative input."]
319 #[inline(always)]
320 pub fn ch6(self) -> &'a mut W {
321 self.variant(NEGSEL_A::CH6)
322 }
323 #[doc = "Channel 7 as negative input."]
324 #[inline(always)]
325 pub fn ch7(self) -> &'a mut W {
326 self.variant(NEGSEL_A::CH7)
327 }
328 #[doc = "1.25 V as negative input."]
329 #[inline(always)]
330 pub fn _1v25(self) -> &'a mut W {
331 self.variant(NEGSEL_A::_1V25)
332 }
333 #[doc = "2.5 V as negative input."]
334 #[inline(always)]
335 pub fn _2v5(self) -> &'a mut W {
336 self.variant(NEGSEL_A::_2V5)
337 }
338 #[doc = "Scaled VDD as negative input."]
339 #[inline(always)]
340 pub fn vdd(self) -> &'a mut W {
341 self.variant(NEGSEL_A::VDD)
342 }
343 #[doc = "Capacitive sense mode."]
344 #[inline(always)]
345 pub fn capsense(self) -> &'a mut W {
346 self.variant(NEGSEL_A::CAPSENSE)
347 }
348}
349#[doc = "Field `VDDLEVEL` reader - VDD Reference Level"]
350pub type VDDLEVEL_R = crate::FieldReader<u8, u8>;
351#[doc = "Field `VDDLEVEL` writer - VDD Reference Level"]
352pub type VDDLEVEL_W<'a> = crate::FieldWriter<'a, u32, INPUTSEL_SPEC, u8, u8, 6, 8>;
353#[doc = "Field `LPREF` reader - Low Power Reference Mode"]
354pub type LPREF_R = crate::BitReader<bool>;
355#[doc = "Field `LPREF` writer - Low Power Reference Mode"]
356pub type LPREF_W<'a> = crate::BitWriter<'a, u32, INPUTSEL_SPEC, bool, 16>;
357#[doc = "Field `CSRESEN` reader - Capacitive Sense Mode Internal Resistor Enable"]
358pub type CSRESEN_R = crate::BitReader<bool>;
359#[doc = "Field `CSRESEN` writer - Capacitive Sense Mode Internal Resistor Enable"]
360pub type CSRESEN_W<'a> = crate::BitWriter<'a, u32, INPUTSEL_SPEC, bool, 24>;
361#[doc = "Capacitive Sense Mode Internal Resistor Select\n\nValue on reset: 0"]
362#[derive(Clone, Copy, Debug, PartialEq)]
363#[repr(u8)]
364pub enum CSRESSEL_A {
365 #[doc = "0: Internal capacitive sense resistor value 0."]
366 RES0 = 0,
367 #[doc = "1: Internal capacitive sense resistor value 1."]
368 RES1 = 1,
369 #[doc = "2: Internal capacitive sense resistor value 2."]
370 RES2 = 2,
371 #[doc = "3: Internal capacitive sense resistor value 3."]
372 RES3 = 3,
373}
374impl From<CSRESSEL_A> for u8 {
375 #[inline(always)]
376 fn from(variant: CSRESSEL_A) -> Self {
377 variant as _
378 }
379}
380#[doc = "Field `CSRESSEL` reader - Capacitive Sense Mode Internal Resistor Select"]
381pub type CSRESSEL_R = crate::FieldReader<u8, CSRESSEL_A>;
382impl CSRESSEL_R {
383 #[doc = "Get enumerated values variant"]
384 #[inline(always)]
385 pub fn variant(&self) -> CSRESSEL_A {
386 match self.bits {
387 0 => CSRESSEL_A::RES0,
388 1 => CSRESSEL_A::RES1,
389 2 => CSRESSEL_A::RES2,
390 3 => CSRESSEL_A::RES3,
391 _ => unreachable!(),
392 }
393 }
394 #[doc = "Checks if the value of the field is `RES0`"]
395 #[inline(always)]
396 pub fn is_res0(&self) -> bool {
397 *self == CSRESSEL_A::RES0
398 }
399 #[doc = "Checks if the value of the field is `RES1`"]
400 #[inline(always)]
401 pub fn is_res1(&self) -> bool {
402 *self == CSRESSEL_A::RES1
403 }
404 #[doc = "Checks if the value of the field is `RES2`"]
405 #[inline(always)]
406 pub fn is_res2(&self) -> bool {
407 *self == CSRESSEL_A::RES2
408 }
409 #[doc = "Checks if the value of the field is `RES3`"]
410 #[inline(always)]
411 pub fn is_res3(&self) -> bool {
412 *self == CSRESSEL_A::RES3
413 }
414}
415#[doc = "Field `CSRESSEL` writer - Capacitive Sense Mode Internal Resistor Select"]
416pub type CSRESSEL_W<'a> = crate::FieldWriterSafe<'a, u32, INPUTSEL_SPEC, u8, CSRESSEL_A, 2, 28>;
417impl<'a> CSRESSEL_W<'a> {
418 #[doc = "Internal capacitive sense resistor value 0."]
419 #[inline(always)]
420 pub fn res0(self) -> &'a mut W {
421 self.variant(CSRESSEL_A::RES0)
422 }
423 #[doc = "Internal capacitive sense resistor value 1."]
424 #[inline(always)]
425 pub fn res1(self) -> &'a mut W {
426 self.variant(CSRESSEL_A::RES1)
427 }
428 #[doc = "Internal capacitive sense resistor value 2."]
429 #[inline(always)]
430 pub fn res2(self) -> &'a mut W {
431 self.variant(CSRESSEL_A::RES2)
432 }
433 #[doc = "Internal capacitive sense resistor value 3."]
434 #[inline(always)]
435 pub fn res3(self) -> &'a mut W {
436 self.variant(CSRESSEL_A::RES3)
437 }
438}
439impl R {
440 #[doc = "Bits 0:2 - Positive Input Select"]
441 #[inline(always)]
442 pub fn possel(&self) -> POSSEL_R {
443 POSSEL_R::new((self.bits & 7) as u8)
444 }
445 #[doc = "Bits 4:7 - Negative Input Select"]
446 #[inline(always)]
447 pub fn negsel(&self) -> NEGSEL_R {
448 NEGSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
449 }
450 #[doc = "Bits 8:13 - VDD Reference Level"]
451 #[inline(always)]
452 pub fn vddlevel(&self) -> VDDLEVEL_R {
453 VDDLEVEL_R::new(((self.bits >> 8) & 0x3f) as u8)
454 }
455 #[doc = "Bit 16 - Low Power Reference Mode"]
456 #[inline(always)]
457 pub fn lpref(&self) -> LPREF_R {
458 LPREF_R::new(((self.bits >> 16) & 1) != 0)
459 }
460 #[doc = "Bit 24 - Capacitive Sense Mode Internal Resistor Enable"]
461 #[inline(always)]
462 pub fn csresen(&self) -> CSRESEN_R {
463 CSRESEN_R::new(((self.bits >> 24) & 1) != 0)
464 }
465 #[doc = "Bits 28:29 - Capacitive Sense Mode Internal Resistor Select"]
466 #[inline(always)]
467 pub fn csressel(&self) -> CSRESSEL_R {
468 CSRESSEL_R::new(((self.bits >> 28) & 3) as u8)
469 }
470}
471impl W {
472 #[doc = "Bits 0:2 - Positive Input Select"]
473 #[inline(always)]
474 pub fn possel(&mut self) -> POSSEL_W {
475 POSSEL_W::new(self)
476 }
477 #[doc = "Bits 4:7 - Negative Input Select"]
478 #[inline(always)]
479 pub fn negsel(&mut self) -> NEGSEL_W {
480 NEGSEL_W::new(self)
481 }
482 #[doc = "Bits 8:13 - VDD Reference Level"]
483 #[inline(always)]
484 pub fn vddlevel(&mut self) -> VDDLEVEL_W {
485 VDDLEVEL_W::new(self)
486 }
487 #[doc = "Bit 16 - Low Power Reference Mode"]
488 #[inline(always)]
489 pub fn lpref(&mut self) -> LPREF_W {
490 LPREF_W::new(self)
491 }
492 #[doc = "Bit 24 - Capacitive Sense Mode Internal Resistor Enable"]
493 #[inline(always)]
494 pub fn csresen(&mut self) -> CSRESEN_W {
495 CSRESEN_W::new(self)
496 }
497 #[doc = "Bits 28:29 - Capacitive Sense Mode Internal Resistor Select"]
498 #[inline(always)]
499 pub fn csressel(&mut self) -> CSRESSEL_W {
500 CSRESSEL_W::new(self)
501 }
502 #[doc = "Writes raw bits to the register."]
503 #[inline(always)]
504 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
505 self.0.bits(bits);
506 self
507 }
508}
509#[doc = "Input Selection Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [inputsel](index.html) module"]
510pub struct INPUTSEL_SPEC;
511impl crate::RegisterSpec for INPUTSEL_SPEC {
512 type Ux = u32;
513}
514#[doc = "`read()` method returns [inputsel::R](R) reader structure"]
515impl crate::Readable for INPUTSEL_SPEC {
516 type Reader = R;
517}
518#[doc = "`write(|w| ..)` method takes [inputsel::W](W) writer structure"]
519impl crate::Writable for INPUTSEL_SPEC {
520 type Writer = W;
521}
522#[doc = "`reset()` method sets INPUTSEL to value 0x0001_0080"]
523impl crate::Resettable for INPUTSEL_SPEC {
524 #[inline(always)]
525 fn reset_value() -> Self::Ux {
526 0x0001_0080
527 }
528}