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 #[doc = "12: DAC0 channel 0."]
196 DAC0CH0 = 12,
197 #[doc = "13: DAC0 channel 1."]
198 DAC0CH1 = 13,
199}
200impl From<NEGSEL_A> for u8 {
201 #[inline(always)]
202 fn from(variant: NEGSEL_A) -> Self {
203 variant as _
204 }
205}
206#[doc = "Field `NEGSEL` reader - Negative Input Select"]
207pub type NEGSEL_R = crate::FieldReader<u8, NEGSEL_A>;
208impl NEGSEL_R {
209 #[doc = "Get enumerated values variant"]
210 #[inline(always)]
211 pub fn variant(&self) -> Option<NEGSEL_A> {
212 match self.bits {
213 0 => Some(NEGSEL_A::CH0),
214 1 => Some(NEGSEL_A::CH1),
215 2 => Some(NEGSEL_A::CH2),
216 3 => Some(NEGSEL_A::CH3),
217 4 => Some(NEGSEL_A::CH4),
218 5 => Some(NEGSEL_A::CH5),
219 6 => Some(NEGSEL_A::CH6),
220 7 => Some(NEGSEL_A::CH7),
221 8 => Some(NEGSEL_A::_1V25),
222 9 => Some(NEGSEL_A::_2V5),
223 10 => Some(NEGSEL_A::VDD),
224 11 => Some(NEGSEL_A::CAPSENSE),
225 12 => Some(NEGSEL_A::DAC0CH0),
226 13 => Some(NEGSEL_A::DAC0CH1),
227 _ => None,
228 }
229 }
230 #[doc = "Checks if the value of the field is `CH0`"]
231 #[inline(always)]
232 pub fn is_ch0(&self) -> bool {
233 *self == NEGSEL_A::CH0
234 }
235 #[doc = "Checks if the value of the field is `CH1`"]
236 #[inline(always)]
237 pub fn is_ch1(&self) -> bool {
238 *self == NEGSEL_A::CH1
239 }
240 #[doc = "Checks if the value of the field is `CH2`"]
241 #[inline(always)]
242 pub fn is_ch2(&self) -> bool {
243 *self == NEGSEL_A::CH2
244 }
245 #[doc = "Checks if the value of the field is `CH3`"]
246 #[inline(always)]
247 pub fn is_ch3(&self) -> bool {
248 *self == NEGSEL_A::CH3
249 }
250 #[doc = "Checks if the value of the field is `CH4`"]
251 #[inline(always)]
252 pub fn is_ch4(&self) -> bool {
253 *self == NEGSEL_A::CH4
254 }
255 #[doc = "Checks if the value of the field is `CH5`"]
256 #[inline(always)]
257 pub fn is_ch5(&self) -> bool {
258 *self == NEGSEL_A::CH5
259 }
260 #[doc = "Checks if the value of the field is `CH6`"]
261 #[inline(always)]
262 pub fn is_ch6(&self) -> bool {
263 *self == NEGSEL_A::CH6
264 }
265 #[doc = "Checks if the value of the field is `CH7`"]
266 #[inline(always)]
267 pub fn is_ch7(&self) -> bool {
268 *self == NEGSEL_A::CH7
269 }
270 #[doc = "Checks if the value of the field is `_1V25`"]
271 #[inline(always)]
272 pub fn is_1v25(&self) -> bool {
273 *self == NEGSEL_A::_1V25
274 }
275 #[doc = "Checks if the value of the field is `_2V5`"]
276 #[inline(always)]
277 pub fn is_2v5(&self) -> bool {
278 *self == NEGSEL_A::_2V5
279 }
280 #[doc = "Checks if the value of the field is `VDD`"]
281 #[inline(always)]
282 pub fn is_vdd(&self) -> bool {
283 *self == NEGSEL_A::VDD
284 }
285 #[doc = "Checks if the value of the field is `CAPSENSE`"]
286 #[inline(always)]
287 pub fn is_capsense(&self) -> bool {
288 *self == NEGSEL_A::CAPSENSE
289 }
290 #[doc = "Checks if the value of the field is `DAC0CH0`"]
291 #[inline(always)]
292 pub fn is_dac0ch0(&self) -> bool {
293 *self == NEGSEL_A::DAC0CH0
294 }
295 #[doc = "Checks if the value of the field is `DAC0CH1`"]
296 #[inline(always)]
297 pub fn is_dac0ch1(&self) -> bool {
298 *self == NEGSEL_A::DAC0CH1
299 }
300}
301#[doc = "Field `NEGSEL` writer - Negative Input Select"]
302pub type NEGSEL_W<'a> = crate::FieldWriter<'a, u32, INPUTSEL_SPEC, u8, NEGSEL_A, 4, 4>;
303impl<'a> NEGSEL_W<'a> {
304 #[doc = "Channel 0 as negative input."]
305 #[inline(always)]
306 pub fn ch0(self) -> &'a mut W {
307 self.variant(NEGSEL_A::CH0)
308 }
309 #[doc = "Channel 1 as negative input."]
310 #[inline(always)]
311 pub fn ch1(self) -> &'a mut W {
312 self.variant(NEGSEL_A::CH1)
313 }
314 #[doc = "Channel 2 as negative input."]
315 #[inline(always)]
316 pub fn ch2(self) -> &'a mut W {
317 self.variant(NEGSEL_A::CH2)
318 }
319 #[doc = "Channel 3 as negative input."]
320 #[inline(always)]
321 pub fn ch3(self) -> &'a mut W {
322 self.variant(NEGSEL_A::CH3)
323 }
324 #[doc = "Channel 4 as negative input."]
325 #[inline(always)]
326 pub fn ch4(self) -> &'a mut W {
327 self.variant(NEGSEL_A::CH4)
328 }
329 #[doc = "Channel 5 as negative input."]
330 #[inline(always)]
331 pub fn ch5(self) -> &'a mut W {
332 self.variant(NEGSEL_A::CH5)
333 }
334 #[doc = "Channel 6 as negative input."]
335 #[inline(always)]
336 pub fn ch6(self) -> &'a mut W {
337 self.variant(NEGSEL_A::CH6)
338 }
339 #[doc = "Channel 7 as negative input."]
340 #[inline(always)]
341 pub fn ch7(self) -> &'a mut W {
342 self.variant(NEGSEL_A::CH7)
343 }
344 #[doc = "1.25 V as negative input."]
345 #[inline(always)]
346 pub fn _1v25(self) -> &'a mut W {
347 self.variant(NEGSEL_A::_1V25)
348 }
349 #[doc = "2.5 V as negative input."]
350 #[inline(always)]
351 pub fn _2v5(self) -> &'a mut W {
352 self.variant(NEGSEL_A::_2V5)
353 }
354 #[doc = "Scaled VDD as negative input."]
355 #[inline(always)]
356 pub fn vdd(self) -> &'a mut W {
357 self.variant(NEGSEL_A::VDD)
358 }
359 #[doc = "Capacitive sense mode."]
360 #[inline(always)]
361 pub fn capsense(self) -> &'a mut W {
362 self.variant(NEGSEL_A::CAPSENSE)
363 }
364 #[doc = "DAC0 channel 0."]
365 #[inline(always)]
366 pub fn dac0ch0(self) -> &'a mut W {
367 self.variant(NEGSEL_A::DAC0CH0)
368 }
369 #[doc = "DAC0 channel 1."]
370 #[inline(always)]
371 pub fn dac0ch1(self) -> &'a mut W {
372 self.variant(NEGSEL_A::DAC0CH1)
373 }
374}
375#[doc = "Field `VDDLEVEL` reader - VDD Reference Level"]
376pub type VDDLEVEL_R = crate::FieldReader<u8, u8>;
377#[doc = "Field `VDDLEVEL` writer - VDD Reference Level"]
378pub type VDDLEVEL_W<'a> = crate::FieldWriter<'a, u32, INPUTSEL_SPEC, u8, u8, 6, 8>;
379#[doc = "Field `LPREF` reader - Low Power Reference Mode"]
380pub type LPREF_R = crate::BitReader<bool>;
381#[doc = "Field `LPREF` writer - Low Power Reference Mode"]
382pub type LPREF_W<'a> = crate::BitWriter<'a, u32, INPUTSEL_SPEC, bool, 16>;
383#[doc = "Field `CSRESEN` reader - Capacitive Sense Mode Internal Resistor Enable"]
384pub type CSRESEN_R = crate::BitReader<bool>;
385#[doc = "Field `CSRESEN` writer - Capacitive Sense Mode Internal Resistor Enable"]
386pub type CSRESEN_W<'a> = crate::BitWriter<'a, u32, INPUTSEL_SPEC, bool, 24>;
387#[doc = "Capacitive Sense Mode Internal Resistor Select\n\nValue on reset: 0"]
388#[derive(Clone, Copy, Debug, PartialEq)]
389#[repr(u8)]
390pub enum CSRESSEL_A {
391 #[doc = "0: Internal capacitive sense resistor value 0."]
392 RES0 = 0,
393 #[doc = "1: Internal capacitive sense resistor value 1."]
394 RES1 = 1,
395 #[doc = "2: Internal capacitive sense resistor value 2."]
396 RES2 = 2,
397 #[doc = "3: Internal capacitive sense resistor value 3."]
398 RES3 = 3,
399}
400impl From<CSRESSEL_A> for u8 {
401 #[inline(always)]
402 fn from(variant: CSRESSEL_A) -> Self {
403 variant as _
404 }
405}
406#[doc = "Field `CSRESSEL` reader - Capacitive Sense Mode Internal Resistor Select"]
407pub type CSRESSEL_R = crate::FieldReader<u8, CSRESSEL_A>;
408impl CSRESSEL_R {
409 #[doc = "Get enumerated values variant"]
410 #[inline(always)]
411 pub fn variant(&self) -> CSRESSEL_A {
412 match self.bits {
413 0 => CSRESSEL_A::RES0,
414 1 => CSRESSEL_A::RES1,
415 2 => CSRESSEL_A::RES2,
416 3 => CSRESSEL_A::RES3,
417 _ => unreachable!(),
418 }
419 }
420 #[doc = "Checks if the value of the field is `RES0`"]
421 #[inline(always)]
422 pub fn is_res0(&self) -> bool {
423 *self == CSRESSEL_A::RES0
424 }
425 #[doc = "Checks if the value of the field is `RES1`"]
426 #[inline(always)]
427 pub fn is_res1(&self) -> bool {
428 *self == CSRESSEL_A::RES1
429 }
430 #[doc = "Checks if the value of the field is `RES2`"]
431 #[inline(always)]
432 pub fn is_res2(&self) -> bool {
433 *self == CSRESSEL_A::RES2
434 }
435 #[doc = "Checks if the value of the field is `RES3`"]
436 #[inline(always)]
437 pub fn is_res3(&self) -> bool {
438 *self == CSRESSEL_A::RES3
439 }
440}
441#[doc = "Field `CSRESSEL` writer - Capacitive Sense Mode Internal Resistor Select"]
442pub type CSRESSEL_W<'a> = crate::FieldWriterSafe<'a, u32, INPUTSEL_SPEC, u8, CSRESSEL_A, 2, 28>;
443impl<'a> CSRESSEL_W<'a> {
444 #[doc = "Internal capacitive sense resistor value 0."]
445 #[inline(always)]
446 pub fn res0(self) -> &'a mut W {
447 self.variant(CSRESSEL_A::RES0)
448 }
449 #[doc = "Internal capacitive sense resistor value 1."]
450 #[inline(always)]
451 pub fn res1(self) -> &'a mut W {
452 self.variant(CSRESSEL_A::RES1)
453 }
454 #[doc = "Internal capacitive sense resistor value 2."]
455 #[inline(always)]
456 pub fn res2(self) -> &'a mut W {
457 self.variant(CSRESSEL_A::RES2)
458 }
459 #[doc = "Internal capacitive sense resistor value 3."]
460 #[inline(always)]
461 pub fn res3(self) -> &'a mut W {
462 self.variant(CSRESSEL_A::RES3)
463 }
464}
465impl R {
466 #[doc = "Bits 0:2 - Positive Input Select"]
467 #[inline(always)]
468 pub fn possel(&self) -> POSSEL_R {
469 POSSEL_R::new((self.bits & 7) as u8)
470 }
471 #[doc = "Bits 4:7 - Negative Input Select"]
472 #[inline(always)]
473 pub fn negsel(&self) -> NEGSEL_R {
474 NEGSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
475 }
476 #[doc = "Bits 8:13 - VDD Reference Level"]
477 #[inline(always)]
478 pub fn vddlevel(&self) -> VDDLEVEL_R {
479 VDDLEVEL_R::new(((self.bits >> 8) & 0x3f) as u8)
480 }
481 #[doc = "Bit 16 - Low Power Reference Mode"]
482 #[inline(always)]
483 pub fn lpref(&self) -> LPREF_R {
484 LPREF_R::new(((self.bits >> 16) & 1) != 0)
485 }
486 #[doc = "Bit 24 - Capacitive Sense Mode Internal Resistor Enable"]
487 #[inline(always)]
488 pub fn csresen(&self) -> CSRESEN_R {
489 CSRESEN_R::new(((self.bits >> 24) & 1) != 0)
490 }
491 #[doc = "Bits 28:29 - Capacitive Sense Mode Internal Resistor Select"]
492 #[inline(always)]
493 pub fn csressel(&self) -> CSRESSEL_R {
494 CSRESSEL_R::new(((self.bits >> 28) & 3) as u8)
495 }
496}
497impl W {
498 #[doc = "Bits 0:2 - Positive Input Select"]
499 #[inline(always)]
500 pub fn possel(&mut self) -> POSSEL_W {
501 POSSEL_W::new(self)
502 }
503 #[doc = "Bits 4:7 - Negative Input Select"]
504 #[inline(always)]
505 pub fn negsel(&mut self) -> NEGSEL_W {
506 NEGSEL_W::new(self)
507 }
508 #[doc = "Bits 8:13 - VDD Reference Level"]
509 #[inline(always)]
510 pub fn vddlevel(&mut self) -> VDDLEVEL_W {
511 VDDLEVEL_W::new(self)
512 }
513 #[doc = "Bit 16 - Low Power Reference Mode"]
514 #[inline(always)]
515 pub fn lpref(&mut self) -> LPREF_W {
516 LPREF_W::new(self)
517 }
518 #[doc = "Bit 24 - Capacitive Sense Mode Internal Resistor Enable"]
519 #[inline(always)]
520 pub fn csresen(&mut self) -> CSRESEN_W {
521 CSRESEN_W::new(self)
522 }
523 #[doc = "Bits 28:29 - Capacitive Sense Mode Internal Resistor Select"]
524 #[inline(always)]
525 pub fn csressel(&mut self) -> CSRESSEL_W {
526 CSRESSEL_W::new(self)
527 }
528 #[doc = "Writes raw bits to the register."]
529 #[inline(always)]
530 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
531 self.0.bits(bits);
532 self
533 }
534}
535#[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"]
536pub struct INPUTSEL_SPEC;
537impl crate::RegisterSpec for INPUTSEL_SPEC {
538 type Ux = u32;
539}
540#[doc = "`read()` method returns [inputsel::R](R) reader structure"]
541impl crate::Readable for INPUTSEL_SPEC {
542 type Reader = R;
543}
544#[doc = "`write(|w| ..)` method takes [inputsel::W](W) writer structure"]
545impl crate::Writable for INPUTSEL_SPEC {
546 type Writer = W;
547}
548#[doc = "`reset()` method sets INPUTSEL to value 0x0001_0080"]
549impl crate::Resettable for INPUTSEL_SPEC {
550 #[inline(always)]
551 fn reset_value() -> Self::Ux {
552 0x0001_0080
553 }
554}