d1_pac/uart/
msr.rs

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