efm32g230_pac/usart2/
route.rs1#[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}
66impl From<LOCATION_A> for u8 {
67 #[inline(always)]
68 fn from(variant: LOCATION_A) -> Self {
69 variant as _
70 }
71}
72#[doc = "Field `LOCATION` reader - I/O Location"]
73pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
74impl LOCATION_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub fn variant(&self) -> LOCATION_A {
78 match self.bits {
79 0 => LOCATION_A::LOC0,
80 1 => LOCATION_A::LOC1,
81 2 => LOCATION_A::LOC2,
82 3 => LOCATION_A::LOC3,
83 _ => unreachable!(),
84 }
85 }
86 #[doc = "Checks if the value of the field is `LOC0`"]
87 #[inline(always)]
88 pub fn is_loc0(&self) -> bool {
89 *self == LOCATION_A::LOC0
90 }
91 #[doc = "Checks if the value of the field is `LOC1`"]
92 #[inline(always)]
93 pub fn is_loc1(&self) -> bool {
94 *self == LOCATION_A::LOC1
95 }
96 #[doc = "Checks if the value of the field is `LOC2`"]
97 #[inline(always)]
98 pub fn is_loc2(&self) -> bool {
99 *self == LOCATION_A::LOC2
100 }
101 #[doc = "Checks if the value of the field is `LOC3`"]
102 #[inline(always)]
103 pub fn is_loc3(&self) -> bool {
104 *self == LOCATION_A::LOC3
105 }
106}
107#[doc = "Field `LOCATION` writer - I/O Location"]
108pub type LOCATION_W<'a> = crate::FieldWriterSafe<'a, u32, ROUTE_SPEC, u8, LOCATION_A, 2, 8>;
109impl<'a> LOCATION_W<'a> {
110 #[doc = "Location 0"]
111 #[inline(always)]
112 pub fn loc0(self) -> &'a mut W {
113 self.variant(LOCATION_A::LOC0)
114 }
115 #[doc = "Location 1"]
116 #[inline(always)]
117 pub fn loc1(self) -> &'a mut W {
118 self.variant(LOCATION_A::LOC1)
119 }
120 #[doc = "Location 2"]
121 #[inline(always)]
122 pub fn loc2(self) -> &'a mut W {
123 self.variant(LOCATION_A::LOC2)
124 }
125 #[doc = "Location 3"]
126 #[inline(always)]
127 pub fn loc3(self) -> &'a mut W {
128 self.variant(LOCATION_A::LOC3)
129 }
130}
131impl R {
132 #[doc = "Bit 0 - RX Pin Enable"]
133 #[inline(always)]
134 pub fn rxpen(&self) -> RXPEN_R {
135 RXPEN_R::new((self.bits & 1) != 0)
136 }
137 #[doc = "Bit 1 - TX Pin Enable"]
138 #[inline(always)]
139 pub fn txpen(&self) -> TXPEN_R {
140 TXPEN_R::new(((self.bits >> 1) & 1) != 0)
141 }
142 #[doc = "Bit 2 - CS Pin Enable"]
143 #[inline(always)]
144 pub fn cspen(&self) -> CSPEN_R {
145 CSPEN_R::new(((self.bits >> 2) & 1) != 0)
146 }
147 #[doc = "Bit 3 - CLK Pin Enable"]
148 #[inline(always)]
149 pub fn clkpen(&self) -> CLKPEN_R {
150 CLKPEN_R::new(((self.bits >> 3) & 1) != 0)
151 }
152 #[doc = "Bits 8:9 - I/O Location"]
153 #[inline(always)]
154 pub fn location(&self) -> LOCATION_R {
155 LOCATION_R::new(((self.bits >> 8) & 3) as u8)
156 }
157}
158impl W {
159 #[doc = "Bit 0 - RX Pin Enable"]
160 #[inline(always)]
161 pub fn rxpen(&mut self) -> RXPEN_W {
162 RXPEN_W::new(self)
163 }
164 #[doc = "Bit 1 - TX Pin Enable"]
165 #[inline(always)]
166 pub fn txpen(&mut self) -> TXPEN_W {
167 TXPEN_W::new(self)
168 }
169 #[doc = "Bit 2 - CS Pin Enable"]
170 #[inline(always)]
171 pub fn cspen(&mut self) -> CSPEN_W {
172 CSPEN_W::new(self)
173 }
174 #[doc = "Bit 3 - CLK Pin Enable"]
175 #[inline(always)]
176 pub fn clkpen(&mut self) -> CLKPEN_W {
177 CLKPEN_W::new(self)
178 }
179 #[doc = "Bits 8:9 - I/O Location"]
180 #[inline(always)]
181 pub fn location(&mut self) -> LOCATION_W {
182 LOCATION_W::new(self)
183 }
184 #[doc = "Writes raw bits to the register."]
185 #[inline(always)]
186 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
187 self.0.bits(bits);
188 self
189 }
190}
191#[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"]
192pub struct ROUTE_SPEC;
193impl crate::RegisterSpec for ROUTE_SPEC {
194 type Ux = u32;
195}
196#[doc = "`read()` method returns [route::R](R) reader structure"]
197impl crate::Readable for ROUTE_SPEC {
198 type Reader = R;
199}
200#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
201impl crate::Writable for ROUTE_SPEC {
202 type Writer = W;
203}
204#[doc = "`reset()` method sets ROUTE to value 0"]
205impl crate::Resettable for ROUTE_SPEC {
206 #[inline(always)]
207 fn reset_value() -> Self::Ux {
208 0
209 }
210}