nrf51_pac/uart0/
errorsrc.rs1#[doc = "Register `ERRORSRC` reader"]
2pub struct R(crate::R<ERRORSRC_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ERRORSRC_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ERRORSRC_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ERRORSRC_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ERRORSRC` writer"]
17pub struct W(crate::W<ERRORSRC_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ERRORSRC_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<ERRORSRC_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ERRORSRC_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `OVERRUN` reader - A start bit is received while the previous data still lies in RXD. (Data loss)."]
38pub type OVERRUN_R = crate::BitReader<OVERRUN_A>;
39#[doc = "A start bit is received while the previous data still lies in RXD. (Data loss).\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum OVERRUN_A {
42 #[doc = "0: Error not present."]
43 NOT_PRESENT = 0,
44 #[doc = "1: Error present."]
45 PRESENT = 1,
46}
47impl From<OVERRUN_A> for bool {
48 #[inline(always)]
49 fn from(variant: OVERRUN_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl OVERRUN_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> OVERRUN_A {
57 match self.bits {
58 false => OVERRUN_A::NOT_PRESENT,
59 true => OVERRUN_A::PRESENT,
60 }
61 }
62 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
63 #[inline(always)]
64 pub fn is_not_present(&self) -> bool {
65 *self == OVERRUN_A::NOT_PRESENT
66 }
67 #[doc = "Checks if the value of the field is `PRESENT`"]
68 #[inline(always)]
69 pub fn is_present(&self) -> bool {
70 *self == OVERRUN_A::PRESENT
71 }
72}
73#[doc = "A start bit is received while the previous data still lies in RXD. (Data loss).\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75pub enum OVERRUN_AW {
76 #[doc = "1: Clear error on write."]
77 CLEAR = 1,
78}
79impl From<OVERRUN_AW> for bool {
80 #[inline(always)]
81 fn from(variant: OVERRUN_AW) -> Self {
82 variant as u8 != 0
83 }
84}
85#[doc = "Field `OVERRUN` writer - A start bit is received while the previous data still lies in RXD. (Data loss)."]
86pub type OVERRUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERRORSRC_SPEC, OVERRUN_AW, O>;
87impl<'a, const O: u8> OVERRUN_W<'a, O> {
88 #[doc = "Clear error on write."]
89 #[inline(always)]
90 pub fn clear(self) -> &'a mut W {
91 self.variant(OVERRUN_AW::CLEAR)
92 }
93}
94#[doc = "Field `PARITY` reader - A character with bad parity is received. Only checked if HW parity control is enabled."]
95pub type PARITY_R = crate::BitReader<PARITY_A>;
96#[doc = "A character with bad parity is received. Only checked if HW parity control is enabled.\n\nValue on reset: 0"]
97#[derive(Clone, Copy, Debug, PartialEq)]
98pub enum PARITY_A {
99 #[doc = "0: Error not present."]
100 NOT_PRESENT = 0,
101 #[doc = "1: Error present."]
102 PRESENT = 1,
103}
104impl From<PARITY_A> for bool {
105 #[inline(always)]
106 fn from(variant: PARITY_A) -> Self {
107 variant as u8 != 0
108 }
109}
110impl PARITY_R {
111 #[doc = "Get enumerated values variant"]
112 #[inline(always)]
113 pub fn variant(&self) -> PARITY_A {
114 match self.bits {
115 false => PARITY_A::NOT_PRESENT,
116 true => PARITY_A::PRESENT,
117 }
118 }
119 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
120 #[inline(always)]
121 pub fn is_not_present(&self) -> bool {
122 *self == PARITY_A::NOT_PRESENT
123 }
124 #[doc = "Checks if the value of the field is `PRESENT`"]
125 #[inline(always)]
126 pub fn is_present(&self) -> bool {
127 *self == PARITY_A::PRESENT
128 }
129}
130#[doc = "A character with bad parity is received. Only checked if HW parity control is enabled.\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq)]
132pub enum PARITY_AW {
133 #[doc = "1: Clear error on write."]
134 CLEAR = 1,
135}
136impl From<PARITY_AW> for bool {
137 #[inline(always)]
138 fn from(variant: PARITY_AW) -> Self {
139 variant as u8 != 0
140 }
141}
142#[doc = "Field `PARITY` writer - A character with bad parity is received. Only checked if HW parity control is enabled."]
143pub type PARITY_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERRORSRC_SPEC, PARITY_AW, O>;
144impl<'a, const O: u8> PARITY_W<'a, O> {
145 #[doc = "Clear error on write."]
146 #[inline(always)]
147 pub fn clear(self) -> &'a mut W {
148 self.variant(PARITY_AW::CLEAR)
149 }
150}
151#[doc = "Field `FRAMING` reader - A valid stop bit is not detected on the serial data input after all bits in a character have been received."]
152pub type FRAMING_R = crate::BitReader<FRAMING_A>;
153#[doc = "A valid stop bit is not detected on the serial data input after all bits in a character have been received.\n\nValue on reset: 0"]
154#[derive(Clone, Copy, Debug, PartialEq)]
155pub enum FRAMING_A {
156 #[doc = "0: Error not present."]
157 NOT_PRESENT = 0,
158 #[doc = "1: Error present."]
159 PRESENT = 1,
160}
161impl From<FRAMING_A> for bool {
162 #[inline(always)]
163 fn from(variant: FRAMING_A) -> Self {
164 variant as u8 != 0
165 }
166}
167impl FRAMING_R {
168 #[doc = "Get enumerated values variant"]
169 #[inline(always)]
170 pub fn variant(&self) -> FRAMING_A {
171 match self.bits {
172 false => FRAMING_A::NOT_PRESENT,
173 true => FRAMING_A::PRESENT,
174 }
175 }
176 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
177 #[inline(always)]
178 pub fn is_not_present(&self) -> bool {
179 *self == FRAMING_A::NOT_PRESENT
180 }
181 #[doc = "Checks if the value of the field is `PRESENT`"]
182 #[inline(always)]
183 pub fn is_present(&self) -> bool {
184 *self == FRAMING_A::PRESENT
185 }
186}
187#[doc = "A valid stop bit is not detected on the serial data input after all bits in a character have been received.\n\nValue on reset: 0"]
188#[derive(Clone, Copy, Debug, PartialEq)]
189pub enum FRAMING_AW {
190 #[doc = "1: Clear error on write."]
191 CLEAR = 1,
192}
193impl From<FRAMING_AW> for bool {
194 #[inline(always)]
195 fn from(variant: FRAMING_AW) -> Self {
196 variant as u8 != 0
197 }
198}
199#[doc = "Field `FRAMING` writer - A valid stop bit is not detected on the serial data input after all bits in a character have been received."]
200pub type FRAMING_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERRORSRC_SPEC, FRAMING_AW, O>;
201impl<'a, const O: u8> FRAMING_W<'a, O> {
202 #[doc = "Clear error on write."]
203 #[inline(always)]
204 pub fn clear(self) -> &'a mut W {
205 self.variant(FRAMING_AW::CLEAR)
206 }
207}
208#[doc = "Field `BREAK` reader - The serial data input is '0' for longer than the length of a data frame."]
209pub type BREAK_R = crate::BitReader<BREAK_A>;
210#[doc = "The serial data input is '0' for longer than the length of a data frame.\n\nValue on reset: 0"]
211#[derive(Clone, Copy, Debug, PartialEq)]
212pub enum BREAK_A {
213 #[doc = "0: Error not present."]
214 NOT_PRESENT = 0,
215 #[doc = "1: Error present."]
216 PRESENT = 1,
217}
218impl From<BREAK_A> for bool {
219 #[inline(always)]
220 fn from(variant: BREAK_A) -> Self {
221 variant as u8 != 0
222 }
223}
224impl BREAK_R {
225 #[doc = "Get enumerated values variant"]
226 #[inline(always)]
227 pub fn variant(&self) -> BREAK_A {
228 match self.bits {
229 false => BREAK_A::NOT_PRESENT,
230 true => BREAK_A::PRESENT,
231 }
232 }
233 #[doc = "Checks if the value of the field is `NOT_PRESENT`"]
234 #[inline(always)]
235 pub fn is_not_present(&self) -> bool {
236 *self == BREAK_A::NOT_PRESENT
237 }
238 #[doc = "Checks if the value of the field is `PRESENT`"]
239 #[inline(always)]
240 pub fn is_present(&self) -> bool {
241 *self == BREAK_A::PRESENT
242 }
243}
244#[doc = "The serial data input is '0' for longer than the length of a data frame.\n\nValue on reset: 0"]
245#[derive(Clone, Copy, Debug, PartialEq)]
246pub enum BREAK_AW {
247 #[doc = "1: Clear error on write."]
248 CLEAR = 1,
249}
250impl From<BREAK_AW> for bool {
251 #[inline(always)]
252 fn from(variant: BREAK_AW) -> Self {
253 variant as u8 != 0
254 }
255}
256#[doc = "Field `BREAK` writer - The serial data input is '0' for longer than the length of a data frame."]
257pub type BREAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERRORSRC_SPEC, BREAK_AW, O>;
258impl<'a, const O: u8> BREAK_W<'a, O> {
259 #[doc = "Clear error on write."]
260 #[inline(always)]
261 pub fn clear(self) -> &'a mut W {
262 self.variant(BREAK_AW::CLEAR)
263 }
264}
265impl R {
266 #[doc = "Bit 0 - A start bit is received while the previous data still lies in RXD. (Data loss)."]
267 #[inline(always)]
268 pub fn overrun(&self) -> OVERRUN_R {
269 OVERRUN_R::new((self.bits & 1) != 0)
270 }
271 #[doc = "Bit 1 - A character with bad parity is received. Only checked if HW parity control is enabled."]
272 #[inline(always)]
273 pub fn parity(&self) -> PARITY_R {
274 PARITY_R::new(((self.bits >> 1) & 1) != 0)
275 }
276 #[doc = "Bit 2 - A valid stop bit is not detected on the serial data input after all bits in a character have been received."]
277 #[inline(always)]
278 pub fn framing(&self) -> FRAMING_R {
279 FRAMING_R::new(((self.bits >> 2) & 1) != 0)
280 }
281 #[doc = "Bit 3 - The serial data input is '0' for longer than the length of a data frame."]
282 #[inline(always)]
283 pub fn break_(&self) -> BREAK_R {
284 BREAK_R::new(((self.bits >> 3) & 1) != 0)
285 }
286}
287impl W {
288 #[doc = "Bit 0 - A start bit is received while the previous data still lies in RXD. (Data loss)."]
289 #[inline(always)]
290 pub fn overrun(&mut self) -> OVERRUN_W<0> {
291 OVERRUN_W::new(self)
292 }
293 #[doc = "Bit 1 - A character with bad parity is received. Only checked if HW parity control is enabled."]
294 #[inline(always)]
295 pub fn parity(&mut self) -> PARITY_W<1> {
296 PARITY_W::new(self)
297 }
298 #[doc = "Bit 2 - A valid stop bit is not detected on the serial data input after all bits in a character have been received."]
299 #[inline(always)]
300 pub fn framing(&mut self) -> FRAMING_W<2> {
301 FRAMING_W::new(self)
302 }
303 #[doc = "Bit 3 - The serial data input is '0' for longer than the length of a data frame."]
304 #[inline(always)]
305 pub fn break_(&mut self) -> BREAK_W<3> {
306 BREAK_W::new(self)
307 }
308 #[doc = "Writes raw bits to the register."]
309 #[inline(always)]
310 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
311 self.0.bits(bits);
312 self
313 }
314}
315#[doc = "Error source. Write error field to 1 to clear error.\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 [errorsrc](index.html) module"]
316pub struct ERRORSRC_SPEC;
317impl crate::RegisterSpec for ERRORSRC_SPEC {
318 type Ux = u32;
319}
320#[doc = "`read()` method returns [errorsrc::R](R) reader structure"]
321impl crate::Readable for ERRORSRC_SPEC {
322 type Reader = R;
323}
324#[doc = "`write(|w| ..)` method takes [errorsrc::W](W) writer structure"]
325impl crate::Writable for ERRORSRC_SPEC {
326 type Writer = W;
327}
328#[doc = "`reset()` method sets ERRORSRC to value 0"]
329impl crate::Resettable for ERRORSRC_SPEC {
330 #[inline(always)]
331 fn reset_value() -> Self::Ux {
332 0
333 }
334}