1#[doc = "Register `SPSR` reader"]
2pub struct R(crate::R<SPSR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SPSR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SPSR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SPSR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SPSR` writer"]
17pub struct W(crate::W<SPSR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SPSR_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<SPSR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SPSR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `OVRF` reader - Overrun Error Flag\n\nThe field is **modified** in some way after a read operation."]
38pub type OVRF_R = crate::BitReader<OVRF_A>;
39#[doc = "Overrun Error Flag\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum OVRF_A {
42 #[doc = "0: No overrun error occurs"]
43 _0 = 0,
44 #[doc = "1: An overrun error occurs"]
45 _1 = 1,
46}
47impl From<OVRF_A> for bool {
48 #[inline(always)]
49 fn from(variant: OVRF_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl OVRF_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> OVRF_A {
57 match self.bits {
58 false => OVRF_A::_0,
59 true => OVRF_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == OVRF_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == OVRF_A::_1
71 }
72}
73#[doc = "Field `OVRF` writer - Overrun Error Flag"]
74pub type OVRF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, SPSR_SPEC, OVRF_A, O>;
75impl<'a, const O: u8> OVRF_W<'a, O> {
76 #[doc = "No overrun error occurs"]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(OVRF_A::_0)
80 }
81 #[doc = "An overrun error occurs"]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(OVRF_A::_1)
85 }
86}
87#[doc = "Field `IDLNF` reader - SPI Idle Flag"]
88pub type IDLNF_R = crate::BitReader<IDLNF_A>;
89#[doc = "SPI Idle Flag\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum IDLNF_A {
92 #[doc = "0: SPI is in the idle state"]
93 _0 = 0,
94 #[doc = "1: SPI is in the transfer state"]
95 _1 = 1,
96}
97impl From<IDLNF_A> for bool {
98 #[inline(always)]
99 fn from(variant: IDLNF_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl IDLNF_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> IDLNF_A {
107 match self.bits {
108 false => IDLNF_A::_0,
109 true => IDLNF_A::_1,
110 }
111 }
112 #[doc = "Checks if the value of the field is `_0`"]
113 #[inline(always)]
114 pub fn is_0(&self) -> bool {
115 *self == IDLNF_A::_0
116 }
117 #[doc = "Checks if the value of the field is `_1`"]
118 #[inline(always)]
119 pub fn is_1(&self) -> bool {
120 *self == IDLNF_A::_1
121 }
122}
123#[doc = "Field `MODF` reader - Mode Fault Error Flag\n\nThe field is **modified** in some way after a read operation."]
124pub type MODF_R = crate::BitReader<MODF_A>;
125#[doc = "Mode Fault Error Flag\n\nValue on reset: 0"]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum MODF_A {
128 #[doc = "0: Neither mode fault error nor underrun error occurs"]
129 _0 = 0,
130 #[doc = "1: A mode fault error or an underrun error occurs."]
131 _1 = 1,
132}
133impl From<MODF_A> for bool {
134 #[inline(always)]
135 fn from(variant: MODF_A) -> Self {
136 variant as u8 != 0
137 }
138}
139impl MODF_R {
140 #[doc = "Get enumerated values variant"]
141 #[inline(always)]
142 pub fn variant(&self) -> MODF_A {
143 match self.bits {
144 false => MODF_A::_0,
145 true => MODF_A::_1,
146 }
147 }
148 #[doc = "Checks if the value of the field is `_0`"]
149 #[inline(always)]
150 pub fn is_0(&self) -> bool {
151 *self == MODF_A::_0
152 }
153 #[doc = "Checks if the value of the field is `_1`"]
154 #[inline(always)]
155 pub fn is_1(&self) -> bool {
156 *self == MODF_A::_1
157 }
158}
159#[doc = "Field `MODF` writer - Mode Fault Error Flag"]
160pub type MODF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, SPSR_SPEC, MODF_A, O>;
161impl<'a, const O: u8> MODF_W<'a, O> {
162 #[doc = "Neither mode fault error nor underrun error occurs"]
163 #[inline(always)]
164 pub fn _0(self) -> &'a mut W {
165 self.variant(MODF_A::_0)
166 }
167 #[doc = "A mode fault error or an underrun error occurs."]
168 #[inline(always)]
169 pub fn _1(self) -> &'a mut W {
170 self.variant(MODF_A::_1)
171 }
172}
173#[doc = "Field `PERF` reader - Parity Error Flag\n\nThe field is **modified** in some way after a read operation."]
174pub type PERF_R = crate::BitReader<PERF_A>;
175#[doc = "Parity Error Flag\n\nValue on reset: 0"]
176#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177pub enum PERF_A {
178 #[doc = "0: No parity error occurs"]
179 _0 = 0,
180 #[doc = "1: A parity error occurs"]
181 _1 = 1,
182}
183impl From<PERF_A> for bool {
184 #[inline(always)]
185 fn from(variant: PERF_A) -> Self {
186 variant as u8 != 0
187 }
188}
189impl PERF_R {
190 #[doc = "Get enumerated values variant"]
191 #[inline(always)]
192 pub fn variant(&self) -> PERF_A {
193 match self.bits {
194 false => PERF_A::_0,
195 true => PERF_A::_1,
196 }
197 }
198 #[doc = "Checks if the value of the field is `_0`"]
199 #[inline(always)]
200 pub fn is_0(&self) -> bool {
201 *self == PERF_A::_0
202 }
203 #[doc = "Checks if the value of the field is `_1`"]
204 #[inline(always)]
205 pub fn is_1(&self) -> bool {
206 *self == PERF_A::_1
207 }
208}
209#[doc = "Field `PERF` writer - Parity Error Flag"]
210pub type PERF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, SPSR_SPEC, PERF_A, O>;
211impl<'a, const O: u8> PERF_W<'a, O> {
212 #[doc = "No parity error occurs"]
213 #[inline(always)]
214 pub fn _0(self) -> &'a mut W {
215 self.variant(PERF_A::_0)
216 }
217 #[doc = "A parity error occurs"]
218 #[inline(always)]
219 pub fn _1(self) -> &'a mut W {
220 self.variant(PERF_A::_1)
221 }
222}
223#[doc = "Field `UDRF` reader - Underrun Error Flag(When MODF is 0, This bit is invalid.)\n\nThe field is **modified** in some way after a read operation."]
224pub type UDRF_R = crate::BitReader<UDRF_A>;
225#[doc = "Underrun Error Flag(When MODF is 0, This bit is invalid.)\n\nValue on reset: 0"]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227pub enum UDRF_A {
228 #[doc = "0: A mode fault error occurs (MODF=1)"]
229 _0 = 0,
230 #[doc = "1: An underrun error occurs (MODF=1)"]
231 _1 = 1,
232}
233impl From<UDRF_A> for bool {
234 #[inline(always)]
235 fn from(variant: UDRF_A) -> Self {
236 variant as u8 != 0
237 }
238}
239impl UDRF_R {
240 #[doc = "Get enumerated values variant"]
241 #[inline(always)]
242 pub fn variant(&self) -> UDRF_A {
243 match self.bits {
244 false => UDRF_A::_0,
245 true => UDRF_A::_1,
246 }
247 }
248 #[doc = "Checks if the value of the field is `_0`"]
249 #[inline(always)]
250 pub fn is_0(&self) -> bool {
251 *self == UDRF_A::_0
252 }
253 #[doc = "Checks if the value of the field is `_1`"]
254 #[inline(always)]
255 pub fn is_1(&self) -> bool {
256 *self == UDRF_A::_1
257 }
258}
259#[doc = "Field `UDRF` writer - Underrun Error Flag(When MODF is 0, This bit is invalid.)"]
260pub type UDRF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, SPSR_SPEC, UDRF_A, O>;
261impl<'a, const O: u8> UDRF_W<'a, O> {
262 #[doc = "A mode fault error occurs (MODF=1)"]
263 #[inline(always)]
264 pub fn _0(self) -> &'a mut W {
265 self.variant(UDRF_A::_0)
266 }
267 #[doc = "An underrun error occurs (MODF=1)"]
268 #[inline(always)]
269 pub fn _1(self) -> &'a mut W {
270 self.variant(UDRF_A::_1)
271 }
272}
273#[doc = "Field `SPTEF` reader - SPI Transmit Buffer Empty Flag\n\nThe field is **modified** in some way after a read operation."]
274pub type SPTEF_R = crate::BitReader<SPTEF_A>;
275#[doc = "SPI Transmit Buffer Empty Flag\n\nValue on reset: 1"]
276#[derive(Clone, Copy, Debug, PartialEq, Eq)]
277pub enum SPTEF_A {
278 #[doc = "0: Data found in the transmit buffer"]
279 _0 = 0,
280 #[doc = "1: No data in the transmit buffer"]
281 _1 = 1,
282}
283impl From<SPTEF_A> for bool {
284 #[inline(always)]
285 fn from(variant: SPTEF_A) -> Self {
286 variant as u8 != 0
287 }
288}
289impl SPTEF_R {
290 #[doc = "Get enumerated values variant"]
291 #[inline(always)]
292 pub fn variant(&self) -> SPTEF_A {
293 match self.bits {
294 false => SPTEF_A::_0,
295 true => SPTEF_A::_1,
296 }
297 }
298 #[doc = "Checks if the value of the field is `_0`"]
299 #[inline(always)]
300 pub fn is_0(&self) -> bool {
301 *self == SPTEF_A::_0
302 }
303 #[doc = "Checks if the value of the field is `_1`"]
304 #[inline(always)]
305 pub fn is_1(&self) -> bool {
306 *self == SPTEF_A::_1
307 }
308}
309#[doc = "Field `SPTEF` writer - SPI Transmit Buffer Empty Flag"]
310pub type SPTEF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, SPSR_SPEC, SPTEF_A, O>;
311impl<'a, const O: u8> SPTEF_W<'a, O> {
312 #[doc = "Data found in the transmit buffer"]
313 #[inline(always)]
314 pub fn _0(self) -> &'a mut W {
315 self.variant(SPTEF_A::_0)
316 }
317 #[doc = "No data in the transmit buffer"]
318 #[inline(always)]
319 pub fn _1(self) -> &'a mut W {
320 self.variant(SPTEF_A::_1)
321 }
322}
323#[doc = "Field `SPRF` reader - SPI Receive Buffer Full Flag\n\nThe field is **modified** in some way after a read operation."]
324pub type SPRF_R = crate::BitReader<SPRF_A>;
325#[doc = "SPI Receive Buffer Full Flag\n\nValue on reset: 0"]
326#[derive(Clone, Copy, Debug, PartialEq, Eq)]
327pub enum SPRF_A {
328 #[doc = "0: No valid data in SPDR"]
329 _0 = 0,
330 #[doc = "1: Valid data found in SPDR"]
331 _1 = 1,
332}
333impl From<SPRF_A> for bool {
334 #[inline(always)]
335 fn from(variant: SPRF_A) -> Self {
336 variant as u8 != 0
337 }
338}
339impl SPRF_R {
340 #[doc = "Get enumerated values variant"]
341 #[inline(always)]
342 pub fn variant(&self) -> SPRF_A {
343 match self.bits {
344 false => SPRF_A::_0,
345 true => SPRF_A::_1,
346 }
347 }
348 #[doc = "Checks if the value of the field is `_0`"]
349 #[inline(always)]
350 pub fn is_0(&self) -> bool {
351 *self == SPRF_A::_0
352 }
353 #[doc = "Checks if the value of the field is `_1`"]
354 #[inline(always)]
355 pub fn is_1(&self) -> bool {
356 *self == SPRF_A::_1
357 }
358}
359#[doc = "Field `SPRF` writer - SPI Receive Buffer Full Flag"]
360pub type SPRF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, SPSR_SPEC, SPRF_A, O>;
361impl<'a, const O: u8> SPRF_W<'a, O> {
362 #[doc = "No valid data in SPDR"]
363 #[inline(always)]
364 pub fn _0(self) -> &'a mut W {
365 self.variant(SPRF_A::_0)
366 }
367 #[doc = "Valid data found in SPDR"]
368 #[inline(always)]
369 pub fn _1(self) -> &'a mut W {
370 self.variant(SPRF_A::_1)
371 }
372}
373impl R {
374 #[doc = "Bit 0 - Overrun Error Flag"]
375 #[inline(always)]
376 pub fn ovrf(&self) -> OVRF_R {
377 OVRF_R::new((self.bits & 1) != 0)
378 }
379 #[doc = "Bit 1 - SPI Idle Flag"]
380 #[inline(always)]
381 pub fn idlnf(&self) -> IDLNF_R {
382 IDLNF_R::new(((self.bits >> 1) & 1) != 0)
383 }
384 #[doc = "Bit 2 - Mode Fault Error Flag"]
385 #[inline(always)]
386 pub fn modf(&self) -> MODF_R {
387 MODF_R::new(((self.bits >> 2) & 1) != 0)
388 }
389 #[doc = "Bit 3 - Parity Error Flag"]
390 #[inline(always)]
391 pub fn perf(&self) -> PERF_R {
392 PERF_R::new(((self.bits >> 3) & 1) != 0)
393 }
394 #[doc = "Bit 4 - Underrun Error Flag(When MODF is 0, This bit is invalid.)"]
395 #[inline(always)]
396 pub fn udrf(&self) -> UDRF_R {
397 UDRF_R::new(((self.bits >> 4) & 1) != 0)
398 }
399 #[doc = "Bit 5 - SPI Transmit Buffer Empty Flag"]
400 #[inline(always)]
401 pub fn sptef(&self) -> SPTEF_R {
402 SPTEF_R::new(((self.bits >> 5) & 1) != 0)
403 }
404 #[doc = "Bit 7 - SPI Receive Buffer Full Flag"]
405 #[inline(always)]
406 pub fn sprf(&self) -> SPRF_R {
407 SPRF_R::new(((self.bits >> 7) & 1) != 0)
408 }
409}
410impl W {
411 #[doc = "Bit 0 - Overrun Error Flag"]
412 #[inline(always)]
413 #[must_use]
414 pub fn ovrf(&mut self) -> OVRF_W<0> {
415 OVRF_W::new(self)
416 }
417 #[doc = "Bit 2 - Mode Fault Error Flag"]
418 #[inline(always)]
419 #[must_use]
420 pub fn modf(&mut self) -> MODF_W<2> {
421 MODF_W::new(self)
422 }
423 #[doc = "Bit 3 - Parity Error Flag"]
424 #[inline(always)]
425 #[must_use]
426 pub fn perf(&mut self) -> PERF_W<3> {
427 PERF_W::new(self)
428 }
429 #[doc = "Bit 4 - Underrun Error Flag(When MODF is 0, This bit is invalid.)"]
430 #[inline(always)]
431 #[must_use]
432 pub fn udrf(&mut self) -> UDRF_W<4> {
433 UDRF_W::new(self)
434 }
435 #[doc = "Bit 5 - SPI Transmit Buffer Empty Flag"]
436 #[inline(always)]
437 #[must_use]
438 pub fn sptef(&mut self) -> SPTEF_W<5> {
439 SPTEF_W::new(self)
440 }
441 #[doc = "Bit 7 - SPI Receive Buffer Full Flag"]
442 #[inline(always)]
443 #[must_use]
444 pub fn sprf(&mut self) -> SPRF_W<7> {
445 SPRF_W::new(self)
446 }
447 #[doc = "Writes raw bits to the register."]
448 #[inline(always)]
449 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
450 self.0.bits(bits);
451 self
452 }
453}
454#[doc = "SPI Status 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 [spsr](index.html) module"]
455pub struct SPSR_SPEC;
456impl crate::RegisterSpec for SPSR_SPEC {
457 type Ux = u8;
458}
459#[doc = "`read()` method returns [spsr::R](R) reader structure"]
460impl crate::Readable for SPSR_SPEC {
461 type Reader = R;
462}
463#[doc = "`write(|w| ..)` method takes [spsr::W](W) writer structure"]
464impl crate::Writable for SPSR_SPEC {
465 type Writer = W;
466 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0xbd;
467 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
468}
469#[doc = "`reset()` method sets SPSR to value 0x20"]
470impl crate::Resettable for SPSR_SPEC {
471 const RESET_VALUE: Self::Ux = 0x20;
472}