efm32gg12b430_pac/acmp2/
extifctrl.rs

1#[doc = "Register `EXTIFCTRL` reader"]
2pub struct R(crate::R<EXTIFCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EXTIFCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EXTIFCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EXTIFCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EXTIFCTRL` writer"]
17pub struct W(crate::W<EXTIFCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EXTIFCTRL_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<EXTIFCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EXTIFCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EN` reader - Enable External Interface"]
38pub type EN_R = crate::BitReader<bool>;
39#[doc = "Field `EN` writer - Enable External Interface"]
40pub type EN_W<'a> = crate::BitWriter<'a, u32, EXTIFCTRL_SPEC, bool, 0>;
41#[doc = "APORT Selection for External Interface\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum APORTSEL_A {
45    #[doc = "0: APORT0X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0XCH0."]
46    APORT0X = 0,
47    #[doc = "1: APORT0Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0YCH0."]
48    APORT0Y = 1,
49    #[doc = "2: APORT1X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
50    APORT1X = 2,
51    #[doc = "3: APORT1Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
52    APORT1Y = 3,
53    #[doc = "4: APORT1X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
54    APORT1XY = 4,
55    #[doc = "5: APORT2X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
56    APORT2X = 5,
57    #[doc = "6: APORT2Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
58    APORT2Y = 6,
59    #[doc = "7: APORT2Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
60    APORT2YX = 7,
61    #[doc = "8: APORT3X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
62    APORT3X = 8,
63    #[doc = "9: APORT3Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
64    APORT3Y = 9,
65    #[doc = "10: APORT3X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
66    APORT3XY = 10,
67    #[doc = "11: APORT4X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
68    APORT4X = 11,
69    #[doc = "12: APORT4Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
70    APORT4Y = 12,
71    #[doc = "13: APORT4Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
72    APORT4YX = 13,
73}
74impl From<APORTSEL_A> for u8 {
75    #[inline(always)]
76    fn from(variant: APORTSEL_A) -> Self {
77        variant as _
78    }
79}
80#[doc = "Field `APORTSEL` reader - APORT Selection for External Interface"]
81pub type APORTSEL_R = crate::FieldReader<u8, APORTSEL_A>;
82impl APORTSEL_R {
83    #[doc = "Get enumerated values variant"]
84    #[inline(always)]
85    pub fn variant(&self) -> Option<APORTSEL_A> {
86        match self.bits {
87            0 => Some(APORTSEL_A::APORT0X),
88            1 => Some(APORTSEL_A::APORT0Y),
89            2 => Some(APORTSEL_A::APORT1X),
90            3 => Some(APORTSEL_A::APORT1Y),
91            4 => Some(APORTSEL_A::APORT1XY),
92            5 => Some(APORTSEL_A::APORT2X),
93            6 => Some(APORTSEL_A::APORT2Y),
94            7 => Some(APORTSEL_A::APORT2YX),
95            8 => Some(APORTSEL_A::APORT3X),
96            9 => Some(APORTSEL_A::APORT3Y),
97            10 => Some(APORTSEL_A::APORT3XY),
98            11 => Some(APORTSEL_A::APORT4X),
99            12 => Some(APORTSEL_A::APORT4Y),
100            13 => Some(APORTSEL_A::APORT4YX),
101            _ => None,
102        }
103    }
104    #[doc = "Checks if the value of the field is `APORT0X`"]
105    #[inline(always)]
106    pub fn is_aport0x(&self) -> bool {
107        *self == APORTSEL_A::APORT0X
108    }
109    #[doc = "Checks if the value of the field is `APORT0Y`"]
110    #[inline(always)]
111    pub fn is_aport0y(&self) -> bool {
112        *self == APORTSEL_A::APORT0Y
113    }
114    #[doc = "Checks if the value of the field is `APORT1X`"]
115    #[inline(always)]
116    pub fn is_aport1x(&self) -> bool {
117        *self == APORTSEL_A::APORT1X
118    }
119    #[doc = "Checks if the value of the field is `APORT1Y`"]
120    #[inline(always)]
121    pub fn is_aport1y(&self) -> bool {
122        *self == APORTSEL_A::APORT1Y
123    }
124    #[doc = "Checks if the value of the field is `APORT1XY`"]
125    #[inline(always)]
126    pub fn is_aport1xy(&self) -> bool {
127        *self == APORTSEL_A::APORT1XY
128    }
129    #[doc = "Checks if the value of the field is `APORT2X`"]
130    #[inline(always)]
131    pub fn is_aport2x(&self) -> bool {
132        *self == APORTSEL_A::APORT2X
133    }
134    #[doc = "Checks if the value of the field is `APORT2Y`"]
135    #[inline(always)]
136    pub fn is_aport2y(&self) -> bool {
137        *self == APORTSEL_A::APORT2Y
138    }
139    #[doc = "Checks if the value of the field is `APORT2YX`"]
140    #[inline(always)]
141    pub fn is_aport2yx(&self) -> bool {
142        *self == APORTSEL_A::APORT2YX
143    }
144    #[doc = "Checks if the value of the field is `APORT3X`"]
145    #[inline(always)]
146    pub fn is_aport3x(&self) -> bool {
147        *self == APORTSEL_A::APORT3X
148    }
149    #[doc = "Checks if the value of the field is `APORT3Y`"]
150    #[inline(always)]
151    pub fn is_aport3y(&self) -> bool {
152        *self == APORTSEL_A::APORT3Y
153    }
154    #[doc = "Checks if the value of the field is `APORT3XY`"]
155    #[inline(always)]
156    pub fn is_aport3xy(&self) -> bool {
157        *self == APORTSEL_A::APORT3XY
158    }
159    #[doc = "Checks if the value of the field is `APORT4X`"]
160    #[inline(always)]
161    pub fn is_aport4x(&self) -> bool {
162        *self == APORTSEL_A::APORT4X
163    }
164    #[doc = "Checks if the value of the field is `APORT4Y`"]
165    #[inline(always)]
166    pub fn is_aport4y(&self) -> bool {
167        *self == APORTSEL_A::APORT4Y
168    }
169    #[doc = "Checks if the value of the field is `APORT4YX`"]
170    #[inline(always)]
171    pub fn is_aport4yx(&self) -> bool {
172        *self == APORTSEL_A::APORT4YX
173    }
174}
175#[doc = "Field `APORTSEL` writer - APORT Selection for External Interface"]
176pub type APORTSEL_W<'a> = crate::FieldWriter<'a, u32, EXTIFCTRL_SPEC, u8, APORTSEL_A, 4, 4>;
177impl<'a> APORTSEL_W<'a> {
178    #[doc = "APORT0X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0XCH0."]
179    #[inline(always)]
180    pub fn aport0x(self) -> &'a mut W {
181        self.variant(APORTSEL_A::APORT0X)
182    }
183    #[doc = "APORT0Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0YCH0."]
184    #[inline(always)]
185    pub fn aport0y(self) -> &'a mut W {
186        self.variant(APORTSEL_A::APORT0Y)
187    }
188    #[doc = "APORT1X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
189    #[inline(always)]
190    pub fn aport1x(self) -> &'a mut W {
191        self.variant(APORTSEL_A::APORT1X)
192    }
193    #[doc = "APORT1Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
194    #[inline(always)]
195    pub fn aport1y(self) -> &'a mut W {
196        self.variant(APORTSEL_A::APORT1Y)
197    }
198    #[doc = "APORT1X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
199    #[inline(always)]
200    pub fn aport1xy(self) -> &'a mut W {
201        self.variant(APORTSEL_A::APORT1XY)
202    }
203    #[doc = "APORT2X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
204    #[inline(always)]
205    pub fn aport2x(self) -> &'a mut W {
206        self.variant(APORTSEL_A::APORT2X)
207    }
208    #[doc = "APORT2Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
209    #[inline(always)]
210    pub fn aport2y(self) -> &'a mut W {
211        self.variant(APORTSEL_A::APORT2Y)
212    }
213    #[doc = "APORT2Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
214    #[inline(always)]
215    pub fn aport2yx(self) -> &'a mut W {
216        self.variant(APORTSEL_A::APORT2YX)
217    }
218    #[doc = "APORT3X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
219    #[inline(always)]
220    pub fn aport3x(self) -> &'a mut W {
221        self.variant(APORTSEL_A::APORT3X)
222    }
223    #[doc = "APORT3Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
224    #[inline(always)]
225    pub fn aport3y(self) -> &'a mut W {
226        self.variant(APORTSEL_A::APORT3Y)
227    }
228    #[doc = "APORT3X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
229    #[inline(always)]
230    pub fn aport3xy(self) -> &'a mut W {
231        self.variant(APORTSEL_A::APORT3XY)
232    }
233    #[doc = "APORT4X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
234    #[inline(always)]
235    pub fn aport4x(self) -> &'a mut W {
236        self.variant(APORTSEL_A::APORT4X)
237    }
238    #[doc = "APORT4Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
239    #[inline(always)]
240    pub fn aport4y(self) -> &'a mut W {
241        self.variant(APORTSEL_A::APORT4Y)
242    }
243    #[doc = "APORT4Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
244    #[inline(always)]
245    pub fn aport4yx(self) -> &'a mut W {
246        self.variant(APORTSEL_A::APORT4YX)
247    }
248}
249impl R {
250    #[doc = "Bit 0 - Enable External Interface"]
251    #[inline(always)]
252    pub fn en(&self) -> EN_R {
253        EN_R::new((self.bits & 1) != 0)
254    }
255    #[doc = "Bits 4:7 - APORT Selection for External Interface"]
256    #[inline(always)]
257    pub fn aportsel(&self) -> APORTSEL_R {
258        APORTSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
259    }
260}
261impl W {
262    #[doc = "Bit 0 - Enable External Interface"]
263    #[inline(always)]
264    pub fn en(&mut self) -> EN_W {
265        EN_W::new(self)
266    }
267    #[doc = "Bits 4:7 - APORT Selection for External Interface"]
268    #[inline(always)]
269    pub fn aportsel(&mut self) -> APORTSEL_W {
270        APORTSEL_W::new(self)
271    }
272    #[doc = "Writes raw bits to the register."]
273    #[inline(always)]
274    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
275        self.0.bits(bits);
276        self
277    }
278}
279#[doc = "External Override Interface Control\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 [extifctrl](index.html) module"]
280pub struct EXTIFCTRL_SPEC;
281impl crate::RegisterSpec for EXTIFCTRL_SPEC {
282    type Ux = u32;
283}
284#[doc = "`read()` method returns [extifctrl::R](R) reader structure"]
285impl crate::Readable for EXTIFCTRL_SPEC {
286    type Reader = R;
287}
288#[doc = "`write(|w| ..)` method takes [extifctrl::W](W) writer structure"]
289impl crate::Writable for EXTIFCTRL_SPEC {
290    type Writer = W;
291}
292#[doc = "`reset()` method sets EXTIFCTRL to value 0"]
293impl crate::Resettable for EXTIFCTRL_SPEC {
294    #[inline(always)]
295    fn reset_value() -> Self::Ux {
296        0
297    }
298}