atsamd51g/port/group/
pmux.rs

1#[doc = "Register `PMUX[%s]` reader"]
2pub type R = crate::R<PmuxSpec>;
3#[doc = "Register `PMUX[%s]` writer"]
4pub type W = crate::W<PmuxSpec>;
5#[doc = "Peripheral Multiplexing for Even-Numbered Pin\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Pmuxeselect {
9    #[doc = "0: Peripheral function A selected"]
10    A = 0,
11    #[doc = "1: Peripheral function B selected"]
12    B = 1,
13    #[doc = "2: Peripheral function C selected"]
14    C = 2,
15    #[doc = "3: Peripheral function D selected"]
16    D = 3,
17    #[doc = "4: Peripheral function E selected"]
18    E = 4,
19    #[doc = "5: Peripheral function F selected"]
20    F = 5,
21    #[doc = "6: Peripheral function G selected"]
22    G = 6,
23    #[doc = "7: Peripheral function H selected"]
24    H = 7,
25    #[doc = "8: Peripheral function I selected"]
26    I = 8,
27    #[doc = "9: Peripheral function J selected"]
28    J = 9,
29    #[doc = "10: Peripheral function K selected"]
30    K = 10,
31    #[doc = "11: Peripheral function L selected"]
32    L = 11,
33    #[doc = "12: Peripheral function M selected"]
34    M = 12,
35    #[doc = "13: Peripheral function N selected"]
36    N = 13,
37}
38impl From<Pmuxeselect> for u8 {
39    #[inline(always)]
40    fn from(variant: Pmuxeselect) -> Self {
41        variant as _
42    }
43}
44impl crate::FieldSpec for Pmuxeselect {
45    type Ux = u8;
46}
47impl crate::IsEnum for Pmuxeselect {}
48#[doc = "Field `PMUXE` reader - Peripheral Multiplexing for Even-Numbered Pin"]
49pub type PmuxeR = crate::FieldReader<Pmuxeselect>;
50impl PmuxeR {
51    #[doc = "Get enumerated values variant"]
52    #[inline(always)]
53    pub const fn variant(&self) -> Option<Pmuxeselect> {
54        match self.bits {
55            0 => Some(Pmuxeselect::A),
56            1 => Some(Pmuxeselect::B),
57            2 => Some(Pmuxeselect::C),
58            3 => Some(Pmuxeselect::D),
59            4 => Some(Pmuxeselect::E),
60            5 => Some(Pmuxeselect::F),
61            6 => Some(Pmuxeselect::G),
62            7 => Some(Pmuxeselect::H),
63            8 => Some(Pmuxeselect::I),
64            9 => Some(Pmuxeselect::J),
65            10 => Some(Pmuxeselect::K),
66            11 => Some(Pmuxeselect::L),
67            12 => Some(Pmuxeselect::M),
68            13 => Some(Pmuxeselect::N),
69            _ => None,
70        }
71    }
72    #[doc = "Peripheral function A selected"]
73    #[inline(always)]
74    pub fn is_a(&self) -> bool {
75        *self == Pmuxeselect::A
76    }
77    #[doc = "Peripheral function B selected"]
78    #[inline(always)]
79    pub fn is_b(&self) -> bool {
80        *self == Pmuxeselect::B
81    }
82    #[doc = "Peripheral function C selected"]
83    #[inline(always)]
84    pub fn is_c(&self) -> bool {
85        *self == Pmuxeselect::C
86    }
87    #[doc = "Peripheral function D selected"]
88    #[inline(always)]
89    pub fn is_d(&self) -> bool {
90        *self == Pmuxeselect::D
91    }
92    #[doc = "Peripheral function E selected"]
93    #[inline(always)]
94    pub fn is_e(&self) -> bool {
95        *self == Pmuxeselect::E
96    }
97    #[doc = "Peripheral function F selected"]
98    #[inline(always)]
99    pub fn is_f(&self) -> bool {
100        *self == Pmuxeselect::F
101    }
102    #[doc = "Peripheral function G selected"]
103    #[inline(always)]
104    pub fn is_g(&self) -> bool {
105        *self == Pmuxeselect::G
106    }
107    #[doc = "Peripheral function H selected"]
108    #[inline(always)]
109    pub fn is_h(&self) -> bool {
110        *self == Pmuxeselect::H
111    }
112    #[doc = "Peripheral function I selected"]
113    #[inline(always)]
114    pub fn is_i(&self) -> bool {
115        *self == Pmuxeselect::I
116    }
117    #[doc = "Peripheral function J selected"]
118    #[inline(always)]
119    pub fn is_j(&self) -> bool {
120        *self == Pmuxeselect::J
121    }
122    #[doc = "Peripheral function K selected"]
123    #[inline(always)]
124    pub fn is_k(&self) -> bool {
125        *self == Pmuxeselect::K
126    }
127    #[doc = "Peripheral function L selected"]
128    #[inline(always)]
129    pub fn is_l(&self) -> bool {
130        *self == Pmuxeselect::L
131    }
132    #[doc = "Peripheral function M selected"]
133    #[inline(always)]
134    pub fn is_m(&self) -> bool {
135        *self == Pmuxeselect::M
136    }
137    #[doc = "Peripheral function N selected"]
138    #[inline(always)]
139    pub fn is_n(&self) -> bool {
140        *self == Pmuxeselect::N
141    }
142}
143#[doc = "Field `PMUXE` writer - Peripheral Multiplexing for Even-Numbered Pin"]
144pub type PmuxeW<'a, REG> = crate::FieldWriter<'a, REG, 4, Pmuxeselect>;
145impl<'a, REG> PmuxeW<'a, REG>
146where
147    REG: crate::Writable + crate::RegisterSpec,
148    REG::Ux: From<u8>,
149{
150    #[doc = "Peripheral function A selected"]
151    #[inline(always)]
152    pub fn a(self) -> &'a mut crate::W<REG> {
153        self.variant(Pmuxeselect::A)
154    }
155    #[doc = "Peripheral function B selected"]
156    #[inline(always)]
157    pub fn b(self) -> &'a mut crate::W<REG> {
158        self.variant(Pmuxeselect::B)
159    }
160    #[doc = "Peripheral function C selected"]
161    #[inline(always)]
162    pub fn c(self) -> &'a mut crate::W<REG> {
163        self.variant(Pmuxeselect::C)
164    }
165    #[doc = "Peripheral function D selected"]
166    #[inline(always)]
167    pub fn d(self) -> &'a mut crate::W<REG> {
168        self.variant(Pmuxeselect::D)
169    }
170    #[doc = "Peripheral function E selected"]
171    #[inline(always)]
172    pub fn e(self) -> &'a mut crate::W<REG> {
173        self.variant(Pmuxeselect::E)
174    }
175    #[doc = "Peripheral function F selected"]
176    #[inline(always)]
177    pub fn f(self) -> &'a mut crate::W<REG> {
178        self.variant(Pmuxeselect::F)
179    }
180    #[doc = "Peripheral function G selected"]
181    #[inline(always)]
182    pub fn g(self) -> &'a mut crate::W<REG> {
183        self.variant(Pmuxeselect::G)
184    }
185    #[doc = "Peripheral function H selected"]
186    #[inline(always)]
187    pub fn h(self) -> &'a mut crate::W<REG> {
188        self.variant(Pmuxeselect::H)
189    }
190    #[doc = "Peripheral function I selected"]
191    #[inline(always)]
192    pub fn i(self) -> &'a mut crate::W<REG> {
193        self.variant(Pmuxeselect::I)
194    }
195    #[doc = "Peripheral function J selected"]
196    #[inline(always)]
197    pub fn j(self) -> &'a mut crate::W<REG> {
198        self.variant(Pmuxeselect::J)
199    }
200    #[doc = "Peripheral function K selected"]
201    #[inline(always)]
202    pub fn k(self) -> &'a mut crate::W<REG> {
203        self.variant(Pmuxeselect::K)
204    }
205    #[doc = "Peripheral function L selected"]
206    #[inline(always)]
207    pub fn l(self) -> &'a mut crate::W<REG> {
208        self.variant(Pmuxeselect::L)
209    }
210    #[doc = "Peripheral function M selected"]
211    #[inline(always)]
212    pub fn m(self) -> &'a mut crate::W<REG> {
213        self.variant(Pmuxeselect::M)
214    }
215    #[doc = "Peripheral function N selected"]
216    #[inline(always)]
217    pub fn n(self) -> &'a mut crate::W<REG> {
218        self.variant(Pmuxeselect::N)
219    }
220}
221#[doc = "Peripheral Multiplexing for Odd-Numbered Pin\n\nValue on reset: 0"]
222#[derive(Clone, Copy, Debug, PartialEq, Eq)]
223#[repr(u8)]
224pub enum Pmuxoselect {
225    #[doc = "0: Peripheral function A selected"]
226    A = 0,
227    #[doc = "1: Peripheral function B selected"]
228    B = 1,
229    #[doc = "2: Peripheral function C selected"]
230    C = 2,
231    #[doc = "3: Peripheral function D selected"]
232    D = 3,
233    #[doc = "4: Peripheral function E selected"]
234    E = 4,
235    #[doc = "5: Peripheral function F selected"]
236    F = 5,
237    #[doc = "6: Peripheral function G selected"]
238    G = 6,
239    #[doc = "7: Peripheral function H selected"]
240    H = 7,
241    #[doc = "8: Peripheral function I selected"]
242    I = 8,
243    #[doc = "9: Peripheral function J selected"]
244    J = 9,
245    #[doc = "10: Peripheral function K selected"]
246    K = 10,
247    #[doc = "11: Peripheral function L selected"]
248    L = 11,
249    #[doc = "12: Peripheral function M selected"]
250    M = 12,
251    #[doc = "13: Peripheral function N selected"]
252    N = 13,
253}
254impl From<Pmuxoselect> for u8 {
255    #[inline(always)]
256    fn from(variant: Pmuxoselect) -> Self {
257        variant as _
258    }
259}
260impl crate::FieldSpec for Pmuxoselect {
261    type Ux = u8;
262}
263impl crate::IsEnum for Pmuxoselect {}
264#[doc = "Field `PMUXO` reader - Peripheral Multiplexing for Odd-Numbered Pin"]
265pub type PmuxoR = crate::FieldReader<Pmuxoselect>;
266impl PmuxoR {
267    #[doc = "Get enumerated values variant"]
268    #[inline(always)]
269    pub const fn variant(&self) -> Option<Pmuxoselect> {
270        match self.bits {
271            0 => Some(Pmuxoselect::A),
272            1 => Some(Pmuxoselect::B),
273            2 => Some(Pmuxoselect::C),
274            3 => Some(Pmuxoselect::D),
275            4 => Some(Pmuxoselect::E),
276            5 => Some(Pmuxoselect::F),
277            6 => Some(Pmuxoselect::G),
278            7 => Some(Pmuxoselect::H),
279            8 => Some(Pmuxoselect::I),
280            9 => Some(Pmuxoselect::J),
281            10 => Some(Pmuxoselect::K),
282            11 => Some(Pmuxoselect::L),
283            12 => Some(Pmuxoselect::M),
284            13 => Some(Pmuxoselect::N),
285            _ => None,
286        }
287    }
288    #[doc = "Peripheral function A selected"]
289    #[inline(always)]
290    pub fn is_a(&self) -> bool {
291        *self == Pmuxoselect::A
292    }
293    #[doc = "Peripheral function B selected"]
294    #[inline(always)]
295    pub fn is_b(&self) -> bool {
296        *self == Pmuxoselect::B
297    }
298    #[doc = "Peripheral function C selected"]
299    #[inline(always)]
300    pub fn is_c(&self) -> bool {
301        *self == Pmuxoselect::C
302    }
303    #[doc = "Peripheral function D selected"]
304    #[inline(always)]
305    pub fn is_d(&self) -> bool {
306        *self == Pmuxoselect::D
307    }
308    #[doc = "Peripheral function E selected"]
309    #[inline(always)]
310    pub fn is_e(&self) -> bool {
311        *self == Pmuxoselect::E
312    }
313    #[doc = "Peripheral function F selected"]
314    #[inline(always)]
315    pub fn is_f(&self) -> bool {
316        *self == Pmuxoselect::F
317    }
318    #[doc = "Peripheral function G selected"]
319    #[inline(always)]
320    pub fn is_g(&self) -> bool {
321        *self == Pmuxoselect::G
322    }
323    #[doc = "Peripheral function H selected"]
324    #[inline(always)]
325    pub fn is_h(&self) -> bool {
326        *self == Pmuxoselect::H
327    }
328    #[doc = "Peripheral function I selected"]
329    #[inline(always)]
330    pub fn is_i(&self) -> bool {
331        *self == Pmuxoselect::I
332    }
333    #[doc = "Peripheral function J selected"]
334    #[inline(always)]
335    pub fn is_j(&self) -> bool {
336        *self == Pmuxoselect::J
337    }
338    #[doc = "Peripheral function K selected"]
339    #[inline(always)]
340    pub fn is_k(&self) -> bool {
341        *self == Pmuxoselect::K
342    }
343    #[doc = "Peripheral function L selected"]
344    #[inline(always)]
345    pub fn is_l(&self) -> bool {
346        *self == Pmuxoselect::L
347    }
348    #[doc = "Peripheral function M selected"]
349    #[inline(always)]
350    pub fn is_m(&self) -> bool {
351        *self == Pmuxoselect::M
352    }
353    #[doc = "Peripheral function N selected"]
354    #[inline(always)]
355    pub fn is_n(&self) -> bool {
356        *self == Pmuxoselect::N
357    }
358}
359#[doc = "Field `PMUXO` writer - Peripheral Multiplexing for Odd-Numbered Pin"]
360pub type PmuxoW<'a, REG> = crate::FieldWriter<'a, REG, 4, Pmuxoselect>;
361impl<'a, REG> PmuxoW<'a, REG>
362where
363    REG: crate::Writable + crate::RegisterSpec,
364    REG::Ux: From<u8>,
365{
366    #[doc = "Peripheral function A selected"]
367    #[inline(always)]
368    pub fn a(self) -> &'a mut crate::W<REG> {
369        self.variant(Pmuxoselect::A)
370    }
371    #[doc = "Peripheral function B selected"]
372    #[inline(always)]
373    pub fn b(self) -> &'a mut crate::W<REG> {
374        self.variant(Pmuxoselect::B)
375    }
376    #[doc = "Peripheral function C selected"]
377    #[inline(always)]
378    pub fn c(self) -> &'a mut crate::W<REG> {
379        self.variant(Pmuxoselect::C)
380    }
381    #[doc = "Peripheral function D selected"]
382    #[inline(always)]
383    pub fn d(self) -> &'a mut crate::W<REG> {
384        self.variant(Pmuxoselect::D)
385    }
386    #[doc = "Peripheral function E selected"]
387    #[inline(always)]
388    pub fn e(self) -> &'a mut crate::W<REG> {
389        self.variant(Pmuxoselect::E)
390    }
391    #[doc = "Peripheral function F selected"]
392    #[inline(always)]
393    pub fn f(self) -> &'a mut crate::W<REG> {
394        self.variant(Pmuxoselect::F)
395    }
396    #[doc = "Peripheral function G selected"]
397    #[inline(always)]
398    pub fn g(self) -> &'a mut crate::W<REG> {
399        self.variant(Pmuxoselect::G)
400    }
401    #[doc = "Peripheral function H selected"]
402    #[inline(always)]
403    pub fn h(self) -> &'a mut crate::W<REG> {
404        self.variant(Pmuxoselect::H)
405    }
406    #[doc = "Peripheral function I selected"]
407    #[inline(always)]
408    pub fn i(self) -> &'a mut crate::W<REG> {
409        self.variant(Pmuxoselect::I)
410    }
411    #[doc = "Peripheral function J selected"]
412    #[inline(always)]
413    pub fn j(self) -> &'a mut crate::W<REG> {
414        self.variant(Pmuxoselect::J)
415    }
416    #[doc = "Peripheral function K selected"]
417    #[inline(always)]
418    pub fn k(self) -> &'a mut crate::W<REG> {
419        self.variant(Pmuxoselect::K)
420    }
421    #[doc = "Peripheral function L selected"]
422    #[inline(always)]
423    pub fn l(self) -> &'a mut crate::W<REG> {
424        self.variant(Pmuxoselect::L)
425    }
426    #[doc = "Peripheral function M selected"]
427    #[inline(always)]
428    pub fn m(self) -> &'a mut crate::W<REG> {
429        self.variant(Pmuxoselect::M)
430    }
431    #[doc = "Peripheral function N selected"]
432    #[inline(always)]
433    pub fn n(self) -> &'a mut crate::W<REG> {
434        self.variant(Pmuxoselect::N)
435    }
436}
437impl R {
438    #[doc = "Bits 0:3 - Peripheral Multiplexing for Even-Numbered Pin"]
439    #[inline(always)]
440    pub fn pmuxe(&self) -> PmuxeR {
441        PmuxeR::new(self.bits & 0x0f)
442    }
443    #[doc = "Bits 4:7 - Peripheral Multiplexing for Odd-Numbered Pin"]
444    #[inline(always)]
445    pub fn pmuxo(&self) -> PmuxoR {
446        PmuxoR::new((self.bits >> 4) & 0x0f)
447    }
448}
449impl W {
450    #[doc = "Bits 0:3 - Peripheral Multiplexing for Even-Numbered Pin"]
451    #[inline(always)]
452    #[must_use]
453    pub fn pmuxe(&mut self) -> PmuxeW<PmuxSpec> {
454        PmuxeW::new(self, 0)
455    }
456    #[doc = "Bits 4:7 - Peripheral Multiplexing for Odd-Numbered Pin"]
457    #[inline(always)]
458    #[must_use]
459    pub fn pmuxo(&mut self) -> PmuxoW<PmuxSpec> {
460        PmuxoW::new(self, 4)
461    }
462}
463#[doc = "Peripheral Multiplexing\n\nYou can [`read`](crate::Reg::read) this register and get [`pmux::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pmux::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
464pub struct PmuxSpec;
465impl crate::RegisterSpec for PmuxSpec {
466    type Ux = u8;
467}
468#[doc = "`read()` method returns [`pmux::R`](R) reader structure"]
469impl crate::Readable for PmuxSpec {}
470#[doc = "`write(|w| ..)` method takes [`pmux::W`](W) writer structure"]
471impl crate::Writable for PmuxSpec {
472    type Safety = crate::Unsafe;
473    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
474    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
475}
476#[doc = "`reset()` method sets PMUX[%s]
477to value 0"]
478impl crate::Resettable for PmuxSpec {
479    const RESET_VALUE: u8 = 0;
480}