cc2538/sys_ctrl/
sruart.rs

1#[doc = "Reader of register SRUART"]
2pub type R = crate::R<u32, super::SRUART>;
3#[doc = "Writer for register SRUART"]
4pub type W = crate::W<u32, super::SRUART>;
5#[doc = "Register SRUART `reset()`'s with value 0"]
6impl crate::ResetValue for super::SRUART {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved32`"]
14pub type RESERVED32_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved32`"]
16pub struct RESERVED32_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED32_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x3fff_ffff << 2)) | (((value as u32) & 0x3fff_ffff) << 2);
24        self.w
25    }
26}
27#[doc = "Reader of field `UART1`"]
28pub type UART1_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `UART1`"]
30pub struct UART1_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> UART1_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
48        self.w
49    }
50}
51#[doc = "Reader of field `UART0`"]
52pub type UART0_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `UART0`"]
54pub struct UART0_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> UART0_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
72        self.w
73    }
74}
75impl R {
76    #[doc = "Bits 2:31 - 31:2\\] This register is 8 bits in a 32-bit address space."]
77    #[inline(always)]
78    pub fn reserved32(&self) -> RESERVED32_R {
79        RESERVED32_R::new(((self.bits >> 2) & 0x3fff_ffff) as u32)
80    }
81    #[doc = "Bit 1 - 1:1\\] 0: UART1 module is not reset 1: UART1 module is reset"]
82    #[inline(always)]
83    pub fn uart1(&self) -> UART1_R {
84        UART1_R::new(((self.bits >> 1) & 0x01) != 0)
85    }
86    #[doc = "Bit 0 - 0:0\\] 0: UART0 module is not reset 1: UART0 module is reset"]
87    #[inline(always)]
88    pub fn uart0(&self) -> UART0_R {
89        UART0_R::new((self.bits & 0x01) != 0)
90    }
91}
92impl W {
93    #[doc = "Bits 2:31 - 31:2\\] This register is 8 bits in a 32-bit address space."]
94    #[inline(always)]
95    pub fn reserved32(&mut self) -> RESERVED32_W {
96        RESERVED32_W { w: self }
97    }
98    #[doc = "Bit 1 - 1:1\\] 0: UART1 module is not reset 1: UART1 module is reset"]
99    #[inline(always)]
100    pub fn uart1(&mut self) -> UART1_W {
101        UART1_W { w: self }
102    }
103    #[doc = "Bit 0 - 0:0\\] 0: UART0 module is not reset 1: UART0 module is reset"]
104    #[inline(always)]
105    pub fn uart0(&mut self) -> UART0_W {
106        UART0_W { w: self }
107    }
108}