avr_device/devices/atmega4809/portmux/
tcaroutea.rs

1#[doc = "Register `TCAROUTEA` reader"]
2pub struct R(crate::R<TCAROUTEA_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TCAROUTEA_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TCAROUTEA_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TCAROUTEA_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TCAROUTEA` writer"]
17pub struct W(crate::W<TCAROUTEA_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TCAROUTEA_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<TCAROUTEA_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TCAROUTEA_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TCA0` reader - Port Multiplexer TCA0"]
38pub type TCA0_R = crate::FieldReader<u8, TCA0_A>;
39#[doc = "Port Multiplexer TCA0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum TCA0_A {
43    #[doc = "0: TCA0 pins on PA\\[5:0\\]"]
44    PORTA = 0,
45    #[doc = "1: TCA0 pins on PB\\[5:0\\]"]
46    PORTB = 1,
47    #[doc = "2: TCA0 pins on PC\\[5:0\\]"]
48    PORTC = 2,
49    #[doc = "3: TCA0 pins on PD\\[5:0\\]"]
50    PORTD = 3,
51    #[doc = "4: TCA0 pins on PE\\[5:0\\]"]
52    PORTE = 4,
53    #[doc = "5: TCA0 pins on PF\\[5:0\\]"]
54    PORTF = 5,
55}
56impl From<TCA0_A> for u8 {
57    #[inline(always)]
58    fn from(variant: TCA0_A) -> Self {
59        variant as _
60    }
61}
62impl TCA0_R {
63    #[doc = "Get enumerated values variant"]
64    #[inline(always)]
65    pub fn variant(&self) -> Option<TCA0_A> {
66        match self.bits {
67            0 => Some(TCA0_A::PORTA),
68            1 => Some(TCA0_A::PORTB),
69            2 => Some(TCA0_A::PORTC),
70            3 => Some(TCA0_A::PORTD),
71            4 => Some(TCA0_A::PORTE),
72            5 => Some(TCA0_A::PORTF),
73            _ => None,
74        }
75    }
76    #[doc = "Checks if the value of the field is `PORTA`"]
77    #[inline(always)]
78    pub fn is_porta(&self) -> bool {
79        *self == TCA0_A::PORTA
80    }
81    #[doc = "Checks if the value of the field is `PORTB`"]
82    #[inline(always)]
83    pub fn is_portb(&self) -> bool {
84        *self == TCA0_A::PORTB
85    }
86    #[doc = "Checks if the value of the field is `PORTC`"]
87    #[inline(always)]
88    pub fn is_portc(&self) -> bool {
89        *self == TCA0_A::PORTC
90    }
91    #[doc = "Checks if the value of the field is `PORTD`"]
92    #[inline(always)]
93    pub fn is_portd(&self) -> bool {
94        *self == TCA0_A::PORTD
95    }
96    #[doc = "Checks if the value of the field is `PORTE`"]
97    #[inline(always)]
98    pub fn is_porte(&self) -> bool {
99        *self == TCA0_A::PORTE
100    }
101    #[doc = "Checks if the value of the field is `PORTF`"]
102    #[inline(always)]
103    pub fn is_portf(&self) -> bool {
104        *self == TCA0_A::PORTF
105    }
106}
107#[doc = "Field `TCA0` writer - Port Multiplexer TCA0"]
108pub type TCA0_W<'a, const O: u8> = crate::FieldWriter<'a, u8, TCAROUTEA_SPEC, u8, TCA0_A, 3, O>;
109impl<'a, const O: u8> TCA0_W<'a, O> {
110    #[doc = "TCA0 pins on PA\\[5:0\\]"]
111    #[inline(always)]
112    pub fn porta(self) -> &'a mut W {
113        self.variant(TCA0_A::PORTA)
114    }
115    #[doc = "TCA0 pins on PB\\[5:0\\]"]
116    #[inline(always)]
117    pub fn portb(self) -> &'a mut W {
118        self.variant(TCA0_A::PORTB)
119    }
120    #[doc = "TCA0 pins on PC\\[5:0\\]"]
121    #[inline(always)]
122    pub fn portc(self) -> &'a mut W {
123        self.variant(TCA0_A::PORTC)
124    }
125    #[doc = "TCA0 pins on PD\\[5:0\\]"]
126    #[inline(always)]
127    pub fn portd(self) -> &'a mut W {
128        self.variant(TCA0_A::PORTD)
129    }
130    #[doc = "TCA0 pins on PE\\[5:0\\]"]
131    #[inline(always)]
132    pub fn porte(self) -> &'a mut W {
133        self.variant(TCA0_A::PORTE)
134    }
135    #[doc = "TCA0 pins on PF\\[5:0\\]"]
136    #[inline(always)]
137    pub fn portf(self) -> &'a mut W {
138        self.variant(TCA0_A::PORTF)
139    }
140}
141impl R {
142    #[doc = "Bits 0:2 - Port Multiplexer TCA0"]
143    #[inline(always)]
144    pub fn tca0(&self) -> TCA0_R {
145        TCA0_R::new(self.bits & 7)
146    }
147}
148impl W {
149    #[doc = "Bits 0:2 - Port Multiplexer TCA0"]
150    #[inline(always)]
151    #[must_use]
152    pub fn tca0(&mut self) -> TCA0_W<0> {
153        TCA0_W::new(self)
154    }
155    #[doc = "Writes raw bits to the register."]
156    #[inline(always)]
157    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
158        self.0.bits(bits);
159        self
160    }
161}
162#[doc = "Port Multiplexer TCA\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 [tcaroutea](index.html) module"]
163pub struct TCAROUTEA_SPEC;
164impl crate::RegisterSpec for TCAROUTEA_SPEC {
165    type Ux = u8;
166}
167#[doc = "`read()` method returns [tcaroutea::R](R) reader structure"]
168impl crate::Readable for TCAROUTEA_SPEC {
169    type Reader = R;
170}
171#[doc = "`write(|w| ..)` method takes [tcaroutea::W](W) writer structure"]
172impl crate::Writable for TCAROUTEA_SPEC {
173    type Writer = W;
174    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
175    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
176}
177#[doc = "`reset()` method sets TCAROUTEA to value 0"]
178impl crate::Resettable for TCAROUTEA_SPEC {
179    const RESET_VALUE: Self::Ux = 0;
180}