bl616_pac/glb/
uart_signal_0.rs1#[doc = "Register `uart_signal_0` reader"]
2pub struct R(crate::R<UART_SIGNAL_0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<UART_SIGNAL_0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<UART_SIGNAL_0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<UART_SIGNAL_0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `uart_signal_0` writer"]
17pub struct W(crate::W<UART_SIGNAL_0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<UART_SIGNAL_0_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<UART_SIGNAL_0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<UART_SIGNAL_0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `function_0[0-7]` reader - Select peripheral function for UART signal %s"]
38pub type FUNCTION_0_R = crate::FieldReader<u8, FUNCTION_A>;
39#[doc = "Select peripheral function for UART signal %s\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum FUNCTION_A {
43 #[doc = "0: UART0 Request-to-Send flow control"]
44 UART0_RTS = 0,
45 #[doc = "1: UART0 Clear-to-Send flow control"]
46 UART0_CTS = 1,
47 #[doc = "2: UART0 transmit data"]
48 UART0_TXD = 2,
49 #[doc = "3: UART0 receive data"]
50 UART0_RXD = 3,
51 #[doc = "4: UART1 Request-to-Send flow control"]
52 UART1_RTS = 4,
53 #[doc = "5: UART1 Clear-to-Send flow control"]
54 UART1_CTS = 5,
55 #[doc = "6: UART1 transmit data"]
56 UART1_TXD = 6,
57 #[doc = "7: UART1 receive data"]
58 UART1_RXD = 7,
59}
60impl From<FUNCTION_A> for u8 {
61 #[inline(always)]
62 fn from(variant: FUNCTION_A) -> Self {
63 variant as _
64 }
65}
66impl FUNCTION_0_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> Option<FUNCTION_A> {
70 match self.bits {
71 0 => Some(FUNCTION_A::UART0_RTS),
72 1 => Some(FUNCTION_A::UART0_CTS),
73 2 => Some(FUNCTION_A::UART0_TXD),
74 3 => Some(FUNCTION_A::UART0_RXD),
75 4 => Some(FUNCTION_A::UART1_RTS),
76 5 => Some(FUNCTION_A::UART1_CTS),
77 6 => Some(FUNCTION_A::UART1_TXD),
78 7 => Some(FUNCTION_A::UART1_RXD),
79 _ => None,
80 }
81 }
82 #[doc = "Checks if the value of the field is `UART0_RTS`"]
83 #[inline(always)]
84 pub fn is_uart0_rts(&self) -> bool {
85 *self == FUNCTION_A::UART0_RTS
86 }
87 #[doc = "Checks if the value of the field is `UART0_CTS`"]
88 #[inline(always)]
89 pub fn is_uart0_cts(&self) -> bool {
90 *self == FUNCTION_A::UART0_CTS
91 }
92 #[doc = "Checks if the value of the field is `UART0_TXD`"]
93 #[inline(always)]
94 pub fn is_uart0_txd(&self) -> bool {
95 *self == FUNCTION_A::UART0_TXD
96 }
97 #[doc = "Checks if the value of the field is `UART0_RXD`"]
98 #[inline(always)]
99 pub fn is_uart0_rxd(&self) -> bool {
100 *self == FUNCTION_A::UART0_RXD
101 }
102 #[doc = "Checks if the value of the field is `UART1_RTS`"]
103 #[inline(always)]
104 pub fn is_uart1_rts(&self) -> bool {
105 *self == FUNCTION_A::UART1_RTS
106 }
107 #[doc = "Checks if the value of the field is `UART1_CTS`"]
108 #[inline(always)]
109 pub fn is_uart1_cts(&self) -> bool {
110 *self == FUNCTION_A::UART1_CTS
111 }
112 #[doc = "Checks if the value of the field is `UART1_TXD`"]
113 #[inline(always)]
114 pub fn is_uart1_txd(&self) -> bool {
115 *self == FUNCTION_A::UART1_TXD
116 }
117 #[doc = "Checks if the value of the field is `UART1_RXD`"]
118 #[inline(always)]
119 pub fn is_uart1_rxd(&self) -> bool {
120 *self == FUNCTION_A::UART1_RXD
121 }
122}
123#[doc = "Field `function_0[0-7]` writer - Select peripheral function for UART signal %s"]
124pub type FUNCTION_0_W<'a, const O: u8> =
125 crate::FieldWriter<'a, u32, UART_SIGNAL_0_SPEC, u8, FUNCTION_A, 8, O>;
126impl<'a, const O: u8> FUNCTION_0_W<'a, O> {
127 #[doc = "UART0 Request-to-Send flow control"]
128 #[inline(always)]
129 pub fn uart0_rts(self) -> &'a mut W {
130 self.variant(FUNCTION_A::UART0_RTS)
131 }
132 #[doc = "UART0 Clear-to-Send flow control"]
133 #[inline(always)]
134 pub fn uart0_cts(self) -> &'a mut W {
135 self.variant(FUNCTION_A::UART0_CTS)
136 }
137 #[doc = "UART0 transmit data"]
138 #[inline(always)]
139 pub fn uart0_txd(self) -> &'a mut W {
140 self.variant(FUNCTION_A::UART0_TXD)
141 }
142 #[doc = "UART0 receive data"]
143 #[inline(always)]
144 pub fn uart0_rxd(self) -> &'a mut W {
145 self.variant(FUNCTION_A::UART0_RXD)
146 }
147 #[doc = "UART1 Request-to-Send flow control"]
148 #[inline(always)]
149 pub fn uart1_rts(self) -> &'a mut W {
150 self.variant(FUNCTION_A::UART1_RTS)
151 }
152 #[doc = "UART1 Clear-to-Send flow control"]
153 #[inline(always)]
154 pub fn uart1_cts(self) -> &'a mut W {
155 self.variant(FUNCTION_A::UART1_CTS)
156 }
157 #[doc = "UART1 transmit data"]
158 #[inline(always)]
159 pub fn uart1_txd(self) -> &'a mut W {
160 self.variant(FUNCTION_A::UART1_TXD)
161 }
162 #[doc = "UART1 receive data"]
163 #[inline(always)]
164 pub fn uart1_rxd(self) -> &'a mut W {
165 self.variant(FUNCTION_A::UART1_RXD)
166 }
167}
168impl R {
169 #[doc = "Select peripheral function for UART signal [0-7]"]
170 #[inline(always)]
171 pub unsafe fn function_0(&self, n: u8) -> FUNCTION_0_R {
172 FUNCTION_0_R::new(((self.bits >> (n * 4)) & 0xff) as u8)
173 }
174 #[doc = "Bits 0:7 - Select peripheral function for UART signal 0"]
175 #[inline(always)]
176 pub fn function_00(&self) -> FUNCTION_0_R {
177 FUNCTION_0_R::new((self.bits & 0xff) as u8)
178 }
179 #[doc = "Bits 4:11 - Select peripheral function for UART signal 1"]
180 #[inline(always)]
181 pub fn function_01(&self) -> FUNCTION_0_R {
182 FUNCTION_0_R::new(((self.bits >> 4) & 0xff) as u8)
183 }
184 #[doc = "Bits 8:15 - Select peripheral function for UART signal 2"]
185 #[inline(always)]
186 pub fn function_02(&self) -> FUNCTION_0_R {
187 FUNCTION_0_R::new(((self.bits >> 8) & 0xff) as u8)
188 }
189 #[doc = "Bits 12:19 - Select peripheral function for UART signal 3"]
190 #[inline(always)]
191 pub fn function_03(&self) -> FUNCTION_0_R {
192 FUNCTION_0_R::new(((self.bits >> 12) & 0xff) as u8)
193 }
194 #[doc = "Bits 16:23 - Select peripheral function for UART signal 4"]
195 #[inline(always)]
196 pub fn function_04(&self) -> FUNCTION_0_R {
197 FUNCTION_0_R::new(((self.bits >> 16) & 0xff) as u8)
198 }
199 #[doc = "Bits 20:27 - Select peripheral function for UART signal 5"]
200 #[inline(always)]
201 pub fn function_05(&self) -> FUNCTION_0_R {
202 FUNCTION_0_R::new(((self.bits >> 20) & 0xff) as u8)
203 }
204 #[doc = "Bits 24:31 - Select peripheral function for UART signal 6"]
205 #[inline(always)]
206 pub fn function_06(&self) -> FUNCTION_0_R {
207 FUNCTION_0_R::new(((self.bits >> 24) & 0xff) as u8)
208 }
209 #[doc = "Bits 28:35 - Select peripheral function for UART signal 7"]
210 #[inline(always)]
211 pub fn function_07(&self) -> FUNCTION_0_R {
212 FUNCTION_0_R::new(((self.bits >> 28) & 0xff) as u8)
213 }
214}
215impl W {
216 #[doc = "Select peripheral function for UART signal [0-7]"]
217 #[inline(always)]
218 #[must_use]
219 pub unsafe fn function_0<const O: u8>(&mut self) -> FUNCTION_0_W<O> {
220 FUNCTION_0_W::new(self)
221 }
222 #[doc = "Bits 0:7 - Select peripheral function for UART signal 0"]
223 #[inline(always)]
224 #[must_use]
225 pub fn function_00(&mut self) -> FUNCTION_0_W<0> {
226 FUNCTION_0_W::new(self)
227 }
228 #[doc = "Bits 4:11 - Select peripheral function for UART signal 1"]
229 #[inline(always)]
230 #[must_use]
231 pub fn function_01(&mut self) -> FUNCTION_0_W<4> {
232 FUNCTION_0_W::new(self)
233 }
234 #[doc = "Bits 8:15 - Select peripheral function for UART signal 2"]
235 #[inline(always)]
236 #[must_use]
237 pub fn function_02(&mut self) -> FUNCTION_0_W<8> {
238 FUNCTION_0_W::new(self)
239 }
240 #[doc = "Bits 12:19 - Select peripheral function for UART signal 3"]
241 #[inline(always)]
242 #[must_use]
243 pub fn function_03(&mut self) -> FUNCTION_0_W<12> {
244 FUNCTION_0_W::new(self)
245 }
246 #[doc = "Bits 16:23 - Select peripheral function for UART signal 4"]
247 #[inline(always)]
248 #[must_use]
249 pub fn function_04(&mut self) -> FUNCTION_0_W<16> {
250 FUNCTION_0_W::new(self)
251 }
252 #[doc = "Bits 20:27 - Select peripheral function for UART signal 5"]
253 #[inline(always)]
254 #[must_use]
255 pub fn function_05(&mut self) -> FUNCTION_0_W<20> {
256 FUNCTION_0_W::new(self)
257 }
258 #[doc = "Bits 24:31 - Select peripheral function for UART signal 6"]
259 #[inline(always)]
260 #[must_use]
261 pub fn function_06(&mut self) -> FUNCTION_0_W<24> {
262 FUNCTION_0_W::new(self)
263 }
264 #[doc = "Bits 28:35 - Select peripheral function for UART signal 7"]
265 #[inline(always)]
266 #[must_use]
267 pub fn function_07(&mut self) -> FUNCTION_0_W<28> {
268 FUNCTION_0_W::new(self)
269 }
270 #[doc = "Writes raw bits to the register."]
271 #[inline(always)]
272 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
273 self.0.bits(bits);
274 self
275 }
276}
277#[doc = "Universal Asynchronous Receiver/Transmitter signal configuration 0\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 [uart_signal_0](index.html) module"]
278pub struct UART_SIGNAL_0_SPEC;
279impl crate::RegisterSpec for UART_SIGNAL_0_SPEC {
280 type Ux = u32;
281}
282#[doc = "`read()` method returns [uart_signal_0::R](R) reader structure"]
283impl crate::Readable for UART_SIGNAL_0_SPEC {
284 type Reader = R;
285}
286#[doc = "`write(|w| ..)` method takes [uart_signal_0::W](W) writer structure"]
287impl crate::Writable for UART_SIGNAL_0_SPEC {
288 type Writer = W;
289 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
290 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
291}
292#[doc = "`reset()` method sets uart_signal_0 to value 0"]
293impl crate::Resettable for UART_SIGNAL_0_SPEC {
294 const RESET_VALUE: Self::Ux = 0;
295}