mkl26z4/cmp0/
muxcr.rs

1#[doc = "Reader of register MUXCR"]
2pub type R = crate::R<u8, super::MUXCR>;
3#[doc = "Writer for register MUXCR"]
4pub type W = crate::W<u8, super::MUXCR>;
5#[doc = "Register MUXCR `reset()`'s with value 0"]
6impl crate::ResetValue for super::MUXCR {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Possible values of the field `MSEL`"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum MSEL_A {
16    #[doc = "IN0"]
17    _000,
18    #[doc = "IN1"]
19    _001,
20    #[doc = "IN2"]
21    _010,
22    #[doc = "IN3"]
23    _011,
24    #[doc = "IN4"]
25    _100,
26    #[doc = "IN5"]
27    _101,
28    #[doc = "IN6"]
29    _110,
30    #[doc = "IN7"]
31    _111,
32}
33impl crate::ToBits<u8> for MSEL_A {
34    #[inline(always)]
35    fn _bits(&self) -> u8 {
36        match *self {
37            MSEL_A::_000 => 0,
38            MSEL_A::_001 => 1,
39            MSEL_A::_010 => 2,
40            MSEL_A::_011 => 3,
41            MSEL_A::_100 => 4,
42            MSEL_A::_101 => 5,
43            MSEL_A::_110 => 6,
44            MSEL_A::_111 => 7,
45        }
46    }
47}
48#[doc = "Reader of field `MSEL`"]
49pub type MSEL_R = crate::R<u8, MSEL_A>;
50impl MSEL_R {
51    #[doc = r"Get enumerated values variant"]
52    #[inline(always)]
53    pub fn variant(&self) -> MSEL_A {
54        match self.bits {
55            0 => MSEL_A::_000,
56            1 => MSEL_A::_001,
57            2 => MSEL_A::_010,
58            3 => MSEL_A::_011,
59            4 => MSEL_A::_100,
60            5 => MSEL_A::_101,
61            6 => MSEL_A::_110,
62            7 => MSEL_A::_111,
63            _ => unreachable!(),
64        }
65    }
66    #[doc = "Checks if the value of the field is `_000`"]
67    #[inline(always)]
68    pub fn is_000(&self) -> bool {
69        *self == MSEL_A::_000
70    }
71    #[doc = "Checks if the value of the field is `_001`"]
72    #[inline(always)]
73    pub fn is_001(&self) -> bool {
74        *self == MSEL_A::_001
75    }
76    #[doc = "Checks if the value of the field is `_010`"]
77    #[inline(always)]
78    pub fn is_010(&self) -> bool {
79        *self == MSEL_A::_010
80    }
81    #[doc = "Checks if the value of the field is `_011`"]
82    #[inline(always)]
83    pub fn is_011(&self) -> bool {
84        *self == MSEL_A::_011
85    }
86    #[doc = "Checks if the value of the field is `_100`"]
87    #[inline(always)]
88    pub fn is_100(&self) -> bool {
89        *self == MSEL_A::_100
90    }
91    #[doc = "Checks if the value of the field is `_101`"]
92    #[inline(always)]
93    pub fn is_101(&self) -> bool {
94        *self == MSEL_A::_101
95    }
96    #[doc = "Checks if the value of the field is `_110`"]
97    #[inline(always)]
98    pub fn is_110(&self) -> bool {
99        *self == MSEL_A::_110
100    }
101    #[doc = "Checks if the value of the field is `_111`"]
102    #[inline(always)]
103    pub fn is_111(&self) -> bool {
104        *self == MSEL_A::_111
105    }
106}
107#[doc = "Write proxy for field `MSEL`"]
108pub struct MSEL_W<'a> {
109    w: &'a mut W,
110}
111impl<'a> MSEL_W<'a> {
112    #[doc = r"Writes `variant` to the field"]
113    #[inline(always)]
114    pub fn variant(self, variant: MSEL_A) -> &'a mut W {
115        use crate::ToBits;
116        {
117            self.bits(variant._bits())
118        }
119    }
120    #[doc = "IN0"]
121    #[inline(always)]
122    pub fn _000(self) -> &'a mut W {
123        self.variant(MSEL_A::_000)
124    }
125    #[doc = "IN1"]
126    #[inline(always)]
127    pub fn _001(self) -> &'a mut W {
128        self.variant(MSEL_A::_001)
129    }
130    #[doc = "IN2"]
131    #[inline(always)]
132    pub fn _010(self) -> &'a mut W {
133        self.variant(MSEL_A::_010)
134    }
135    #[doc = "IN3"]
136    #[inline(always)]
137    pub fn _011(self) -> &'a mut W {
138        self.variant(MSEL_A::_011)
139    }
140    #[doc = "IN4"]
141    #[inline(always)]
142    pub fn _100(self) -> &'a mut W {
143        self.variant(MSEL_A::_100)
144    }
145    #[doc = "IN5"]
146    #[inline(always)]
147    pub fn _101(self) -> &'a mut W {
148        self.variant(MSEL_A::_101)
149    }
150    #[doc = "IN6"]
151    #[inline(always)]
152    pub fn _110(self) -> &'a mut W {
153        self.variant(MSEL_A::_110)
154    }
155    #[doc = "IN7"]
156    #[inline(always)]
157    pub fn _111(self) -> &'a mut W {
158        self.variant(MSEL_A::_111)
159    }
160    #[doc = r"Writes raw bits to the field"]
161    #[inline(always)]
162    pub fn bits(self, value: u8) -> &'a mut W {
163        self.w.bits = (self.w.bits & !0x07) | ((value as u8) & 0x07);
164        self.w
165    }
166}
167#[doc = "Possible values of the field `PSEL`"]
168#[derive(Clone, Copy, Debug, PartialEq)]
169pub enum PSEL_A {
170    #[doc = "IN0"]
171    _000,
172    #[doc = "IN1"]
173    _001,
174    #[doc = "IN2"]
175    _010,
176    #[doc = "IN3"]
177    _011,
178    #[doc = "IN4"]
179    _100,
180    #[doc = "IN5"]
181    _101,
182    #[doc = "IN6"]
183    _110,
184    #[doc = "IN7"]
185    _111,
186}
187impl crate::ToBits<u8> for PSEL_A {
188    #[inline(always)]
189    fn _bits(&self) -> u8 {
190        match *self {
191            PSEL_A::_000 => 0,
192            PSEL_A::_001 => 1,
193            PSEL_A::_010 => 2,
194            PSEL_A::_011 => 3,
195            PSEL_A::_100 => 4,
196            PSEL_A::_101 => 5,
197            PSEL_A::_110 => 6,
198            PSEL_A::_111 => 7,
199        }
200    }
201}
202#[doc = "Reader of field `PSEL`"]
203pub type PSEL_R = crate::R<u8, PSEL_A>;
204impl PSEL_R {
205    #[doc = r"Get enumerated values variant"]
206    #[inline(always)]
207    pub fn variant(&self) -> PSEL_A {
208        match self.bits {
209            0 => PSEL_A::_000,
210            1 => PSEL_A::_001,
211            2 => PSEL_A::_010,
212            3 => PSEL_A::_011,
213            4 => PSEL_A::_100,
214            5 => PSEL_A::_101,
215            6 => PSEL_A::_110,
216            7 => PSEL_A::_111,
217            _ => unreachable!(),
218        }
219    }
220    #[doc = "Checks if the value of the field is `_000`"]
221    #[inline(always)]
222    pub fn is_000(&self) -> bool {
223        *self == PSEL_A::_000
224    }
225    #[doc = "Checks if the value of the field is `_001`"]
226    #[inline(always)]
227    pub fn is_001(&self) -> bool {
228        *self == PSEL_A::_001
229    }
230    #[doc = "Checks if the value of the field is `_010`"]
231    #[inline(always)]
232    pub fn is_010(&self) -> bool {
233        *self == PSEL_A::_010
234    }
235    #[doc = "Checks if the value of the field is `_011`"]
236    #[inline(always)]
237    pub fn is_011(&self) -> bool {
238        *self == PSEL_A::_011
239    }
240    #[doc = "Checks if the value of the field is `_100`"]
241    #[inline(always)]
242    pub fn is_100(&self) -> bool {
243        *self == PSEL_A::_100
244    }
245    #[doc = "Checks if the value of the field is `_101`"]
246    #[inline(always)]
247    pub fn is_101(&self) -> bool {
248        *self == PSEL_A::_101
249    }
250    #[doc = "Checks if the value of the field is `_110`"]
251    #[inline(always)]
252    pub fn is_110(&self) -> bool {
253        *self == PSEL_A::_110
254    }
255    #[doc = "Checks if the value of the field is `_111`"]
256    #[inline(always)]
257    pub fn is_111(&self) -> bool {
258        *self == PSEL_A::_111
259    }
260}
261#[doc = "Write proxy for field `PSEL`"]
262pub struct PSEL_W<'a> {
263    w: &'a mut W,
264}
265impl<'a> PSEL_W<'a> {
266    #[doc = r"Writes `variant` to the field"]
267    #[inline(always)]
268    pub fn variant(self, variant: PSEL_A) -> &'a mut W {
269        use crate::ToBits;
270        {
271            self.bits(variant._bits())
272        }
273    }
274    #[doc = "IN0"]
275    #[inline(always)]
276    pub fn _000(self) -> &'a mut W {
277        self.variant(PSEL_A::_000)
278    }
279    #[doc = "IN1"]
280    #[inline(always)]
281    pub fn _001(self) -> &'a mut W {
282        self.variant(PSEL_A::_001)
283    }
284    #[doc = "IN2"]
285    #[inline(always)]
286    pub fn _010(self) -> &'a mut W {
287        self.variant(PSEL_A::_010)
288    }
289    #[doc = "IN3"]
290    #[inline(always)]
291    pub fn _011(self) -> &'a mut W {
292        self.variant(PSEL_A::_011)
293    }
294    #[doc = "IN4"]
295    #[inline(always)]
296    pub fn _100(self) -> &'a mut W {
297        self.variant(PSEL_A::_100)
298    }
299    #[doc = "IN5"]
300    #[inline(always)]
301    pub fn _101(self) -> &'a mut W {
302        self.variant(PSEL_A::_101)
303    }
304    #[doc = "IN6"]
305    #[inline(always)]
306    pub fn _110(self) -> &'a mut W {
307        self.variant(PSEL_A::_110)
308    }
309    #[doc = "IN7"]
310    #[inline(always)]
311    pub fn _111(self) -> &'a mut W {
312        self.variant(PSEL_A::_111)
313    }
314    #[doc = r"Writes raw bits to the field"]
315    #[inline(always)]
316    pub fn bits(self, value: u8) -> &'a mut W {
317        self.w.bits = (self.w.bits & !(0x07 << 3)) | (((value as u8) & 0x07) << 3);
318        self.w
319    }
320}
321#[doc = "Possible values of the field `PSTM`"]
322#[derive(Clone, Copy, Debug, PartialEq)]
323pub enum PSTM_A {
324    #[doc = "Pass Through Mode is disabled."]
325    _0,
326    #[doc = "Pass Through Mode is enabled."]
327    _1,
328}
329impl crate::ToBits<bool> for PSTM_A {
330    #[inline(always)]
331    fn _bits(&self) -> bool {
332        match *self {
333            PSTM_A::_0 => false,
334            PSTM_A::_1 => true,
335        }
336    }
337}
338#[doc = "Reader of field `PSTM`"]
339pub type PSTM_R = crate::R<bool, PSTM_A>;
340impl PSTM_R {
341    #[doc = r"Get enumerated values variant"]
342    #[inline(always)]
343    pub fn variant(&self) -> PSTM_A {
344        match self.bits {
345            false => PSTM_A::_0,
346            true => PSTM_A::_1,
347        }
348    }
349    #[doc = "Checks if the value of the field is `_0`"]
350    #[inline(always)]
351    pub fn is_0(&self) -> bool {
352        *self == PSTM_A::_0
353    }
354    #[doc = "Checks if the value of the field is `_1`"]
355    #[inline(always)]
356    pub fn is_1(&self) -> bool {
357        *self == PSTM_A::_1
358    }
359}
360#[doc = "Write proxy for field `PSTM`"]
361pub struct PSTM_W<'a> {
362    w: &'a mut W,
363}
364impl<'a> PSTM_W<'a> {
365    #[doc = r"Writes `variant` to the field"]
366    #[inline(always)]
367    pub fn variant(self, variant: PSTM_A) -> &'a mut W {
368        use crate::ToBits;
369        {
370            self.bit(variant._bits())
371        }
372    }
373    #[doc = "Pass Through Mode is disabled."]
374    #[inline(always)]
375    pub fn _0(self) -> &'a mut W {
376        self.variant(PSTM_A::_0)
377    }
378    #[doc = "Pass Through Mode is enabled."]
379    #[inline(always)]
380    pub fn _1(self) -> &'a mut W {
381        self.variant(PSTM_A::_1)
382    }
383    #[doc = r"Sets the field bit"]
384    #[inline(always)]
385    pub fn set_bit(self) -> &'a mut W {
386        self.bit(true)
387    }
388    #[doc = r"Clears the field bit"]
389    #[inline(always)]
390    pub fn clear_bit(self) -> &'a mut W {
391        self.bit(false)
392    }
393    #[doc = r"Writes raw bits to the field"]
394    #[inline(always)]
395    pub fn bit(self, value: bool) -> &'a mut W {
396        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
397        self.w
398    }
399}
400impl R {
401    #[doc = "Bits 0:2 - Minus Input Mux Control"]
402    #[inline(always)]
403    pub fn msel(&self) -> MSEL_R {
404        MSEL_R::new((self.bits & 0x07) as u8)
405    }
406    #[doc = "Bits 3:5 - Plus Input Mux Control"]
407    #[inline(always)]
408    pub fn psel(&self) -> PSEL_R {
409        PSEL_R::new(((self.bits >> 3) & 0x07) as u8)
410    }
411    #[doc = "Bit 7 - Pass Through Mode Enable"]
412    #[inline(always)]
413    pub fn pstm(&self) -> PSTM_R {
414        PSTM_R::new(((self.bits >> 7) & 0x01) != 0)
415    }
416}
417impl W {
418    #[doc = "Bits 0:2 - Minus Input Mux Control"]
419    #[inline(always)]
420    pub fn msel(&mut self) -> MSEL_W {
421        MSEL_W { w: self }
422    }
423    #[doc = "Bits 3:5 - Plus Input Mux Control"]
424    #[inline(always)]
425    pub fn psel(&mut self) -> PSEL_W {
426        PSEL_W { w: self }
427    }
428    #[doc = "Bit 7 - Pass Through Mode Enable"]
429    #[inline(always)]
430    pub fn pstm(&mut self) -> PSTM_W {
431        PSTM_W { w: self }
432    }
433}