bl808_pac/glb/
uart_signal_0.rs

1#[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    #[doc = "8: UART2 Request-to-Send flow control"]
60    UART2_RTS = 8,
61    #[doc = "9: UART2 Clear-to-Send flow control"]
62    UART2_CTS = 9,
63    #[doc = "10: UART2 transmit data"]
64    UART2_TXD = 10,
65    #[doc = "11: UART2 receive data"]
66    UART2_RXD = 11,
67}
68impl From<FUNCTION_A> for u8 {
69    #[inline(always)]
70    fn from(variant: FUNCTION_A) -> Self {
71        variant as _
72    }
73}
74impl FUNCTION_0_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub fn variant(&self) -> Option<FUNCTION_A> {
78        match self.bits {
79            0 => Some(FUNCTION_A::UART0_RTS),
80            1 => Some(FUNCTION_A::UART0_CTS),
81            2 => Some(FUNCTION_A::UART0_TXD),
82            3 => Some(FUNCTION_A::UART0_RXD),
83            4 => Some(FUNCTION_A::UART1_RTS),
84            5 => Some(FUNCTION_A::UART1_CTS),
85            6 => Some(FUNCTION_A::UART1_TXD),
86            7 => Some(FUNCTION_A::UART1_RXD),
87            8 => Some(FUNCTION_A::UART2_RTS),
88            9 => Some(FUNCTION_A::UART2_CTS),
89            10 => Some(FUNCTION_A::UART2_TXD),
90            11 => Some(FUNCTION_A::UART2_RXD),
91            _ => None,
92        }
93    }
94    #[doc = "Checks if the value of the field is `UART0_RTS`"]
95    #[inline(always)]
96    pub fn is_uart0_rts(&self) -> bool {
97        *self == FUNCTION_A::UART0_RTS
98    }
99    #[doc = "Checks if the value of the field is `UART0_CTS`"]
100    #[inline(always)]
101    pub fn is_uart0_cts(&self) -> bool {
102        *self == FUNCTION_A::UART0_CTS
103    }
104    #[doc = "Checks if the value of the field is `UART0_TXD`"]
105    #[inline(always)]
106    pub fn is_uart0_txd(&self) -> bool {
107        *self == FUNCTION_A::UART0_TXD
108    }
109    #[doc = "Checks if the value of the field is `UART0_RXD`"]
110    #[inline(always)]
111    pub fn is_uart0_rxd(&self) -> bool {
112        *self == FUNCTION_A::UART0_RXD
113    }
114    #[doc = "Checks if the value of the field is `UART1_RTS`"]
115    #[inline(always)]
116    pub fn is_uart1_rts(&self) -> bool {
117        *self == FUNCTION_A::UART1_RTS
118    }
119    #[doc = "Checks if the value of the field is `UART1_CTS`"]
120    #[inline(always)]
121    pub fn is_uart1_cts(&self) -> bool {
122        *self == FUNCTION_A::UART1_CTS
123    }
124    #[doc = "Checks if the value of the field is `UART1_TXD`"]
125    #[inline(always)]
126    pub fn is_uart1_txd(&self) -> bool {
127        *self == FUNCTION_A::UART1_TXD
128    }
129    #[doc = "Checks if the value of the field is `UART1_RXD`"]
130    #[inline(always)]
131    pub fn is_uart1_rxd(&self) -> bool {
132        *self == FUNCTION_A::UART1_RXD
133    }
134    #[doc = "Checks if the value of the field is `UART2_RTS`"]
135    #[inline(always)]
136    pub fn is_uart2_rts(&self) -> bool {
137        *self == FUNCTION_A::UART2_RTS
138    }
139    #[doc = "Checks if the value of the field is `UART2_CTS`"]
140    #[inline(always)]
141    pub fn is_uart2_cts(&self) -> bool {
142        *self == FUNCTION_A::UART2_CTS
143    }
144    #[doc = "Checks if the value of the field is `UART2_TXD`"]
145    #[inline(always)]
146    pub fn is_uart2_txd(&self) -> bool {
147        *self == FUNCTION_A::UART2_TXD
148    }
149    #[doc = "Checks if the value of the field is `UART2_RXD`"]
150    #[inline(always)]
151    pub fn is_uart2_rxd(&self) -> bool {
152        *self == FUNCTION_A::UART2_RXD
153    }
154}
155#[doc = "Field `function_0[0-7]` writer - Select peripheral function for UART signal %s"]
156pub type FUNCTION_0_W<'a, const O: u8> =
157    crate::FieldWriter<'a, u32, UART_SIGNAL_0_SPEC, u8, FUNCTION_A, 8, O>;
158impl<'a, const O: u8> FUNCTION_0_W<'a, O> {
159    #[doc = "UART0 Request-to-Send flow control"]
160    #[inline(always)]
161    pub fn uart0_rts(self) -> &'a mut W {
162        self.variant(FUNCTION_A::UART0_RTS)
163    }
164    #[doc = "UART0 Clear-to-Send flow control"]
165    #[inline(always)]
166    pub fn uart0_cts(self) -> &'a mut W {
167        self.variant(FUNCTION_A::UART0_CTS)
168    }
169    #[doc = "UART0 transmit data"]
170    #[inline(always)]
171    pub fn uart0_txd(self) -> &'a mut W {
172        self.variant(FUNCTION_A::UART0_TXD)
173    }
174    #[doc = "UART0 receive data"]
175    #[inline(always)]
176    pub fn uart0_rxd(self) -> &'a mut W {
177        self.variant(FUNCTION_A::UART0_RXD)
178    }
179    #[doc = "UART1 Request-to-Send flow control"]
180    #[inline(always)]
181    pub fn uart1_rts(self) -> &'a mut W {
182        self.variant(FUNCTION_A::UART1_RTS)
183    }
184    #[doc = "UART1 Clear-to-Send flow control"]
185    #[inline(always)]
186    pub fn uart1_cts(self) -> &'a mut W {
187        self.variant(FUNCTION_A::UART1_CTS)
188    }
189    #[doc = "UART1 transmit data"]
190    #[inline(always)]
191    pub fn uart1_txd(self) -> &'a mut W {
192        self.variant(FUNCTION_A::UART1_TXD)
193    }
194    #[doc = "UART1 receive data"]
195    #[inline(always)]
196    pub fn uart1_rxd(self) -> &'a mut W {
197        self.variant(FUNCTION_A::UART1_RXD)
198    }
199    #[doc = "UART2 Request-to-Send flow control"]
200    #[inline(always)]
201    pub fn uart2_rts(self) -> &'a mut W {
202        self.variant(FUNCTION_A::UART2_RTS)
203    }
204    #[doc = "UART2 Clear-to-Send flow control"]
205    #[inline(always)]
206    pub fn uart2_cts(self) -> &'a mut W {
207        self.variant(FUNCTION_A::UART2_CTS)
208    }
209    #[doc = "UART2 transmit data"]
210    #[inline(always)]
211    pub fn uart2_txd(self) -> &'a mut W {
212        self.variant(FUNCTION_A::UART2_TXD)
213    }
214    #[doc = "UART2 receive data"]
215    #[inline(always)]
216    pub fn uart2_rxd(self) -> &'a mut W {
217        self.variant(FUNCTION_A::UART2_RXD)
218    }
219}
220impl R {
221    #[doc = "Select peripheral function for UART signal [0-7]"]
222    #[inline(always)]
223    pub unsafe fn function_0(&self, n: u8) -> FUNCTION_0_R {
224        FUNCTION_0_R::new(((self.bits >> (n * 4)) & 0xff) as u8)
225    }
226    #[doc = "Bits 0:7 - Select peripheral function for UART signal 0"]
227    #[inline(always)]
228    pub fn function_00(&self) -> FUNCTION_0_R {
229        FUNCTION_0_R::new((self.bits & 0xff) as u8)
230    }
231    #[doc = "Bits 4:11 - Select peripheral function for UART signal 1"]
232    #[inline(always)]
233    pub fn function_01(&self) -> FUNCTION_0_R {
234        FUNCTION_0_R::new(((self.bits >> 4) & 0xff) as u8)
235    }
236    #[doc = "Bits 8:15 - Select peripheral function for UART signal 2"]
237    #[inline(always)]
238    pub fn function_02(&self) -> FUNCTION_0_R {
239        FUNCTION_0_R::new(((self.bits >> 8) & 0xff) as u8)
240    }
241    #[doc = "Bits 12:19 - Select peripheral function for UART signal 3"]
242    #[inline(always)]
243    pub fn function_03(&self) -> FUNCTION_0_R {
244        FUNCTION_0_R::new(((self.bits >> 12) & 0xff) as u8)
245    }
246    #[doc = "Bits 16:23 - Select peripheral function for UART signal 4"]
247    #[inline(always)]
248    pub fn function_04(&self) -> FUNCTION_0_R {
249        FUNCTION_0_R::new(((self.bits >> 16) & 0xff) as u8)
250    }
251    #[doc = "Bits 20:27 - Select peripheral function for UART signal 5"]
252    #[inline(always)]
253    pub fn function_05(&self) -> FUNCTION_0_R {
254        FUNCTION_0_R::new(((self.bits >> 20) & 0xff) as u8)
255    }
256    #[doc = "Bits 24:31 - Select peripheral function for UART signal 6"]
257    #[inline(always)]
258    pub fn function_06(&self) -> FUNCTION_0_R {
259        FUNCTION_0_R::new(((self.bits >> 24) & 0xff) as u8)
260    }
261    #[doc = "Bits 28:35 - Select peripheral function for UART signal 7"]
262    #[inline(always)]
263    pub fn function_07(&self) -> FUNCTION_0_R {
264        FUNCTION_0_R::new(((self.bits >> 28) & 0xff) as u8)
265    }
266}
267impl W {
268    #[doc = "Select peripheral function for UART signal [0-7]"]
269    #[inline(always)]
270    pub unsafe fn function_0<const O: u8>(&mut self) -> FUNCTION_0_W<O> {
271        FUNCTION_0_W::new(self)
272    }
273    #[doc = "Bits 0:7 - Select peripheral function for UART signal 0"]
274    #[inline(always)]
275    pub fn function_00(&mut self) -> FUNCTION_0_W<0> {
276        FUNCTION_0_W::new(self)
277    }
278    #[doc = "Bits 4:11 - Select peripheral function for UART signal 1"]
279    #[inline(always)]
280    pub fn function_01(&mut self) -> FUNCTION_0_W<4> {
281        FUNCTION_0_W::new(self)
282    }
283    #[doc = "Bits 8:15 - Select peripheral function for UART signal 2"]
284    #[inline(always)]
285    pub fn function_02(&mut self) -> FUNCTION_0_W<8> {
286        FUNCTION_0_W::new(self)
287    }
288    #[doc = "Bits 12:19 - Select peripheral function for UART signal 3"]
289    #[inline(always)]
290    pub fn function_03(&mut self) -> FUNCTION_0_W<12> {
291        FUNCTION_0_W::new(self)
292    }
293    #[doc = "Bits 16:23 - Select peripheral function for UART signal 4"]
294    #[inline(always)]
295    pub fn function_04(&mut self) -> FUNCTION_0_W<16> {
296        FUNCTION_0_W::new(self)
297    }
298    #[doc = "Bits 20:27 - Select peripheral function for UART signal 5"]
299    #[inline(always)]
300    pub fn function_05(&mut self) -> FUNCTION_0_W<20> {
301        FUNCTION_0_W::new(self)
302    }
303    #[doc = "Bits 24:31 - Select peripheral function for UART signal 6"]
304    #[inline(always)]
305    pub fn function_06(&mut self) -> FUNCTION_0_W<24> {
306        FUNCTION_0_W::new(self)
307    }
308    #[doc = "Bits 28:35 - Select peripheral function for UART signal 7"]
309    #[inline(always)]
310    pub fn function_07(&mut self) -> FUNCTION_0_W<28> {
311        FUNCTION_0_W::new(self)
312    }
313    #[doc = "Writes raw bits to the register."]
314    #[inline(always)]
315    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
316        self.0.bits(bits);
317        self
318    }
319}
320#[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"]
321pub struct UART_SIGNAL_0_SPEC;
322impl crate::RegisterSpec for UART_SIGNAL_0_SPEC {
323    type Ux = u32;
324}
325#[doc = "`read()` method returns [uart_signal_0::R](R) reader structure"]
326impl crate::Readable for UART_SIGNAL_0_SPEC {
327    type Reader = R;
328}
329#[doc = "`write(|w| ..)` method takes [uart_signal_0::W](W) writer structure"]
330impl crate::Writable for UART_SIGNAL_0_SPEC {
331    type Writer = W;
332}
333#[doc = "`reset()` method sets uart_signal_0 to value 0"]
334impl crate::Resettable for UART_SIGNAL_0_SPEC {
335    #[inline(always)]
336    fn reset_value() -> Self::Ux {
337        0
338    }
339}