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