1#[doc = "Register `SR` reader"]
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `RDRF` reader - Receive Data Register Full"]
17pub type RDRF_R = crate::BitReader<RDRFSELECT_A>;
18#[doc = "Receive Data Register Full\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum RDRFSELECT_A {
21 #[doc = "0: No data has been received since the last read of RDR"]
22 _0 = 0,
23 #[doc = "1: Data has been received and the received data has been transferred from the serializer to RDR since the last readof RDR."]
24 _1 = 1,
25}
26impl From<RDRFSELECT_A> for bool {
27 #[inline(always)]
28 fn from(variant: RDRFSELECT_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl RDRF_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> RDRFSELECT_A {
36 match self.bits {
37 false => RDRFSELECT_A::_0,
38 true => RDRFSELECT_A::_1,
39 }
40 }
41 #[doc = "Checks if the value of the field is `_0`"]
42 #[inline(always)]
43 pub fn is_0(&self) -> bool {
44 *self == RDRFSELECT_A::_0
45 }
46 #[doc = "Checks if the value of the field is `_1`"]
47 #[inline(always)]
48 pub fn is_1(&self) -> bool {
49 *self == RDRFSELECT_A::_1
50 }
51}
52#[doc = "Field `TDRE` reader - Transmit Data Register Empty"]
53pub type TDRE_R = crate::BitReader<TDRESELECT_A>;
54#[doc = "Transmit Data Register Empty\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum TDRESELECT_A {
57 #[doc = "0: Data has been written to TDR and not yet transferred to the serializer."]
58 _0 = 0,
59 #[doc = "1: The last data written in the Transmit Data Register has been transferred to the serializer.TDRE equals zero when the SPI is disabled or at reset. The SPI enable command sets this bit to one."]
60 _1 = 1,
61}
62impl From<TDRESELECT_A> for bool {
63 #[inline(always)]
64 fn from(variant: TDRESELECT_A) -> Self {
65 variant as u8 != 0
66 }
67}
68impl TDRE_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> TDRESELECT_A {
72 match self.bits {
73 false => TDRESELECT_A::_0,
74 true => TDRESELECT_A::_1,
75 }
76 }
77 #[doc = "Checks if the value of the field is `_0`"]
78 #[inline(always)]
79 pub fn is_0(&self) -> bool {
80 *self == TDRESELECT_A::_0
81 }
82 #[doc = "Checks if the value of the field is `_1`"]
83 #[inline(always)]
84 pub fn is_1(&self) -> bool {
85 *self == TDRESELECT_A::_1
86 }
87}
88#[doc = "Field `MODF` reader - Mode Fault Error"]
89pub type MODF_R = crate::BitReader<MODFSELECT_A>;
90#[doc = "Mode Fault Error\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum MODFSELECT_A {
93 #[doc = "0: No Mode Fault has been detected since the last read of SR."]
94 _0 = 0,
95 #[doc = "1: A Mode Fault occurred since the last read of the SR."]
96 _1 = 1,
97}
98impl From<MODFSELECT_A> for bool {
99 #[inline(always)]
100 fn from(variant: MODFSELECT_A) -> Self {
101 variant as u8 != 0
102 }
103}
104impl MODF_R {
105 #[doc = "Get enumerated values variant"]
106 #[inline(always)]
107 pub fn variant(&self) -> MODFSELECT_A {
108 match self.bits {
109 false => MODFSELECT_A::_0,
110 true => MODFSELECT_A::_1,
111 }
112 }
113 #[doc = "Checks if the value of the field is `_0`"]
114 #[inline(always)]
115 pub fn is_0(&self) -> bool {
116 *self == MODFSELECT_A::_0
117 }
118 #[doc = "Checks if the value of the field is `_1`"]
119 #[inline(always)]
120 pub fn is_1(&self) -> bool {
121 *self == MODFSELECT_A::_1
122 }
123}
124#[doc = "Field `OVRES` reader - Overrun Error Status"]
125pub type OVRES_R = crate::BitReader<OVRESSELECT_A>;
126#[doc = "Overrun Error Status\n\nValue on reset: 0"]
127#[derive(Clone, Copy, Debug, PartialEq, Eq)]
128pub enum OVRESSELECT_A {
129 #[doc = "0: No overrun has been detected since the last read of SR."]
130 _0 = 0,
131 #[doc = "1: An overrun has occurred since the last read of SR."]
132 _1 = 1,
133}
134impl From<OVRESSELECT_A> for bool {
135 #[inline(always)]
136 fn from(variant: OVRESSELECT_A) -> Self {
137 variant as u8 != 0
138 }
139}
140impl OVRES_R {
141 #[doc = "Get enumerated values variant"]
142 #[inline(always)]
143 pub fn variant(&self) -> OVRESSELECT_A {
144 match self.bits {
145 false => OVRESSELECT_A::_0,
146 true => OVRESSELECT_A::_1,
147 }
148 }
149 #[doc = "Checks if the value of the field is `_0`"]
150 #[inline(always)]
151 pub fn is_0(&self) -> bool {
152 *self == OVRESSELECT_A::_0
153 }
154 #[doc = "Checks if the value of the field is `_1`"]
155 #[inline(always)]
156 pub fn is_1(&self) -> bool {
157 *self == OVRESSELECT_A::_1
158 }
159}
160#[doc = "Field `ENDRX` reader - End of RX buffer"]
161pub type ENDRX_R = crate::BitReader<ENDRXSELECT_A>;
162#[doc = "End of RX buffer\n\nValue on reset: 1"]
163#[derive(Clone, Copy, Debug, PartialEq, Eq)]
164pub enum ENDRXSELECT_A {
165 #[doc = "0: The Receive Counter Register has not reached 0 since the last write in RCR or RNCR."]
166 _0 = 0,
167 #[doc = "1: The Receive Counter Register has reached 0 since the last write in RCR or RNCR."]
168 _1 = 1,
169}
170impl From<ENDRXSELECT_A> for bool {
171 #[inline(always)]
172 fn from(variant: ENDRXSELECT_A) -> Self {
173 variant as u8 != 0
174 }
175}
176impl ENDRX_R {
177 #[doc = "Get enumerated values variant"]
178 #[inline(always)]
179 pub fn variant(&self) -> ENDRXSELECT_A {
180 match self.bits {
181 false => ENDRXSELECT_A::_0,
182 true => ENDRXSELECT_A::_1,
183 }
184 }
185 #[doc = "Checks if the value of the field is `_0`"]
186 #[inline(always)]
187 pub fn is_0(&self) -> bool {
188 *self == ENDRXSELECT_A::_0
189 }
190 #[doc = "Checks if the value of the field is `_1`"]
191 #[inline(always)]
192 pub fn is_1(&self) -> bool {
193 *self == ENDRXSELECT_A::_1
194 }
195}
196#[doc = "Field `ENDTX` reader - End of TX buffer"]
197pub type ENDTX_R = crate::BitReader<ENDTXSELECT_A>;
198#[doc = "End of TX buffer\n\nValue on reset: 1"]
199#[derive(Clone, Copy, Debug, PartialEq, Eq)]
200pub enum ENDTXSELECT_A {
201 #[doc = "0: The Transmit Counter Register has not reached 0 since the last write in TCR or TNCR."]
202 _0 = 0,
203 #[doc = "1: The Transmit Counter Register has reached 0 since the last write in TCR or TNCR."]
204 _1 = 1,
205}
206impl From<ENDTXSELECT_A> for bool {
207 #[inline(always)]
208 fn from(variant: ENDTXSELECT_A) -> Self {
209 variant as u8 != 0
210 }
211}
212impl ENDTX_R {
213 #[doc = "Get enumerated values variant"]
214 #[inline(always)]
215 pub fn variant(&self) -> ENDTXSELECT_A {
216 match self.bits {
217 false => ENDTXSELECT_A::_0,
218 true => ENDTXSELECT_A::_1,
219 }
220 }
221 #[doc = "Checks if the value of the field is `_0`"]
222 #[inline(always)]
223 pub fn is_0(&self) -> bool {
224 *self == ENDTXSELECT_A::_0
225 }
226 #[doc = "Checks if the value of the field is `_1`"]
227 #[inline(always)]
228 pub fn is_1(&self) -> bool {
229 *self == ENDTXSELECT_A::_1
230 }
231}
232#[doc = "Field `RXBUFF` reader - RX Buffer Full"]
233pub type RXBUFF_R = crate::BitReader<RXBUFFSELECT_A>;
234#[doc = "RX Buffer Full\n\nValue on reset: 1"]
235#[derive(Clone, Copy, Debug, PartialEq, Eq)]
236pub enum RXBUFFSELECT_A {
237 #[doc = "0: RCR or RNCR has a value other than 0."]
238 _0 = 0,
239 #[doc = "1: Both RCR and RNCR has a value of 0."]
240 _1 = 1,
241}
242impl From<RXBUFFSELECT_A> for bool {
243 #[inline(always)]
244 fn from(variant: RXBUFFSELECT_A) -> Self {
245 variant as u8 != 0
246 }
247}
248impl RXBUFF_R {
249 #[doc = "Get enumerated values variant"]
250 #[inline(always)]
251 pub fn variant(&self) -> RXBUFFSELECT_A {
252 match self.bits {
253 false => RXBUFFSELECT_A::_0,
254 true => RXBUFFSELECT_A::_1,
255 }
256 }
257 #[doc = "Checks if the value of the field is `_0`"]
258 #[inline(always)]
259 pub fn is_0(&self) -> bool {
260 *self == RXBUFFSELECT_A::_0
261 }
262 #[doc = "Checks if the value of the field is `_1`"]
263 #[inline(always)]
264 pub fn is_1(&self) -> bool {
265 *self == RXBUFFSELECT_A::_1
266 }
267}
268#[doc = "Field `TXBUFE` reader - TX Buffer Empty"]
269pub type TXBUFE_R = crate::BitReader<TXBUFESELECT_A>;
270#[doc = "TX Buffer Empty\n\nValue on reset: 1"]
271#[derive(Clone, Copy, Debug, PartialEq, Eq)]
272pub enum TXBUFESELECT_A {
273 #[doc = "0: TCR or TNCR has a value other than 0."]
274 _0 = 0,
275 #[doc = "1: Both TCR and TNCR has a value of 0."]
276 _1 = 1,
277}
278impl From<TXBUFESELECT_A> for bool {
279 #[inline(always)]
280 fn from(variant: TXBUFESELECT_A) -> Self {
281 variant as u8 != 0
282 }
283}
284impl TXBUFE_R {
285 #[doc = "Get enumerated values variant"]
286 #[inline(always)]
287 pub fn variant(&self) -> TXBUFESELECT_A {
288 match self.bits {
289 false => TXBUFESELECT_A::_0,
290 true => TXBUFESELECT_A::_1,
291 }
292 }
293 #[doc = "Checks if the value of the field is `_0`"]
294 #[inline(always)]
295 pub fn is_0(&self) -> bool {
296 *self == TXBUFESELECT_A::_0
297 }
298 #[doc = "Checks if the value of the field is `_1`"]
299 #[inline(always)]
300 pub fn is_1(&self) -> bool {
301 *self == TXBUFESELECT_A::_1
302 }
303}
304#[doc = "Field `NSSR` reader - NSS Rising"]
305pub type NSSR_R = crate::BitReader<NSSRSELECT_A>;
306#[doc = "NSS Rising\n\nValue on reset: 0"]
307#[derive(Clone, Copy, Debug, PartialEq, Eq)]
308pub enum NSSRSELECT_A {
309 #[doc = "0: No rising edge detected on NSS pin since last read."]
310 _0 = 0,
311 #[doc = "1: A rising edge occurred on NSS pin since last read."]
312 _1 = 1,
313}
314impl From<NSSRSELECT_A> for bool {
315 #[inline(always)]
316 fn from(variant: NSSRSELECT_A) -> Self {
317 variant as u8 != 0
318 }
319}
320impl NSSR_R {
321 #[doc = "Get enumerated values variant"]
322 #[inline(always)]
323 pub fn variant(&self) -> NSSRSELECT_A {
324 match self.bits {
325 false => NSSRSELECT_A::_0,
326 true => NSSRSELECT_A::_1,
327 }
328 }
329 #[doc = "Checks if the value of the field is `_0`"]
330 #[inline(always)]
331 pub fn is_0(&self) -> bool {
332 *self == NSSRSELECT_A::_0
333 }
334 #[doc = "Checks if the value of the field is `_1`"]
335 #[inline(always)]
336 pub fn is_1(&self) -> bool {
337 *self == NSSRSELECT_A::_1
338 }
339}
340#[doc = "Field `TXEMPTY` reader - Transmission Registers Empty"]
341pub type TXEMPTY_R = crate::BitReader<TXEMPTYSELECT_A>;
342#[doc = "Transmission Registers Empty\n\nValue on reset: 0"]
343#[derive(Clone, Copy, Debug, PartialEq, Eq)]
344pub enum TXEMPTYSELECT_A {
345 #[doc = "0: As soon as data is written in TDR."]
346 _0 = 0,
347 #[doc = "1: TDR and internal shifter are empty. If a transfer delay has been defined, TXEMPTY is set after the completion ofsuch delay."]
348 _1 = 1,
349}
350impl From<TXEMPTYSELECT_A> for bool {
351 #[inline(always)]
352 fn from(variant: TXEMPTYSELECT_A) -> Self {
353 variant as u8 != 0
354 }
355}
356impl TXEMPTY_R {
357 #[doc = "Get enumerated values variant"]
358 #[inline(always)]
359 pub fn variant(&self) -> TXEMPTYSELECT_A {
360 match self.bits {
361 false => TXEMPTYSELECT_A::_0,
362 true => TXEMPTYSELECT_A::_1,
363 }
364 }
365 #[doc = "Checks if the value of the field is `_0`"]
366 #[inline(always)]
367 pub fn is_0(&self) -> bool {
368 *self == TXEMPTYSELECT_A::_0
369 }
370 #[doc = "Checks if the value of the field is `_1`"]
371 #[inline(always)]
372 pub fn is_1(&self) -> bool {
373 *self == TXEMPTYSELECT_A::_1
374 }
375}
376#[doc = "Field `UNDES` reader - Underrun Error Status (Slave Mode Only)"]
377pub type UNDES_R = crate::BitReader<bool>;
378#[doc = "Field `SPIENS` reader - SPI Enable Status"]
379pub type SPIENS_R = crate::BitReader<SPIENSSELECT_A>;
380#[doc = "SPI Enable Status\n\nValue on reset: 0"]
381#[derive(Clone, Copy, Debug, PartialEq, Eq)]
382pub enum SPIENSSELECT_A {
383 #[doc = "0: SPI is disabled."]
384 _0 = 0,
385 #[doc = "1: SPI is enabled."]
386 _1 = 1,
387}
388impl From<SPIENSSELECT_A> for bool {
389 #[inline(always)]
390 fn from(variant: SPIENSSELECT_A) -> Self {
391 variant as u8 != 0
392 }
393}
394impl SPIENS_R {
395 #[doc = "Get enumerated values variant"]
396 #[inline(always)]
397 pub fn variant(&self) -> SPIENSSELECT_A {
398 match self.bits {
399 false => SPIENSSELECT_A::_0,
400 true => SPIENSSELECT_A::_1,
401 }
402 }
403 #[doc = "Checks if the value of the field is `_0`"]
404 #[inline(always)]
405 pub fn is_0(&self) -> bool {
406 *self == SPIENSSELECT_A::_0
407 }
408 #[doc = "Checks if the value of the field is `_1`"]
409 #[inline(always)]
410 pub fn is_1(&self) -> bool {
411 *self == SPIENSSELECT_A::_1
412 }
413}
414impl R {
415 #[doc = "Bit 0 - Receive Data Register Full"]
416 #[inline(always)]
417 pub fn rdrf(&self) -> RDRF_R {
418 RDRF_R::new((self.bits & 1) != 0)
419 }
420 #[doc = "Bit 1 - Transmit Data Register Empty"]
421 #[inline(always)]
422 pub fn tdre(&self) -> TDRE_R {
423 TDRE_R::new(((self.bits >> 1) & 1) != 0)
424 }
425 #[doc = "Bit 2 - Mode Fault Error"]
426 #[inline(always)]
427 pub fn modf(&self) -> MODF_R {
428 MODF_R::new(((self.bits >> 2) & 1) != 0)
429 }
430 #[doc = "Bit 3 - Overrun Error Status"]
431 #[inline(always)]
432 pub fn ovres(&self) -> OVRES_R {
433 OVRES_R::new(((self.bits >> 3) & 1) != 0)
434 }
435 #[doc = "Bit 4 - End of RX buffer"]
436 #[inline(always)]
437 pub fn endrx(&self) -> ENDRX_R {
438 ENDRX_R::new(((self.bits >> 4) & 1) != 0)
439 }
440 #[doc = "Bit 5 - End of TX buffer"]
441 #[inline(always)]
442 pub fn endtx(&self) -> ENDTX_R {
443 ENDTX_R::new(((self.bits >> 5) & 1) != 0)
444 }
445 #[doc = "Bit 6 - RX Buffer Full"]
446 #[inline(always)]
447 pub fn rxbuff(&self) -> RXBUFF_R {
448 RXBUFF_R::new(((self.bits >> 6) & 1) != 0)
449 }
450 #[doc = "Bit 7 - TX Buffer Empty"]
451 #[inline(always)]
452 pub fn txbufe(&self) -> TXBUFE_R {
453 TXBUFE_R::new(((self.bits >> 7) & 1) != 0)
454 }
455 #[doc = "Bit 8 - NSS Rising"]
456 #[inline(always)]
457 pub fn nssr(&self) -> NSSR_R {
458 NSSR_R::new(((self.bits >> 8) & 1) != 0)
459 }
460 #[doc = "Bit 9 - Transmission Registers Empty"]
461 #[inline(always)]
462 pub fn txempty(&self) -> TXEMPTY_R {
463 TXEMPTY_R::new(((self.bits >> 9) & 1) != 0)
464 }
465 #[doc = "Bit 10 - Underrun Error Status (Slave Mode Only)"]
466 #[inline(always)]
467 pub fn undes(&self) -> UNDES_R {
468 UNDES_R::new(((self.bits >> 10) & 1) != 0)
469 }
470 #[doc = "Bit 16 - SPI Enable Status"]
471 #[inline(always)]
472 pub fn spiens(&self) -> SPIENS_R {
473 SPIENS_R::new(((self.bits >> 16) & 1) != 0)
474 }
475}
476#[doc = "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 [sr](index.html) module"]
477pub struct SR_SPEC;
478impl crate::RegisterSpec for SR_SPEC {
479 type Ux = u32;
480}
481#[doc = "`read()` method returns [sr::R](R) reader structure"]
482impl crate::Readable for SR_SPEC {
483 type Reader = R;
484}
485#[doc = "`reset()` method sets SR to value 0xf0"]
486impl crate::Resettable for SR_SPEC {
487 const RESET_VALUE: Self::Ux = 0xf0;
488}