ra6t2/sci_b0/
rdr.rs

1#[doc = "Register `RDR` reader"]
2pub struct R(crate::R<RDR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RDR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RDR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RDR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `RDAT` reader - Serial receive data"]
17pub type RDAT_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `MPB` reader - Multi-processor flag"]
19pub type MPB_R = crate::BitReader<MPB_A>;
20#[doc = "Multi-processor flag\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22pub enum MPB_A {
23    #[doc = "0: Data transmission cycles"]
24    _0 = 0,
25    #[doc = "1: ID transmission cycles"]
26    _1 = 1,
27}
28impl From<MPB_A> for bool {
29    #[inline(always)]
30    fn from(variant: MPB_A) -> Self {
31        variant as u8 != 0
32    }
33}
34impl MPB_R {
35    #[doc = "Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> MPB_A {
38        match self.bits {
39            false => MPB_A::_0,
40            true => MPB_A::_1,
41        }
42    }
43    #[doc = "Checks if the value of the field is `_0`"]
44    #[inline(always)]
45    pub fn is_0(&self) -> bool {
46        *self == MPB_A::_0
47    }
48    #[doc = "Checks if the value of the field is `_1`"]
49    #[inline(always)]
50    pub fn is_1(&self) -> bool {
51        *self == MPB_A::_1
52    }
53}
54#[doc = "Field `DR` reader - Receive data ready flag"]
55pub type DR_R = crate::BitReader<bool>;
56#[doc = "Field `FPER` reader - FIFO parity error flag"]
57pub type FPER_R = crate::BitReader<FPER_A>;
58#[doc = "FIFO parity error flag\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum FPER_A {
61    #[doc = "0: There is no parity error in the data read from the receive-FIFO"]
62    _0 = 0,
63    #[doc = "1: There is parity error in the data read from the receive-FIFO"]
64    _1 = 1,
65}
66impl From<FPER_A> for bool {
67    #[inline(always)]
68    fn from(variant: FPER_A) -> Self {
69        variant as u8 != 0
70    }
71}
72impl FPER_R {
73    #[doc = "Get enumerated values variant"]
74    #[inline(always)]
75    pub fn variant(&self) -> FPER_A {
76        match self.bits {
77            false => FPER_A::_0,
78            true => FPER_A::_1,
79        }
80    }
81    #[doc = "Checks if the value of the field is `_0`"]
82    #[inline(always)]
83    pub fn is_0(&self) -> bool {
84        *self == FPER_A::_0
85    }
86    #[doc = "Checks if the value of the field is `_1`"]
87    #[inline(always)]
88    pub fn is_1(&self) -> bool {
89        *self == FPER_A::_1
90    }
91}
92#[doc = "Field `FFER` reader - FIFO framing error flag"]
93pub type FFER_R = crate::BitReader<FFER_A>;
94#[doc = "FIFO framing error flag\n\nValue on reset: 0"]
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
96pub enum FFER_A {
97    #[doc = "0: There is no framing error in the data read from the receive-FIFO"]
98    _0 = 0,
99    #[doc = "1: There is framing error in the data read from the receive-FIFO"]
100    _1 = 1,
101}
102impl From<FFER_A> for bool {
103    #[inline(always)]
104    fn from(variant: FFER_A) -> Self {
105        variant as u8 != 0
106    }
107}
108impl FFER_R {
109    #[doc = "Get enumerated values variant"]
110    #[inline(always)]
111    pub fn variant(&self) -> FFER_A {
112        match self.bits {
113            false => FFER_A::_0,
114            true => FFER_A::_1,
115        }
116    }
117    #[doc = "Checks if the value of the field is `_0`"]
118    #[inline(always)]
119    pub fn is_0(&self) -> bool {
120        *self == FFER_A::_0
121    }
122    #[doc = "Checks if the value of the field is `_1`"]
123    #[inline(always)]
124    pub fn is_1(&self) -> bool {
125        *self == FFER_A::_1
126    }
127}
128#[doc = "Field `ORER` reader - Overrun Error flag"]
129pub type ORER_R = crate::BitReader<bool>;
130#[doc = "Field `PER` reader - Parity error flag"]
131pub type PER_R = crate::BitReader<bool>;
132#[doc = "Field `FER` reader - Framing error flag"]
133pub type FER_R = crate::BitReader<bool>;
134impl R {
135    #[doc = "Bits 0:8 - Serial receive data"]
136    #[inline(always)]
137    pub fn rdat(&self) -> RDAT_R {
138        RDAT_R::new((self.bits & 0x01ff) as u16)
139    }
140    #[doc = "Bit 9 - Multi-processor flag"]
141    #[inline(always)]
142    pub fn mpb(&self) -> MPB_R {
143        MPB_R::new(((self.bits >> 9) & 1) != 0)
144    }
145    #[doc = "Bit 10 - Receive data ready flag"]
146    #[inline(always)]
147    pub fn dr(&self) -> DR_R {
148        DR_R::new(((self.bits >> 10) & 1) != 0)
149    }
150    #[doc = "Bit 11 - FIFO parity error flag"]
151    #[inline(always)]
152    pub fn fper(&self) -> FPER_R {
153        FPER_R::new(((self.bits >> 11) & 1) != 0)
154    }
155    #[doc = "Bit 12 - FIFO framing error flag"]
156    #[inline(always)]
157    pub fn ffer(&self) -> FFER_R {
158        FFER_R::new(((self.bits >> 12) & 1) != 0)
159    }
160    #[doc = "Bit 24 - Overrun Error flag"]
161    #[inline(always)]
162    pub fn orer(&self) -> ORER_R {
163        ORER_R::new(((self.bits >> 24) & 1) != 0)
164    }
165    #[doc = "Bit 27 - Parity error flag"]
166    #[inline(always)]
167    pub fn per(&self) -> PER_R {
168        PER_R::new(((self.bits >> 27) & 1) != 0)
169    }
170    #[doc = "Bit 28 - Framing error flag"]
171    #[inline(always)]
172    pub fn fer(&self) -> FER_R {
173        FER_R::new(((self.bits >> 28) & 1) != 0)
174    }
175}
176#[doc = "Receive Data Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rdr](index.html) module"]
177pub struct RDR_SPEC;
178impl crate::RegisterSpec for RDR_SPEC {
179    type Ux = u32;
180}
181#[doc = "`read()` method returns [rdr::R](R) reader structure"]
182impl crate::Readable for RDR_SPEC {
183    type Reader = R;
184}
185#[doc = "`reset()` method sets RDR to value 0"]
186impl crate::Resettable for RDR_SPEC {
187    const RESET_VALUE: Self::Ux = 0;
188}