efm32hg310_pac/usart1/
route.rs

1#[doc = "Register `ROUTE` reader"]
2pub struct R(crate::R<ROUTE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ROUTE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ROUTE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ROUTE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ROUTE` writer"]
17pub struct W(crate::W<ROUTE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ROUTE_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<ROUTE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ROUTE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RXPEN` reader - RX Pin Enable"]
38pub type RXPEN_R = crate::BitReader<bool>;
39#[doc = "Field `RXPEN` writer - RX Pin Enable"]
40pub type RXPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 0>;
41#[doc = "Field `TXPEN` reader - TX Pin Enable"]
42pub type TXPEN_R = crate::BitReader<bool>;
43#[doc = "Field `TXPEN` writer - TX Pin Enable"]
44pub type TXPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 1>;
45#[doc = "Field `CSPEN` reader - CS Pin Enable"]
46pub type CSPEN_R = crate::BitReader<bool>;
47#[doc = "Field `CSPEN` writer - CS Pin Enable"]
48pub type CSPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 2>;
49#[doc = "Field `CLKPEN` reader - CLK Pin Enable"]
50pub type CLKPEN_R = crate::BitReader<bool>;
51#[doc = "Field `CLKPEN` writer - CLK Pin Enable"]
52pub type CLKPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 3>;
53#[doc = "I/O Location\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq)]
55#[repr(u8)]
56pub enum LOCATION_A {
57    #[doc = "0: Location 0"]
58    LOC0 = 0,
59    #[doc = "1: Location 1"]
60    LOC1 = 1,
61    #[doc = "2: Location 2"]
62    LOC2 = 2,
63    #[doc = "3: Location 3"]
64    LOC3 = 3,
65    #[doc = "4: Location 4"]
66    LOC4 = 4,
67    #[doc = "5: Location 5"]
68    LOC5 = 5,
69    #[doc = "6: Location 6"]
70    LOC6 = 6,
71}
72impl From<LOCATION_A> for u8 {
73    #[inline(always)]
74    fn from(variant: LOCATION_A) -> Self {
75        variant as _
76    }
77}
78#[doc = "Field `LOCATION` reader - I/O Location"]
79pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
80impl LOCATION_R {
81    #[doc = "Get enumerated values variant"]
82    #[inline(always)]
83    pub fn variant(&self) -> Option<LOCATION_A> {
84        match self.bits {
85            0 => Some(LOCATION_A::LOC0),
86            1 => Some(LOCATION_A::LOC1),
87            2 => Some(LOCATION_A::LOC2),
88            3 => Some(LOCATION_A::LOC3),
89            4 => Some(LOCATION_A::LOC4),
90            5 => Some(LOCATION_A::LOC5),
91            6 => Some(LOCATION_A::LOC6),
92            _ => None,
93        }
94    }
95    #[doc = "Checks if the value of the field is `LOC0`"]
96    #[inline(always)]
97    pub fn is_loc0(&self) -> bool {
98        *self == LOCATION_A::LOC0
99    }
100    #[doc = "Checks if the value of the field is `LOC1`"]
101    #[inline(always)]
102    pub fn is_loc1(&self) -> bool {
103        *self == LOCATION_A::LOC1
104    }
105    #[doc = "Checks if the value of the field is `LOC2`"]
106    #[inline(always)]
107    pub fn is_loc2(&self) -> bool {
108        *self == LOCATION_A::LOC2
109    }
110    #[doc = "Checks if the value of the field is `LOC3`"]
111    #[inline(always)]
112    pub fn is_loc3(&self) -> bool {
113        *self == LOCATION_A::LOC3
114    }
115    #[doc = "Checks if the value of the field is `LOC4`"]
116    #[inline(always)]
117    pub fn is_loc4(&self) -> bool {
118        *self == LOCATION_A::LOC4
119    }
120    #[doc = "Checks if the value of the field is `LOC5`"]
121    #[inline(always)]
122    pub fn is_loc5(&self) -> bool {
123        *self == LOCATION_A::LOC5
124    }
125    #[doc = "Checks if the value of the field is `LOC6`"]
126    #[inline(always)]
127    pub fn is_loc6(&self) -> bool {
128        *self == LOCATION_A::LOC6
129    }
130}
131#[doc = "Field `LOCATION` writer - I/O Location"]
132pub type LOCATION_W<'a> = crate::FieldWriter<'a, u32, ROUTE_SPEC, u8, LOCATION_A, 3, 8>;
133impl<'a> LOCATION_W<'a> {
134    #[doc = "Location 0"]
135    #[inline(always)]
136    pub fn loc0(self) -> &'a mut W {
137        self.variant(LOCATION_A::LOC0)
138    }
139    #[doc = "Location 1"]
140    #[inline(always)]
141    pub fn loc1(self) -> &'a mut W {
142        self.variant(LOCATION_A::LOC1)
143    }
144    #[doc = "Location 2"]
145    #[inline(always)]
146    pub fn loc2(self) -> &'a mut W {
147        self.variant(LOCATION_A::LOC2)
148    }
149    #[doc = "Location 3"]
150    #[inline(always)]
151    pub fn loc3(self) -> &'a mut W {
152        self.variant(LOCATION_A::LOC3)
153    }
154    #[doc = "Location 4"]
155    #[inline(always)]
156    pub fn loc4(self) -> &'a mut W {
157        self.variant(LOCATION_A::LOC4)
158    }
159    #[doc = "Location 5"]
160    #[inline(always)]
161    pub fn loc5(self) -> &'a mut W {
162        self.variant(LOCATION_A::LOC5)
163    }
164    #[doc = "Location 6"]
165    #[inline(always)]
166    pub fn loc6(self) -> &'a mut W {
167        self.variant(LOCATION_A::LOC6)
168    }
169}
170impl R {
171    #[doc = "Bit 0 - RX Pin Enable"]
172    #[inline(always)]
173    pub fn rxpen(&self) -> RXPEN_R {
174        RXPEN_R::new((self.bits & 1) != 0)
175    }
176    #[doc = "Bit 1 - TX Pin Enable"]
177    #[inline(always)]
178    pub fn txpen(&self) -> TXPEN_R {
179        TXPEN_R::new(((self.bits >> 1) & 1) != 0)
180    }
181    #[doc = "Bit 2 - CS Pin Enable"]
182    #[inline(always)]
183    pub fn cspen(&self) -> CSPEN_R {
184        CSPEN_R::new(((self.bits >> 2) & 1) != 0)
185    }
186    #[doc = "Bit 3 - CLK Pin Enable"]
187    #[inline(always)]
188    pub fn clkpen(&self) -> CLKPEN_R {
189        CLKPEN_R::new(((self.bits >> 3) & 1) != 0)
190    }
191    #[doc = "Bits 8:10 - I/O Location"]
192    #[inline(always)]
193    pub fn location(&self) -> LOCATION_R {
194        LOCATION_R::new(((self.bits >> 8) & 7) as u8)
195    }
196}
197impl W {
198    #[doc = "Bit 0 - RX Pin Enable"]
199    #[inline(always)]
200    pub fn rxpen(&mut self) -> RXPEN_W {
201        RXPEN_W::new(self)
202    }
203    #[doc = "Bit 1 - TX Pin Enable"]
204    #[inline(always)]
205    pub fn txpen(&mut self) -> TXPEN_W {
206        TXPEN_W::new(self)
207    }
208    #[doc = "Bit 2 - CS Pin Enable"]
209    #[inline(always)]
210    pub fn cspen(&mut self) -> CSPEN_W {
211        CSPEN_W::new(self)
212    }
213    #[doc = "Bit 3 - CLK Pin Enable"]
214    #[inline(always)]
215    pub fn clkpen(&mut self) -> CLKPEN_W {
216        CLKPEN_W::new(self)
217    }
218    #[doc = "Bits 8:10 - I/O Location"]
219    #[inline(always)]
220    pub fn location(&mut self) -> LOCATION_W {
221        LOCATION_W::new(self)
222    }
223    #[doc = "Writes raw bits to the register."]
224    #[inline(always)]
225    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
226        self.0.bits(bits);
227        self
228    }
229}
230#[doc = "I/O Routing Register\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 [route](index.html) module"]
231pub struct ROUTE_SPEC;
232impl crate::RegisterSpec for ROUTE_SPEC {
233    type Ux = u32;
234}
235#[doc = "`read()` method returns [route::R](R) reader structure"]
236impl crate::Readable for ROUTE_SPEC {
237    type Reader = R;
238}
239#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
240impl crate::Writable for ROUTE_SPEC {
241    type Writer = W;
242}
243#[doc = "`reset()` method sets ROUTE to value 0"]
244impl crate::Resettable for ROUTE_SPEC {
245    #[inline(always)]
246    fn reset_value() -> Self::Ux {
247        0
248    }
249}