atsamd11c/port/
pmux0_.rs

1#[doc = "Register `PMUX0_%s` reader"]
2pub type R = crate::R<Pmux0_Spec>;
3#[doc = "Register `PMUX0_%s` writer"]
4pub type W = crate::W<Pmux0_Spec>;
5#[doc = "Peripheral Multiplexing Even\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}
26impl From<Pmuxeselect> for u8 {
27    #[inline(always)]
28    fn from(variant: Pmuxeselect) -> Self {
29        variant as _
30    }
31}
32impl crate::FieldSpec for Pmuxeselect {
33    type Ux = u8;
34}
35impl crate::IsEnum for Pmuxeselect {}
36#[doc = "Field `PMUXE` reader - Peripheral Multiplexing Even"]
37pub type PmuxeR = crate::FieldReader<Pmuxeselect>;
38impl PmuxeR {
39    #[doc = "Get enumerated values variant"]
40    #[inline(always)]
41    pub const fn variant(&self) -> Option<Pmuxeselect> {
42        match self.bits {
43            0 => Some(Pmuxeselect::A),
44            1 => Some(Pmuxeselect::B),
45            2 => Some(Pmuxeselect::C),
46            3 => Some(Pmuxeselect::D),
47            4 => Some(Pmuxeselect::E),
48            5 => Some(Pmuxeselect::F),
49            6 => Some(Pmuxeselect::G),
50            7 => Some(Pmuxeselect::H),
51            _ => None,
52        }
53    }
54    #[doc = "Peripheral function A selected"]
55    #[inline(always)]
56    pub fn is_a(&self) -> bool {
57        *self == Pmuxeselect::A
58    }
59    #[doc = "Peripheral function B selected"]
60    #[inline(always)]
61    pub fn is_b(&self) -> bool {
62        *self == Pmuxeselect::B
63    }
64    #[doc = "Peripheral function C selected"]
65    #[inline(always)]
66    pub fn is_c(&self) -> bool {
67        *self == Pmuxeselect::C
68    }
69    #[doc = "Peripheral function D selected"]
70    #[inline(always)]
71    pub fn is_d(&self) -> bool {
72        *self == Pmuxeselect::D
73    }
74    #[doc = "Peripheral function E selected"]
75    #[inline(always)]
76    pub fn is_e(&self) -> bool {
77        *self == Pmuxeselect::E
78    }
79    #[doc = "Peripheral function F selected"]
80    #[inline(always)]
81    pub fn is_f(&self) -> bool {
82        *self == Pmuxeselect::F
83    }
84    #[doc = "Peripheral function G selected"]
85    #[inline(always)]
86    pub fn is_g(&self) -> bool {
87        *self == Pmuxeselect::G
88    }
89    #[doc = "Peripheral function H selected"]
90    #[inline(always)]
91    pub fn is_h(&self) -> bool {
92        *self == Pmuxeselect::H
93    }
94}
95#[doc = "Field `PMUXE` writer - Peripheral Multiplexing Even"]
96pub type PmuxeW<'a, REG> = crate::FieldWriter<'a, REG, 4, Pmuxeselect>;
97impl<'a, REG> PmuxeW<'a, REG>
98where
99    REG: crate::Writable + crate::RegisterSpec,
100    REG::Ux: From<u8>,
101{
102    #[doc = "Peripheral function A selected"]
103    #[inline(always)]
104    pub fn a(self) -> &'a mut crate::W<REG> {
105        self.variant(Pmuxeselect::A)
106    }
107    #[doc = "Peripheral function B selected"]
108    #[inline(always)]
109    pub fn b(self) -> &'a mut crate::W<REG> {
110        self.variant(Pmuxeselect::B)
111    }
112    #[doc = "Peripheral function C selected"]
113    #[inline(always)]
114    pub fn c(self) -> &'a mut crate::W<REG> {
115        self.variant(Pmuxeselect::C)
116    }
117    #[doc = "Peripheral function D selected"]
118    #[inline(always)]
119    pub fn d(self) -> &'a mut crate::W<REG> {
120        self.variant(Pmuxeselect::D)
121    }
122    #[doc = "Peripheral function E selected"]
123    #[inline(always)]
124    pub fn e(self) -> &'a mut crate::W<REG> {
125        self.variant(Pmuxeselect::E)
126    }
127    #[doc = "Peripheral function F selected"]
128    #[inline(always)]
129    pub fn f(self) -> &'a mut crate::W<REG> {
130        self.variant(Pmuxeselect::F)
131    }
132    #[doc = "Peripheral function G selected"]
133    #[inline(always)]
134    pub fn g(self) -> &'a mut crate::W<REG> {
135        self.variant(Pmuxeselect::G)
136    }
137    #[doc = "Peripheral function H selected"]
138    #[inline(always)]
139    pub fn h(self) -> &'a mut crate::W<REG> {
140        self.variant(Pmuxeselect::H)
141    }
142}
143#[doc = "Peripheral Multiplexing Odd\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145#[repr(u8)]
146pub enum Pmuxoselect {
147    #[doc = "0: Peripheral function A selected"]
148    A = 0,
149    #[doc = "1: Peripheral function B selected"]
150    B = 1,
151    #[doc = "2: Peripheral function C selected"]
152    C = 2,
153    #[doc = "3: Peripheral function D selected"]
154    D = 3,
155    #[doc = "4: Peripheral function E selected"]
156    E = 4,
157    #[doc = "5: Peripheral function F selected"]
158    F = 5,
159    #[doc = "6: Peripheral function G selected"]
160    G = 6,
161    #[doc = "7: Peripheral function H selected"]
162    H = 7,
163}
164impl From<Pmuxoselect> for u8 {
165    #[inline(always)]
166    fn from(variant: Pmuxoselect) -> Self {
167        variant as _
168    }
169}
170impl crate::FieldSpec for Pmuxoselect {
171    type Ux = u8;
172}
173impl crate::IsEnum for Pmuxoselect {}
174#[doc = "Field `PMUXO` reader - Peripheral Multiplexing Odd"]
175pub type PmuxoR = crate::FieldReader<Pmuxoselect>;
176impl PmuxoR {
177    #[doc = "Get enumerated values variant"]
178    #[inline(always)]
179    pub const fn variant(&self) -> Option<Pmuxoselect> {
180        match self.bits {
181            0 => Some(Pmuxoselect::A),
182            1 => Some(Pmuxoselect::B),
183            2 => Some(Pmuxoselect::C),
184            3 => Some(Pmuxoselect::D),
185            4 => Some(Pmuxoselect::E),
186            5 => Some(Pmuxoselect::F),
187            6 => Some(Pmuxoselect::G),
188            7 => Some(Pmuxoselect::H),
189            _ => None,
190        }
191    }
192    #[doc = "Peripheral function A selected"]
193    #[inline(always)]
194    pub fn is_a(&self) -> bool {
195        *self == Pmuxoselect::A
196    }
197    #[doc = "Peripheral function B selected"]
198    #[inline(always)]
199    pub fn is_b(&self) -> bool {
200        *self == Pmuxoselect::B
201    }
202    #[doc = "Peripheral function C selected"]
203    #[inline(always)]
204    pub fn is_c(&self) -> bool {
205        *self == Pmuxoselect::C
206    }
207    #[doc = "Peripheral function D selected"]
208    #[inline(always)]
209    pub fn is_d(&self) -> bool {
210        *self == Pmuxoselect::D
211    }
212    #[doc = "Peripheral function E selected"]
213    #[inline(always)]
214    pub fn is_e(&self) -> bool {
215        *self == Pmuxoselect::E
216    }
217    #[doc = "Peripheral function F selected"]
218    #[inline(always)]
219    pub fn is_f(&self) -> bool {
220        *self == Pmuxoselect::F
221    }
222    #[doc = "Peripheral function G selected"]
223    #[inline(always)]
224    pub fn is_g(&self) -> bool {
225        *self == Pmuxoselect::G
226    }
227    #[doc = "Peripheral function H selected"]
228    #[inline(always)]
229    pub fn is_h(&self) -> bool {
230        *self == Pmuxoselect::H
231    }
232}
233#[doc = "Field `PMUXO` writer - Peripheral Multiplexing Odd"]
234pub type PmuxoW<'a, REG> = crate::FieldWriter<'a, REG, 4, Pmuxoselect>;
235impl<'a, REG> PmuxoW<'a, REG>
236where
237    REG: crate::Writable + crate::RegisterSpec,
238    REG::Ux: From<u8>,
239{
240    #[doc = "Peripheral function A selected"]
241    #[inline(always)]
242    pub fn a(self) -> &'a mut crate::W<REG> {
243        self.variant(Pmuxoselect::A)
244    }
245    #[doc = "Peripheral function B selected"]
246    #[inline(always)]
247    pub fn b(self) -> &'a mut crate::W<REG> {
248        self.variant(Pmuxoselect::B)
249    }
250    #[doc = "Peripheral function C selected"]
251    #[inline(always)]
252    pub fn c(self) -> &'a mut crate::W<REG> {
253        self.variant(Pmuxoselect::C)
254    }
255    #[doc = "Peripheral function D selected"]
256    #[inline(always)]
257    pub fn d(self) -> &'a mut crate::W<REG> {
258        self.variant(Pmuxoselect::D)
259    }
260    #[doc = "Peripheral function E selected"]
261    #[inline(always)]
262    pub fn e(self) -> &'a mut crate::W<REG> {
263        self.variant(Pmuxoselect::E)
264    }
265    #[doc = "Peripheral function F selected"]
266    #[inline(always)]
267    pub fn f(self) -> &'a mut crate::W<REG> {
268        self.variant(Pmuxoselect::F)
269    }
270    #[doc = "Peripheral function G selected"]
271    #[inline(always)]
272    pub fn g(self) -> &'a mut crate::W<REG> {
273        self.variant(Pmuxoselect::G)
274    }
275    #[doc = "Peripheral function H selected"]
276    #[inline(always)]
277    pub fn h(self) -> &'a mut crate::W<REG> {
278        self.variant(Pmuxoselect::H)
279    }
280}
281impl R {
282    #[doc = "Bits 0:3 - Peripheral Multiplexing Even"]
283    #[inline(always)]
284    pub fn pmuxe(&self) -> PmuxeR {
285        PmuxeR::new(self.bits & 0x0f)
286    }
287    #[doc = "Bits 4:7 - Peripheral Multiplexing Odd"]
288    #[inline(always)]
289    pub fn pmuxo(&self) -> PmuxoR {
290        PmuxoR::new((self.bits >> 4) & 0x0f)
291    }
292}
293impl W {
294    #[doc = "Bits 0:3 - Peripheral Multiplexing Even"]
295    #[inline(always)]
296    #[must_use]
297    pub fn pmuxe(&mut self) -> PmuxeW<Pmux0_Spec> {
298        PmuxeW::new(self, 0)
299    }
300    #[doc = "Bits 4:7 - Peripheral Multiplexing Odd"]
301    #[inline(always)]
302    #[must_use]
303    pub fn pmuxo(&mut self) -> PmuxoW<Pmux0_Spec> {
304        PmuxoW::new(self, 4)
305    }
306}
307#[doc = "Peripheral Multiplexing n - Group 0\n\nYou can [`read`](crate::Reg::read) this register and get [`pmux0_::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pmux0_::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
308pub struct Pmux0_Spec;
309impl crate::RegisterSpec for Pmux0_Spec {
310    type Ux = u8;
311}
312#[doc = "`read()` method returns [`pmux0_::R`](R) reader structure"]
313impl crate::Readable for Pmux0_Spec {}
314#[doc = "`write(|w| ..)` method takes [`pmux0_::W`](W) writer structure"]
315impl crate::Writable for Pmux0_Spec {
316    type Safety = crate::Unsafe;
317    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
318    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
319}
320#[doc = "`reset()` method sets PMUX0_%s to value 0"]
321impl crate::Resettable for Pmux0_Spec {
322    const RESET_VALUE: u8 = 0;
323}