avr_device/devices/atmega4809/portmux/
usartroutea.rs

1#[doc = "Register `USARTROUTEA` reader"]
2pub struct R(crate::R<USARTROUTEA_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<USARTROUTEA_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<USARTROUTEA_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<USARTROUTEA_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `USARTROUTEA` writer"]
17pub struct W(crate::W<USARTROUTEA_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<USARTROUTEA_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<USARTROUTEA_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<USARTROUTEA_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `USART0` reader - Port Multiplexer USART0"]
38pub type USART0_R = crate::FieldReader<u8, USART0_A>;
39#[doc = "Port Multiplexer USART0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum USART0_A {
43    #[doc = "0: USART0 on PA\\[3:0\\]"]
44    DEFAULT = 0,
45    #[doc = "1: USART0 on PA\\[7:4\\]"]
46    ALT1 = 1,
47    #[doc = "3: Not connected to any pins"]
48    NONE = 3,
49}
50impl From<USART0_A> for u8 {
51    #[inline(always)]
52    fn from(variant: USART0_A) -> Self {
53        variant as _
54    }
55}
56impl USART0_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<USART0_A> {
60        match self.bits {
61            0 => Some(USART0_A::DEFAULT),
62            1 => Some(USART0_A::ALT1),
63            3 => Some(USART0_A::NONE),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `DEFAULT`"]
68    #[inline(always)]
69    pub fn is_default(&self) -> bool {
70        *self == USART0_A::DEFAULT
71    }
72    #[doc = "Checks if the value of the field is `ALT1`"]
73    #[inline(always)]
74    pub fn is_alt1(&self) -> bool {
75        *self == USART0_A::ALT1
76    }
77    #[doc = "Checks if the value of the field is `NONE`"]
78    #[inline(always)]
79    pub fn is_none(&self) -> bool {
80        *self == USART0_A::NONE
81    }
82}
83#[doc = "Field `USART0` writer - Port Multiplexer USART0"]
84pub type USART0_W<'a, const O: u8> =
85    crate::FieldWriter<'a, u8, USARTROUTEA_SPEC, u8, USART0_A, 2, O>;
86impl<'a, const O: u8> USART0_W<'a, O> {
87    #[doc = "USART0 on PA\\[3:0\\]"]
88    #[inline(always)]
89    pub fn default(self) -> &'a mut W {
90        self.variant(USART0_A::DEFAULT)
91    }
92    #[doc = "USART0 on PA\\[7:4\\]"]
93    #[inline(always)]
94    pub fn alt1(self) -> &'a mut W {
95        self.variant(USART0_A::ALT1)
96    }
97    #[doc = "Not connected to any pins"]
98    #[inline(always)]
99    pub fn none(self) -> &'a mut W {
100        self.variant(USART0_A::NONE)
101    }
102}
103#[doc = "Field `USART1` reader - Port Multiplexer USART1"]
104pub type USART1_R = crate::FieldReader<u8, USART1_A>;
105#[doc = "Port Multiplexer USART1\n\nValue on reset: 0"]
106#[derive(Clone, Copy, Debug, PartialEq, Eq)]
107#[repr(u8)]
108pub enum USART1_A {
109    #[doc = "0: USART1 on PC\\[3:0\\]"]
110    DEFAULT = 0,
111    #[doc = "1: USART1 on PC\\[7:4\\]"]
112    ALT1 = 1,
113    #[doc = "3: Not connected to any pins"]
114    NONE = 3,
115}
116impl From<USART1_A> for u8 {
117    #[inline(always)]
118    fn from(variant: USART1_A) -> Self {
119        variant as _
120    }
121}
122impl USART1_R {
123    #[doc = "Get enumerated values variant"]
124    #[inline(always)]
125    pub fn variant(&self) -> Option<USART1_A> {
126        match self.bits {
127            0 => Some(USART1_A::DEFAULT),
128            1 => Some(USART1_A::ALT1),
129            3 => Some(USART1_A::NONE),
130            _ => None,
131        }
132    }
133    #[doc = "Checks if the value of the field is `DEFAULT`"]
134    #[inline(always)]
135    pub fn is_default(&self) -> bool {
136        *self == USART1_A::DEFAULT
137    }
138    #[doc = "Checks if the value of the field is `ALT1`"]
139    #[inline(always)]
140    pub fn is_alt1(&self) -> bool {
141        *self == USART1_A::ALT1
142    }
143    #[doc = "Checks if the value of the field is `NONE`"]
144    #[inline(always)]
145    pub fn is_none(&self) -> bool {
146        *self == USART1_A::NONE
147    }
148}
149#[doc = "Field `USART1` writer - Port Multiplexer USART1"]
150pub type USART1_W<'a, const O: u8> =
151    crate::FieldWriter<'a, u8, USARTROUTEA_SPEC, u8, USART1_A, 2, O>;
152impl<'a, const O: u8> USART1_W<'a, O> {
153    #[doc = "USART1 on PC\\[3:0\\]"]
154    #[inline(always)]
155    pub fn default(self) -> &'a mut W {
156        self.variant(USART1_A::DEFAULT)
157    }
158    #[doc = "USART1 on PC\\[7:4\\]"]
159    #[inline(always)]
160    pub fn alt1(self) -> &'a mut W {
161        self.variant(USART1_A::ALT1)
162    }
163    #[doc = "Not connected to any pins"]
164    #[inline(always)]
165    pub fn none(self) -> &'a mut W {
166        self.variant(USART1_A::NONE)
167    }
168}
169#[doc = "Field `USART2` reader - Port Multiplexer USART2"]
170pub type USART2_R = crate::FieldReader<u8, USART2_A>;
171#[doc = "Port Multiplexer USART2\n\nValue on reset: 0"]
172#[derive(Clone, Copy, Debug, PartialEq, Eq)]
173#[repr(u8)]
174pub enum USART2_A {
175    #[doc = "0: USART2 on PF\\[3:0\\]"]
176    DEFAULT = 0,
177    #[doc = "1: USART2 on PF\\[6:4\\]"]
178    ALT1 = 1,
179    #[doc = "3: Not connected to any pins"]
180    NONE = 3,
181}
182impl From<USART2_A> for u8 {
183    #[inline(always)]
184    fn from(variant: USART2_A) -> Self {
185        variant as _
186    }
187}
188impl USART2_R {
189    #[doc = "Get enumerated values variant"]
190    #[inline(always)]
191    pub fn variant(&self) -> Option<USART2_A> {
192        match self.bits {
193            0 => Some(USART2_A::DEFAULT),
194            1 => Some(USART2_A::ALT1),
195            3 => Some(USART2_A::NONE),
196            _ => None,
197        }
198    }
199    #[doc = "Checks if the value of the field is `DEFAULT`"]
200    #[inline(always)]
201    pub fn is_default(&self) -> bool {
202        *self == USART2_A::DEFAULT
203    }
204    #[doc = "Checks if the value of the field is `ALT1`"]
205    #[inline(always)]
206    pub fn is_alt1(&self) -> bool {
207        *self == USART2_A::ALT1
208    }
209    #[doc = "Checks if the value of the field is `NONE`"]
210    #[inline(always)]
211    pub fn is_none(&self) -> bool {
212        *self == USART2_A::NONE
213    }
214}
215#[doc = "Field `USART2` writer - Port Multiplexer USART2"]
216pub type USART2_W<'a, const O: u8> =
217    crate::FieldWriter<'a, u8, USARTROUTEA_SPEC, u8, USART2_A, 2, O>;
218impl<'a, const O: u8> USART2_W<'a, O> {
219    #[doc = "USART2 on PF\\[3:0\\]"]
220    #[inline(always)]
221    pub fn default(self) -> &'a mut W {
222        self.variant(USART2_A::DEFAULT)
223    }
224    #[doc = "USART2 on PF\\[6:4\\]"]
225    #[inline(always)]
226    pub fn alt1(self) -> &'a mut W {
227        self.variant(USART2_A::ALT1)
228    }
229    #[doc = "Not connected to any pins"]
230    #[inline(always)]
231    pub fn none(self) -> &'a mut W {
232        self.variant(USART2_A::NONE)
233    }
234}
235#[doc = "Field `USART3` reader - Port Multiplexer USART3"]
236pub type USART3_R = crate::FieldReader<u8, USART3_A>;
237#[doc = "Port Multiplexer USART3\n\nValue on reset: 0"]
238#[derive(Clone, Copy, Debug, PartialEq, Eq)]
239#[repr(u8)]
240pub enum USART3_A {
241    #[doc = "0: USART3 on PB\\[3:0\\]"]
242    DEFAULT = 0,
243    #[doc = "1: USART3 on PB\\[5:4\\]"]
244    ALT1 = 1,
245    #[doc = "3: Not connected to any pins"]
246    NONE = 3,
247}
248impl From<USART3_A> for u8 {
249    #[inline(always)]
250    fn from(variant: USART3_A) -> Self {
251        variant as _
252    }
253}
254impl USART3_R {
255    #[doc = "Get enumerated values variant"]
256    #[inline(always)]
257    pub fn variant(&self) -> Option<USART3_A> {
258        match self.bits {
259            0 => Some(USART3_A::DEFAULT),
260            1 => Some(USART3_A::ALT1),
261            3 => Some(USART3_A::NONE),
262            _ => None,
263        }
264    }
265    #[doc = "Checks if the value of the field is `DEFAULT`"]
266    #[inline(always)]
267    pub fn is_default(&self) -> bool {
268        *self == USART3_A::DEFAULT
269    }
270    #[doc = "Checks if the value of the field is `ALT1`"]
271    #[inline(always)]
272    pub fn is_alt1(&self) -> bool {
273        *self == USART3_A::ALT1
274    }
275    #[doc = "Checks if the value of the field is `NONE`"]
276    #[inline(always)]
277    pub fn is_none(&self) -> bool {
278        *self == USART3_A::NONE
279    }
280}
281#[doc = "Field `USART3` writer - Port Multiplexer USART3"]
282pub type USART3_W<'a, const O: u8> =
283    crate::FieldWriter<'a, u8, USARTROUTEA_SPEC, u8, USART3_A, 2, O>;
284impl<'a, const O: u8> USART3_W<'a, O> {
285    #[doc = "USART3 on PB\\[3:0\\]"]
286    #[inline(always)]
287    pub fn default(self) -> &'a mut W {
288        self.variant(USART3_A::DEFAULT)
289    }
290    #[doc = "USART3 on PB\\[5:4\\]"]
291    #[inline(always)]
292    pub fn alt1(self) -> &'a mut W {
293        self.variant(USART3_A::ALT1)
294    }
295    #[doc = "Not connected to any pins"]
296    #[inline(always)]
297    pub fn none(self) -> &'a mut W {
298        self.variant(USART3_A::NONE)
299    }
300}
301impl R {
302    #[doc = "Bits 0:1 - Port Multiplexer USART0"]
303    #[inline(always)]
304    pub fn usart0(&self) -> USART0_R {
305        USART0_R::new(self.bits & 3)
306    }
307    #[doc = "Bits 2:3 - Port Multiplexer USART1"]
308    #[inline(always)]
309    pub fn usart1(&self) -> USART1_R {
310        USART1_R::new((self.bits >> 2) & 3)
311    }
312    #[doc = "Bits 4:5 - Port Multiplexer USART2"]
313    #[inline(always)]
314    pub fn usart2(&self) -> USART2_R {
315        USART2_R::new((self.bits >> 4) & 3)
316    }
317    #[doc = "Bits 6:7 - Port Multiplexer USART3"]
318    #[inline(always)]
319    pub fn usart3(&self) -> USART3_R {
320        USART3_R::new((self.bits >> 6) & 3)
321    }
322}
323impl W {
324    #[doc = "Bits 0:1 - Port Multiplexer USART0"]
325    #[inline(always)]
326    #[must_use]
327    pub fn usart0(&mut self) -> USART0_W<0> {
328        USART0_W::new(self)
329    }
330    #[doc = "Bits 2:3 - Port Multiplexer USART1"]
331    #[inline(always)]
332    #[must_use]
333    pub fn usart1(&mut self) -> USART1_W<2> {
334        USART1_W::new(self)
335    }
336    #[doc = "Bits 4:5 - Port Multiplexer USART2"]
337    #[inline(always)]
338    #[must_use]
339    pub fn usart2(&mut self) -> USART2_W<4> {
340        USART2_W::new(self)
341    }
342    #[doc = "Bits 6:7 - Port Multiplexer USART3"]
343    #[inline(always)]
344    #[must_use]
345    pub fn usart3(&mut self) -> USART3_W<6> {
346        USART3_W::new(self)
347    }
348    #[doc = "Writes raw bits to the register."]
349    #[inline(always)]
350    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
351        self.0.bits(bits);
352        self
353    }
354}
355#[doc = "Port Multiplexer USART register A\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 [usartroutea](index.html) module"]
356pub struct USARTROUTEA_SPEC;
357impl crate::RegisterSpec for USARTROUTEA_SPEC {
358    type Ux = u8;
359}
360#[doc = "`read()` method returns [usartroutea::R](R) reader structure"]
361impl crate::Readable for USARTROUTEA_SPEC {
362    type Reader = R;
363}
364#[doc = "`write(|w| ..)` method takes [usartroutea::W](W) writer structure"]
365impl crate::Writable for USARTROUTEA_SPEC {
366    type Writer = W;
367    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
368    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
369}
370#[doc = "`reset()` method sets USARTROUTEA to value 0"]
371impl crate::Resettable for USARTROUTEA_SPEC {
372    const RESET_VALUE: Self::Ux = 0;
373}