efm32tg11b_pac/efm32tg11b540/acmp1/
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, const O: u8> = crate::BitWriter<'a, u32, EXTIFCTRL_SPEC, bool, O>;
41#[doc = "Field `APORTSEL` reader - APORT Selection for External Interface"]
42pub type APORTSEL_R = crate::FieldReader<u8, APORTSEL_A>;
43#[doc = "APORT Selection for External Interface\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum APORTSEL_A {
47    #[doc = "0: APORT0X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0XCH0."]
48    APORT0X = 0,
49    #[doc = "1: APORT0Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0YCH0."]
50    APORT0Y = 1,
51    #[doc = "2: APORT1X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
52    APORT1X = 2,
53    #[doc = "3: APORT1Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
54    APORT1Y = 3,
55    #[doc = "4: APORT1X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
56    APORT1XY = 4,
57    #[doc = "5: APORT2X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
58    APORT2X = 5,
59    #[doc = "6: APORT2Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
60    APORT2Y = 6,
61    #[doc = "7: APORT2Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
62    APORT2YX = 7,
63    #[doc = "8: APORT3X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
64    APORT3X = 8,
65    #[doc = "9: APORT3Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
66    APORT3Y = 9,
67    #[doc = "10: APORT3X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
68    APORT3XY = 10,
69    #[doc = "11: APORT4X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
70    APORT4X = 11,
71    #[doc = "12: APORT4Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
72    APORT4Y = 12,
73    #[doc = "13: APORT4Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
74    APORT4YX = 13,
75}
76impl From<APORTSEL_A> for u8 {
77    #[inline(always)]
78    fn from(variant: APORTSEL_A) -> Self {
79        variant as _
80    }
81}
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, const O: u8> =
177    crate::FieldWriter<'a, u32, EXTIFCTRL_SPEC, u8, APORTSEL_A, 4, O>;
178impl<'a, const O: u8> APORTSEL_W<'a, O> {
179    #[doc = "APORT0X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0XCH0."]
180    #[inline(always)]
181    pub fn aport0x(self) -> &'a mut W {
182        self.variant(APORTSEL_A::APORT0X)
183    }
184    #[doc = "APORT0Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT0YCH0."]
185    #[inline(always)]
186    pub fn aport0y(self) -> &'a mut W {
187        self.variant(APORTSEL_A::APORT0Y)
188    }
189    #[doc = "APORT1X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
190    #[inline(always)]
191    pub fn aport1x(self) -> &'a mut W {
192        self.variant(APORTSEL_A::APORT1X)
193    }
194    #[doc = "APORT1Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
195    #[inline(always)]
196    pub fn aport1y(self) -> &'a mut W {
197        self.variant(APORTSEL_A::APORT1Y)
198    }
199    #[doc = "APORT1X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT1XCH0."]
200    #[inline(always)]
201    pub fn aport1xy(self) -> &'a mut W {
202        self.variant(APORTSEL_A::APORT1XY)
203    }
204    #[doc = "APORT2X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
205    #[inline(always)]
206    pub fn aport2x(self) -> &'a mut W {
207        self.variant(APORTSEL_A::APORT2X)
208    }
209    #[doc = "APORT2Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
210    #[inline(always)]
211    pub fn aport2y(self) -> &'a mut W {
212        self.variant(APORTSEL_A::APORT2Y)
213    }
214    #[doc = "APORT2Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT2YCH0."]
215    #[inline(always)]
216    pub fn aport2yx(self) -> &'a mut W {
217        self.variant(APORTSEL_A::APORT2YX)
218    }
219    #[doc = "APORT3X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
220    #[inline(always)]
221    pub fn aport3x(self) -> &'a mut W {
222        self.variant(APORTSEL_A::APORT3X)
223    }
224    #[doc = "APORT3Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
225    #[inline(always)]
226    pub fn aport3y(self) -> &'a mut W {
227        self.variant(APORTSEL_A::APORT3Y)
228    }
229    #[doc = "APORT3X/Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT3XCH0."]
230    #[inline(always)]
231    pub fn aport3xy(self) -> &'a mut W {
232        self.variant(APORTSEL_A::APORT3XY)
233    }
234    #[doc = "APORT4X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
235    #[inline(always)]
236    pub fn aport4x(self) -> &'a mut W {
237        self.variant(APORTSEL_A::APORT4X)
238    }
239    #[doc = "APORT4Y used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
240    #[inline(always)]
241    pub fn aport4y(self) -> &'a mut W {
242        self.variant(APORTSEL_A::APORT4Y)
243    }
244    #[doc = "APORT4Y/X used. EXT_BASE = ACMP_INPUTSEL_POSSEL_APORT4YCH0."]
245    #[inline(always)]
246    pub fn aport4yx(self) -> &'a mut W {
247        self.variant(APORTSEL_A::APORT4YX)
248    }
249}
250impl R {
251    #[doc = "Bit 0 - Enable External Interface"]
252    #[inline(always)]
253    pub fn en(&self) -> EN_R {
254        EN_R::new((self.bits & 1) != 0)
255    }
256    #[doc = "Bits 4:7 - APORT Selection for External Interface"]
257    #[inline(always)]
258    pub fn aportsel(&self) -> APORTSEL_R {
259        APORTSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
260    }
261}
262impl W {
263    #[doc = "Bit 0 - Enable External Interface"]
264    #[inline(always)]
265    #[must_use]
266    pub fn en(&mut self) -> EN_W<0> {
267        EN_W::new(self)
268    }
269    #[doc = "Bits 4:7 - APORT Selection for External Interface"]
270    #[inline(always)]
271    #[must_use]
272    pub fn aportsel(&mut self) -> APORTSEL_W<4> {
273        APORTSEL_W::new(self)
274    }
275    #[doc = "Writes raw bits to the register."]
276    #[inline(always)]
277    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
278        self.0.bits(bits);
279        self
280    }
281}
282#[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"]
283pub struct EXTIFCTRL_SPEC;
284impl crate::RegisterSpec for EXTIFCTRL_SPEC {
285    type Ux = u32;
286}
287#[doc = "`read()` method returns [extifctrl::R](R) reader structure"]
288impl crate::Readable for EXTIFCTRL_SPEC {
289    type Reader = R;
290}
291#[doc = "`write(|w| ..)` method takes [extifctrl::W](W) writer structure"]
292impl crate::Writable for EXTIFCTRL_SPEC {
293    type Writer = W;
294    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
295    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
296}
297#[doc = "`reset()` method sets EXTIFCTRL to value 0"]
298impl crate::Resettable for EXTIFCTRL_SPEC {
299    const RESET_VALUE: Self::Ux = 0;
300}