v853_pac/uart/
msr.rs

1#[doc = "Register `msr` reader"]
2pub struct R(crate::R<MSR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<MSR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<MSR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<MSR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Line State of Data Carrier Detect\n\nValue on reset: 0"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18pub enum DCD_A {
19    #[doc = "0: `0`"]
20    DEASSERTED = 0,
21    #[doc = "1: `1`"]
22    ASSERTED = 1,
23}
24impl From<DCD_A> for bool {
25    #[inline(always)]
26    fn from(variant: DCD_A) -> Self {
27        variant as u8 != 0
28    }
29}
30#[doc = "Field `dcd` reader - Line State of Data Carrier Detect"]
31pub type DCD_R = crate::BitReader<DCD_A>;
32impl DCD_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> DCD_A {
36        match self.bits {
37            false => DCD_A::DEASSERTED,
38            true => DCD_A::ASSERTED,
39        }
40    }
41    #[doc = "Checks if the value of the field is `DEASSERTED`"]
42    #[inline(always)]
43    pub fn is_deasserted(&self) -> bool {
44        *self == DCD_A::DEASSERTED
45    }
46    #[doc = "Checks if the value of the field is `ASSERTED`"]
47    #[inline(always)]
48    pub fn is_asserted(&self) -> bool {
49        *self == DCD_A::ASSERTED
50    }
51}
52#[doc = "Line State of Ring Indicator\n\nValue on reset: 0"]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub enum RI_A {
55    #[doc = "0: `0`"]
56    DEASSERTED = 0,
57    #[doc = "1: `1`"]
58    ASSERTED = 1,
59}
60impl From<RI_A> for bool {
61    #[inline(always)]
62    fn from(variant: RI_A) -> Self {
63        variant as u8 != 0
64    }
65}
66#[doc = "Field `ri` reader - Line State of Ring Indicator"]
67pub type RI_R = crate::BitReader<RI_A>;
68impl RI_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> RI_A {
72        match self.bits {
73            false => RI_A::DEASSERTED,
74            true => RI_A::ASSERTED,
75        }
76    }
77    #[doc = "Checks if the value of the field is `DEASSERTED`"]
78    #[inline(always)]
79    pub fn is_deasserted(&self) -> bool {
80        *self == RI_A::DEASSERTED
81    }
82    #[doc = "Checks if the value of the field is `ASSERTED`"]
83    #[inline(always)]
84    pub fn is_asserted(&self) -> bool {
85        *self == RI_A::ASSERTED
86    }
87}
88#[doc = "Line State of Data Set Ready\n\nValue on reset: 0"]
89#[derive(Clone, Copy, Debug, PartialEq)]
90pub enum DSR_A {
91    #[doc = "0: `0`"]
92    DEASSERTED = 0,
93    #[doc = "1: `1`"]
94    ASSERTED = 1,
95}
96impl From<DSR_A> for bool {
97    #[inline(always)]
98    fn from(variant: DSR_A) -> Self {
99        variant as u8 != 0
100    }
101}
102#[doc = "Field `dsr` reader - Line State of Data Set Ready"]
103pub type DSR_R = crate::BitReader<DSR_A>;
104impl DSR_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> DSR_A {
108        match self.bits {
109            false => DSR_A::DEASSERTED,
110            true => DSR_A::ASSERTED,
111        }
112    }
113    #[doc = "Checks if the value of the field is `DEASSERTED`"]
114    #[inline(always)]
115    pub fn is_deasserted(&self) -> bool {
116        *self == DSR_A::DEASSERTED
117    }
118    #[doc = "Checks if the value of the field is `ASSERTED`"]
119    #[inline(always)]
120    pub fn is_asserted(&self) -> bool {
121        *self == DSR_A::ASSERTED
122    }
123}
124#[doc = "Line State of Clear To Send\n\nValue on reset: 0"]
125#[derive(Clone, Copy, Debug, PartialEq)]
126pub enum CTS_A {
127    #[doc = "0: `0`"]
128    DEASSERTED = 0,
129    #[doc = "1: `1`"]
130    ASSERTED = 1,
131}
132impl From<CTS_A> for bool {
133    #[inline(always)]
134    fn from(variant: CTS_A) -> Self {
135        variant as u8 != 0
136    }
137}
138#[doc = "Field `cts` reader - Line State of Clear To Send"]
139pub type CTS_R = crate::BitReader<CTS_A>;
140impl CTS_R {
141    #[doc = "Get enumerated values variant"]
142    #[inline(always)]
143    pub fn variant(&self) -> CTS_A {
144        match self.bits {
145            false => CTS_A::DEASSERTED,
146            true => CTS_A::ASSERTED,
147        }
148    }
149    #[doc = "Checks if the value of the field is `DEASSERTED`"]
150    #[inline(always)]
151    pub fn is_deasserted(&self) -> bool {
152        *self == CTS_A::DEASSERTED
153    }
154    #[doc = "Checks if the value of the field is `ASSERTED`"]
155    #[inline(always)]
156    pub fn is_asserted(&self) -> bool {
157        *self == CTS_A::ASSERTED
158    }
159}
160#[doc = "Delta Data Carrier Detect\n\nValue on reset: 0"]
161#[derive(Clone, Copy, Debug, PartialEq)]
162pub enum DDCD_A {
163    #[doc = "0: `0`"]
164    NO_CHANGE = 0,
165    #[doc = "1: `1`"]
166    CHANGE = 1,
167}
168impl From<DDCD_A> for bool {
169    #[inline(always)]
170    fn from(variant: DDCD_A) -> Self {
171        variant as u8 != 0
172    }
173}
174#[doc = "Field `ddcd` reader - Delta Data Carrier Detect"]
175pub type DDCD_R = crate::BitReader<DDCD_A>;
176impl DDCD_R {
177    #[doc = "Get enumerated values variant"]
178    #[inline(always)]
179    pub fn variant(&self) -> DDCD_A {
180        match self.bits {
181            false => DDCD_A::NO_CHANGE,
182            true => DDCD_A::CHANGE,
183        }
184    }
185    #[doc = "Checks if the value of the field is `NO_CHANGE`"]
186    #[inline(always)]
187    pub fn is_no_change(&self) -> bool {
188        *self == DDCD_A::NO_CHANGE
189    }
190    #[doc = "Checks if the value of the field is `CHANGE`"]
191    #[inline(always)]
192    pub fn is_change(&self) -> bool {
193        *self == DDCD_A::CHANGE
194    }
195}
196#[doc = "Trailing Edge Ring Indicator\n\nValue on reset: 0"]
197#[derive(Clone, Copy, Debug, PartialEq)]
198pub enum TERI_A {
199    #[doc = "0: `0`"]
200    NO_CHANGE = 0,
201    #[doc = "1: `1`"]
202    CHANGE = 1,
203}
204impl From<TERI_A> for bool {
205    #[inline(always)]
206    fn from(variant: TERI_A) -> Self {
207        variant as u8 != 0
208    }
209}
210#[doc = "Field `teri` reader - Trailing Edge Ring Indicator"]
211pub type TERI_R = crate::BitReader<TERI_A>;
212impl TERI_R {
213    #[doc = "Get enumerated values variant"]
214    #[inline(always)]
215    pub fn variant(&self) -> TERI_A {
216        match self.bits {
217            false => TERI_A::NO_CHANGE,
218            true => TERI_A::CHANGE,
219        }
220    }
221    #[doc = "Checks if the value of the field is `NO_CHANGE`"]
222    #[inline(always)]
223    pub fn is_no_change(&self) -> bool {
224        *self == TERI_A::NO_CHANGE
225    }
226    #[doc = "Checks if the value of the field is `CHANGE`"]
227    #[inline(always)]
228    pub fn is_change(&self) -> bool {
229        *self == TERI_A::CHANGE
230    }
231}
232#[doc = "Delta Data Set Ready\n\nValue on reset: 0"]
233#[derive(Clone, Copy, Debug, PartialEq)]
234pub enum DDSR_A {
235    #[doc = "0: `0`"]
236    NO_CHANGE = 0,
237    #[doc = "1: `1`"]
238    CHANGE = 1,
239}
240impl From<DDSR_A> for bool {
241    #[inline(always)]
242    fn from(variant: DDSR_A) -> Self {
243        variant as u8 != 0
244    }
245}
246#[doc = "Field `ddsr` reader - Delta Data Set Ready"]
247pub type DDSR_R = crate::BitReader<DDSR_A>;
248impl DDSR_R {
249    #[doc = "Get enumerated values variant"]
250    #[inline(always)]
251    pub fn variant(&self) -> DDSR_A {
252        match self.bits {
253            false => DDSR_A::NO_CHANGE,
254            true => DDSR_A::CHANGE,
255        }
256    }
257    #[doc = "Checks if the value of the field is `NO_CHANGE`"]
258    #[inline(always)]
259    pub fn is_no_change(&self) -> bool {
260        *self == DDSR_A::NO_CHANGE
261    }
262    #[doc = "Checks if the value of the field is `CHANGE`"]
263    #[inline(always)]
264    pub fn is_change(&self) -> bool {
265        *self == DDSR_A::CHANGE
266    }
267}
268#[doc = "Delta Clear to Send\n\nValue on reset: 0"]
269#[derive(Clone, Copy, Debug, PartialEq)]
270pub enum DCTS_A {
271    #[doc = "0: `0`"]
272    NO_CHANGE = 0,
273    #[doc = "1: `1`"]
274    CHANGE = 1,
275}
276impl From<DCTS_A> for bool {
277    #[inline(always)]
278    fn from(variant: DCTS_A) -> Self {
279        variant as u8 != 0
280    }
281}
282#[doc = "Field `dcts` reader - Delta Clear to Send"]
283pub type DCTS_R = crate::BitReader<DCTS_A>;
284impl DCTS_R {
285    #[doc = "Get enumerated values variant"]
286    #[inline(always)]
287    pub fn variant(&self) -> DCTS_A {
288        match self.bits {
289            false => DCTS_A::NO_CHANGE,
290            true => DCTS_A::CHANGE,
291        }
292    }
293    #[doc = "Checks if the value of the field is `NO_CHANGE`"]
294    #[inline(always)]
295    pub fn is_no_change(&self) -> bool {
296        *self == DCTS_A::NO_CHANGE
297    }
298    #[doc = "Checks if the value of the field is `CHANGE`"]
299    #[inline(always)]
300    pub fn is_change(&self) -> bool {
301        *self == DCTS_A::CHANGE
302    }
303}
304impl R {
305    #[doc = "Bit 7 - Line State of Data Carrier Detect"]
306    #[inline(always)]
307    pub fn dcd(&self) -> DCD_R {
308        DCD_R::new(((self.bits >> 7) & 1) != 0)
309    }
310    #[doc = "Bit 6 - Line State of Ring Indicator"]
311    #[inline(always)]
312    pub fn ri(&self) -> RI_R {
313        RI_R::new(((self.bits >> 6) & 1) != 0)
314    }
315    #[doc = "Bit 5 - Line State of Data Set Ready"]
316    #[inline(always)]
317    pub fn dsr(&self) -> DSR_R {
318        DSR_R::new(((self.bits >> 5) & 1) != 0)
319    }
320    #[doc = "Bit 4 - Line State of Clear To Send"]
321    #[inline(always)]
322    pub fn cts(&self) -> CTS_R {
323        CTS_R::new(((self.bits >> 4) & 1) != 0)
324    }
325    #[doc = "Bit 3 - Delta Data Carrier Detect"]
326    #[inline(always)]
327    pub fn ddcd(&self) -> DDCD_R {
328        DDCD_R::new(((self.bits >> 3) & 1) != 0)
329    }
330    #[doc = "Bit 2 - Trailing Edge Ring Indicator"]
331    #[inline(always)]
332    pub fn teri(&self) -> TERI_R {
333        TERI_R::new(((self.bits >> 2) & 1) != 0)
334    }
335    #[doc = "Bit 1 - Delta Data Set Ready"]
336    #[inline(always)]
337    pub fn ddsr(&self) -> DDSR_R {
338        DDSR_R::new(((self.bits >> 1) & 1) != 0)
339    }
340    #[doc = "Bit 0 - Delta Clear to Send"]
341    #[inline(always)]
342    pub fn dcts(&self) -> DCTS_R {
343        DCTS_R::new((self.bits & 1) != 0)
344    }
345}
346#[doc = "UART Modem Status 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 [msr](index.html) module"]
347pub struct MSR_SPEC;
348impl crate::RegisterSpec for MSR_SPEC {
349    type Ux = u32;
350}
351#[doc = "`read()` method returns [msr::R](R) reader structure"]
352impl crate::Readable for MSR_SPEC {
353    type Reader = R;
354}
355#[doc = "`reset()` method sets msr to value 0"]
356impl crate::Resettable for MSR_SPEC {
357    #[inline(always)]
358    fn reset_value() -> Self::Ux {
359        0
360    }
361}