1#[doc = "Register `FRMNUM` reader"]
2pub struct R(crate::R<FRMNUM_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FRMNUM_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FRMNUM_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FRMNUM_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `FRMNUM` writer"]
17pub struct W(crate::W<FRMNUM_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<FRMNUM_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<FRMNUM_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<FRMNUM_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FRNM` reader - Frame Number"]
38pub type FRNM_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `CRCE` reader - Receive Data Error"]
40pub type CRCE_R = crate::BitReader<CRCE_A>;
41#[doc = "Receive Data Error\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum CRCE_A {
44 #[doc = "0: No error occurred"]
45 _0 = 0,
46 #[doc = "1: Error occurred"]
47 _1 = 1,
48}
49impl From<CRCE_A> for bool {
50 #[inline(always)]
51 fn from(variant: CRCE_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl CRCE_R {
56 #[doc = "Get enumerated values variant"]
57 #[inline(always)]
58 pub fn variant(&self) -> CRCE_A {
59 match self.bits {
60 false => CRCE_A::_0,
61 true => CRCE_A::_1,
62 }
63 }
64 #[doc = "Checks if the value of the field is `_0`"]
65 #[inline(always)]
66 pub fn is_0(&self) -> bool {
67 *self == CRCE_A::_0
68 }
69 #[doc = "Checks if the value of the field is `_1`"]
70 #[inline(always)]
71 pub fn is_1(&self) -> bool {
72 *self == CRCE_A::_1
73 }
74}
75#[doc = "Field `CRCE` writer - Receive Data Error"]
76pub type CRCE_W<'a, const O: u8> = crate::BitWriter<'a, u16, FRMNUM_SPEC, CRCE_A, O>;
77impl<'a, const O: u8> CRCE_W<'a, O> {
78 #[doc = "No error occurred"]
79 #[inline(always)]
80 pub fn _0(self) -> &'a mut W {
81 self.variant(CRCE_A::_0)
82 }
83 #[doc = "Error occurred"]
84 #[inline(always)]
85 pub fn _1(self) -> &'a mut W {
86 self.variant(CRCE_A::_1)
87 }
88}
89#[doc = "Field `OVRN` reader - Overrun/Underrun Detection Status"]
90pub type OVRN_R = crate::BitReader<OVRN_A>;
91#[doc = "Overrun/Underrun Detection Status\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93pub enum OVRN_A {
94 #[doc = "0: No error occurred"]
95 _0 = 0,
96 #[doc = "1: Error occurred"]
97 _1 = 1,
98}
99impl From<OVRN_A> for bool {
100 #[inline(always)]
101 fn from(variant: OVRN_A) -> Self {
102 variant as u8 != 0
103 }
104}
105impl OVRN_R {
106 #[doc = "Get enumerated values variant"]
107 #[inline(always)]
108 pub fn variant(&self) -> OVRN_A {
109 match self.bits {
110 false => OVRN_A::_0,
111 true => OVRN_A::_1,
112 }
113 }
114 #[doc = "Checks if the value of the field is `_0`"]
115 #[inline(always)]
116 pub fn is_0(&self) -> bool {
117 *self == OVRN_A::_0
118 }
119 #[doc = "Checks if the value of the field is `_1`"]
120 #[inline(always)]
121 pub fn is_1(&self) -> bool {
122 *self == OVRN_A::_1
123 }
124}
125#[doc = "Field `OVRN` writer - Overrun/Underrun Detection Status"]
126pub type OVRN_W<'a, const O: u8> = crate::BitWriter<'a, u16, FRMNUM_SPEC, OVRN_A, O>;
127impl<'a, const O: u8> OVRN_W<'a, O> {
128 #[doc = "No error occurred"]
129 #[inline(always)]
130 pub fn _0(self) -> &'a mut W {
131 self.variant(OVRN_A::_0)
132 }
133 #[doc = "Error occurred"]
134 #[inline(always)]
135 pub fn _1(self) -> &'a mut W {
136 self.variant(OVRN_A::_1)
137 }
138}
139impl R {
140 #[doc = "Bits 0:10 - Frame Number"]
141 #[inline(always)]
142 pub fn frnm(&self) -> FRNM_R {
143 FRNM_R::new(self.bits & 0x07ff)
144 }
145 #[doc = "Bit 14 - Receive Data Error"]
146 #[inline(always)]
147 pub fn crce(&self) -> CRCE_R {
148 CRCE_R::new(((self.bits >> 14) & 1) != 0)
149 }
150 #[doc = "Bit 15 - Overrun/Underrun Detection Status"]
151 #[inline(always)]
152 pub fn ovrn(&self) -> OVRN_R {
153 OVRN_R::new(((self.bits >> 15) & 1) != 0)
154 }
155}
156impl W {
157 #[doc = "Bit 14 - Receive Data Error"]
158 #[inline(always)]
159 #[must_use]
160 pub fn crce(&mut self) -> CRCE_W<14> {
161 CRCE_W::new(self)
162 }
163 #[doc = "Bit 15 - Overrun/Underrun Detection Status"]
164 #[inline(always)]
165 #[must_use]
166 pub fn ovrn(&mut self) -> OVRN_W<15> {
167 OVRN_W::new(self)
168 }
169 #[doc = "Writes raw bits to the register."]
170 #[inline(always)]
171 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
172 self.0.bits(bits);
173 self
174 }
175}
176#[doc = "Frame Number Register\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 [frmnum](index.html) module"]
177pub struct FRMNUM_SPEC;
178impl crate::RegisterSpec for FRMNUM_SPEC {
179 type Ux = u16;
180}
181#[doc = "`read()` method returns [frmnum::R](R) reader structure"]
182impl crate::Readable for FRMNUM_SPEC {
183 type Reader = R;
184}
185#[doc = "`write(|w| ..)` method takes [frmnum::W](W) writer structure"]
186impl crate::Writable for FRMNUM_SPEC {
187 type Writer = W;
188 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
189 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
190}
191#[doc = "`reset()` method sets FRMNUM to value 0"]
192impl crate::Resettable for FRMNUM_SPEC {
193 const RESET_VALUE: Self::Ux = 0;
194}