1#[doc = "Register `CMPSEL0` reader"]
2pub struct R(crate::R<CMPSEL0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CMPSEL0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CMPSEL0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CMPSEL0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CMPSEL0` writer"]
17pub struct W(crate::W<CMPSEL0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CMPSEL0_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<CMPSEL0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CMPSEL0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CMPSEL` reader - Comparator input selection"]
38pub type CMPSEL_R = crate::FieldReader<u8, CMPSEL_A>;
39#[doc = "Comparator input selection\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CMPSEL_A {
43 #[doc = "0: No input"]
44 _0000 = 0,
45 #[doc = "1: IVCMP0 selected"]
46 _0001 = 1,
47 #[doc = "2: IVCMP1 selected"]
48 _0010 = 2,
49 #[doc = "4: IVCMP2 selected"]
50 _0100 = 4,
51 #[doc = "8: IVCMP3 selected"]
52 _1000 = 8,
53}
54impl From<CMPSEL_A> for u8 {
55 #[inline(always)]
56 fn from(variant: CMPSEL_A) -> Self {
57 variant as _
58 }
59}
60impl CMPSEL_R {
61 #[doc = "Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> Option<CMPSEL_A> {
64 match self.bits {
65 0 => Some(CMPSEL_A::_0000),
66 1 => Some(CMPSEL_A::_0001),
67 2 => Some(CMPSEL_A::_0010),
68 4 => Some(CMPSEL_A::_0100),
69 8 => Some(CMPSEL_A::_1000),
70 _ => None,
71 }
72 }
73 #[doc = "Checks if the value of the field is `_0000`"]
74 #[inline(always)]
75 pub fn is_0000(&self) -> bool {
76 *self == CMPSEL_A::_0000
77 }
78 #[doc = "Checks if the value of the field is `_0001`"]
79 #[inline(always)]
80 pub fn is_0001(&self) -> bool {
81 *self == CMPSEL_A::_0001
82 }
83 #[doc = "Checks if the value of the field is `_0010`"]
84 #[inline(always)]
85 pub fn is_0010(&self) -> bool {
86 *self == CMPSEL_A::_0010
87 }
88 #[doc = "Checks if the value of the field is `_0100`"]
89 #[inline(always)]
90 pub fn is_0100(&self) -> bool {
91 *self == CMPSEL_A::_0100
92 }
93 #[doc = "Checks if the value of the field is `_1000`"]
94 #[inline(always)]
95 pub fn is_1000(&self) -> bool {
96 *self == CMPSEL_A::_1000
97 }
98}
99#[doc = "Field `CMPSEL` writer - Comparator input selection"]
100pub type CMPSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u8, CMPSEL0_SPEC, u8, CMPSEL_A, 4, O>;
101impl<'a, const O: u8> CMPSEL_W<'a, O> {
102 #[doc = "No input"]
103 #[inline(always)]
104 pub fn _0000(self) -> &'a mut W {
105 self.variant(CMPSEL_A::_0000)
106 }
107 #[doc = "IVCMP0 selected"]
108 #[inline(always)]
109 pub fn _0001(self) -> &'a mut W {
110 self.variant(CMPSEL_A::_0001)
111 }
112 #[doc = "IVCMP1 selected"]
113 #[inline(always)]
114 pub fn _0010(self) -> &'a mut W {
115 self.variant(CMPSEL_A::_0010)
116 }
117 #[doc = "IVCMP2 selected"]
118 #[inline(always)]
119 pub fn _0100(self) -> &'a mut W {
120 self.variant(CMPSEL_A::_0100)
121 }
122 #[doc = "IVCMP3 selected"]
123 #[inline(always)]
124 pub fn _1000(self) -> &'a mut W {
125 self.variant(CMPSEL_A::_1000)
126 }
127}
128impl R {
129 #[doc = "Bits 0:3 - Comparator input selection"]
130 #[inline(always)]
131 pub fn cmpsel(&self) -> CMPSEL_R {
132 CMPSEL_R::new(self.bits & 0x0f)
133 }
134}
135impl W {
136 #[doc = "Bits 0:3 - Comparator input selection"]
137 #[inline(always)]
138 #[must_use]
139 pub fn cmpsel(&mut self) -> CMPSEL_W<0> {
140 CMPSEL_W::new(self)
141 }
142 #[doc = "Writes raw bits to the register."]
143 #[inline(always)]
144 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
145 self.0.bits(bits);
146 self
147 }
148}
149#[doc = "Comparator Input Select 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 [cmpsel0](index.html) module"]
150pub struct CMPSEL0_SPEC;
151impl crate::RegisterSpec for CMPSEL0_SPEC {
152 type Ux = u8;
153}
154#[doc = "`read()` method returns [cmpsel0::R](R) reader structure"]
155impl crate::Readable for CMPSEL0_SPEC {
156 type Reader = R;
157}
158#[doc = "`write(|w| ..)` method takes [cmpsel0::W](W) writer structure"]
159impl crate::Writable for CMPSEL0_SPEC {
160 type Writer = W;
161 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
162 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
163}
164#[doc = "`reset()` method sets CMPSEL0 to value 0"]
165impl crate::Resettable for CMPSEL0_SPEC {
166 const RESET_VALUE: Self::Ux = 0;
167}