Skip to main content

mcxa_pac/lpspi0/
sr.rs

1#[doc = "Register `SR` reader"]
2pub type R = crate::R<SrSpec>;
3#[doc = "Register `SR` writer"]
4pub type W = crate::W<SrSpec>;
5#[doc = "Transmit Data Flag\n\nValue on reset: 1"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Tdf {
9    #[doc = "0: Transmit data not requested"]
10    TxdataNotReqst = 0,
11    #[doc = "1: Transmit data requested"]
12    TxdataReqst = 1,
13}
14impl From<Tdf> for bool {
15    #[inline(always)]
16    fn from(variant: Tdf) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `TDF` reader - Transmit Data Flag"]
21pub type TdfR = crate::BitReader<Tdf>;
22impl TdfR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Tdf {
26        match self.bits {
27            false => Tdf::TxdataNotReqst,
28            true => Tdf::TxdataReqst,
29        }
30    }
31    #[doc = "Transmit data not requested"]
32    #[inline(always)]
33    pub fn is_txdata_not_reqst(&self) -> bool {
34        *self == Tdf::TxdataNotReqst
35    }
36    #[doc = "Transmit data requested"]
37    #[inline(always)]
38    pub fn is_txdata_reqst(&self) -> bool {
39        *self == Tdf::TxdataReqst
40    }
41}
42#[doc = "Receive Data Flag\n\nValue on reset: 0"]
43#[cfg_attr(feature = "defmt", derive(defmt::Format))]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum Rdf {
46    #[doc = "0: Receive data not ready"]
47    Notready = 0,
48    #[doc = "1: Receive data ready"]
49    Ready = 1,
50}
51impl From<Rdf> for bool {
52    #[inline(always)]
53    fn from(variant: Rdf) -> Self {
54        variant as u8 != 0
55    }
56}
57#[doc = "Field `RDF` reader - Receive Data Flag"]
58pub type RdfR = crate::BitReader<Rdf>;
59impl RdfR {
60    #[doc = "Get enumerated values variant"]
61    #[inline(always)]
62    pub const fn variant(&self) -> Rdf {
63        match self.bits {
64            false => Rdf::Notready,
65            true => Rdf::Ready,
66        }
67    }
68    #[doc = "Receive data not ready"]
69    #[inline(always)]
70    pub fn is_notready(&self) -> bool {
71        *self == Rdf::Notready
72    }
73    #[doc = "Receive data ready"]
74    #[inline(always)]
75    pub fn is_ready(&self) -> bool {
76        *self == Rdf::Ready
77    }
78}
79#[doc = "Word Complete Flag\n\nValue on reset: 0"]
80#[cfg_attr(feature = "defmt", derive(defmt::Format))]
81#[derive(Clone, Copy, Debug, PartialEq, Eq)]
82pub enum Wcf {
83    #[doc = "0: Not complete"]
84    NotCompleted = 0,
85    #[doc = "1: Complete"]
86    Completed = 1,
87}
88impl From<Wcf> for bool {
89    #[inline(always)]
90    fn from(variant: Wcf) -> Self {
91        variant as u8 != 0
92    }
93}
94#[doc = "Field `WCF` reader - Word Complete Flag"]
95pub type WcfR = crate::BitReader<Wcf>;
96impl WcfR {
97    #[doc = "Get enumerated values variant"]
98    #[inline(always)]
99    pub const fn variant(&self) -> Wcf {
100        match self.bits {
101            false => Wcf::NotCompleted,
102            true => Wcf::Completed,
103        }
104    }
105    #[doc = "Not complete"]
106    #[inline(always)]
107    pub fn is_not_completed(&self) -> bool {
108        *self == Wcf::NotCompleted
109    }
110    #[doc = "Complete"]
111    #[inline(always)]
112    pub fn is_completed(&self) -> bool {
113        *self == Wcf::Completed
114    }
115}
116#[doc = "Field `WCF` writer - Word Complete Flag"]
117pub type WcfW<'a, REG> = crate::BitWriter1C<'a, REG, Wcf>;
118impl<'a, REG> WcfW<'a, REG>
119where
120    REG: crate::Writable + crate::RegisterSpec,
121{
122    #[doc = "Not complete"]
123    #[inline(always)]
124    pub fn not_completed(self) -> &'a mut crate::W<REG> {
125        self.variant(Wcf::NotCompleted)
126    }
127    #[doc = "Complete"]
128    #[inline(always)]
129    pub fn completed(self) -> &'a mut crate::W<REG> {
130        self.variant(Wcf::Completed)
131    }
132}
133#[doc = "Frame Complete Flag\n\nValue on reset: 0"]
134#[cfg_attr(feature = "defmt", derive(defmt::Format))]
135#[derive(Clone, Copy, Debug, PartialEq, Eq)]
136pub enum Fcf {
137    #[doc = "0: Not complete"]
138    NotCompleted = 0,
139    #[doc = "1: Complete"]
140    Completed = 1,
141}
142impl From<Fcf> for bool {
143    #[inline(always)]
144    fn from(variant: Fcf) -> Self {
145        variant as u8 != 0
146    }
147}
148#[doc = "Field `FCF` reader - Frame Complete Flag"]
149pub type FcfR = crate::BitReader<Fcf>;
150impl FcfR {
151    #[doc = "Get enumerated values variant"]
152    #[inline(always)]
153    pub const fn variant(&self) -> Fcf {
154        match self.bits {
155            false => Fcf::NotCompleted,
156            true => Fcf::Completed,
157        }
158    }
159    #[doc = "Not complete"]
160    #[inline(always)]
161    pub fn is_not_completed(&self) -> bool {
162        *self == Fcf::NotCompleted
163    }
164    #[doc = "Complete"]
165    #[inline(always)]
166    pub fn is_completed(&self) -> bool {
167        *self == Fcf::Completed
168    }
169}
170#[doc = "Field `FCF` writer - Frame Complete Flag"]
171pub type FcfW<'a, REG> = crate::BitWriter1C<'a, REG, Fcf>;
172impl<'a, REG> FcfW<'a, REG>
173where
174    REG: crate::Writable + crate::RegisterSpec,
175{
176    #[doc = "Not complete"]
177    #[inline(always)]
178    pub fn not_completed(self) -> &'a mut crate::W<REG> {
179        self.variant(Fcf::NotCompleted)
180    }
181    #[doc = "Complete"]
182    #[inline(always)]
183    pub fn completed(self) -> &'a mut crate::W<REG> {
184        self.variant(Fcf::Completed)
185    }
186}
187#[doc = "Transfer Complete Flag\n\nValue on reset: 0"]
188#[cfg_attr(feature = "defmt", derive(defmt::Format))]
189#[derive(Clone, Copy, Debug, PartialEq, Eq)]
190pub enum Tcf {
191    #[doc = "0: Not complete"]
192    NotCompleted = 0,
193    #[doc = "1: Complete"]
194    Completed = 1,
195}
196impl From<Tcf> for bool {
197    #[inline(always)]
198    fn from(variant: Tcf) -> Self {
199        variant as u8 != 0
200    }
201}
202#[doc = "Field `TCF` reader - Transfer Complete Flag"]
203pub type TcfR = crate::BitReader<Tcf>;
204impl TcfR {
205    #[doc = "Get enumerated values variant"]
206    #[inline(always)]
207    pub const fn variant(&self) -> Tcf {
208        match self.bits {
209            false => Tcf::NotCompleted,
210            true => Tcf::Completed,
211        }
212    }
213    #[doc = "Not complete"]
214    #[inline(always)]
215    pub fn is_not_completed(&self) -> bool {
216        *self == Tcf::NotCompleted
217    }
218    #[doc = "Complete"]
219    #[inline(always)]
220    pub fn is_completed(&self) -> bool {
221        *self == Tcf::Completed
222    }
223}
224#[doc = "Field `TCF` writer - Transfer Complete Flag"]
225pub type TcfW<'a, REG> = crate::BitWriter1C<'a, REG, Tcf>;
226impl<'a, REG> TcfW<'a, REG>
227where
228    REG: crate::Writable + crate::RegisterSpec,
229{
230    #[doc = "Not complete"]
231    #[inline(always)]
232    pub fn not_completed(self) -> &'a mut crate::W<REG> {
233        self.variant(Tcf::NotCompleted)
234    }
235    #[doc = "Complete"]
236    #[inline(always)]
237    pub fn completed(self) -> &'a mut crate::W<REG> {
238        self.variant(Tcf::Completed)
239    }
240}
241#[doc = "Transmit Error Flag\n\nValue on reset: 0"]
242#[cfg_attr(feature = "defmt", derive(defmt::Format))]
243#[derive(Clone, Copy, Debug, PartialEq, Eq)]
244pub enum Tef {
245    #[doc = "0: No underrun"]
246    NoUnderrun = 0,
247    #[doc = "1: Underrun"]
248    Underrun = 1,
249}
250impl From<Tef> for bool {
251    #[inline(always)]
252    fn from(variant: Tef) -> Self {
253        variant as u8 != 0
254    }
255}
256#[doc = "Field `TEF` reader - Transmit Error Flag"]
257pub type TefR = crate::BitReader<Tef>;
258impl TefR {
259    #[doc = "Get enumerated values variant"]
260    #[inline(always)]
261    pub const fn variant(&self) -> Tef {
262        match self.bits {
263            false => Tef::NoUnderrun,
264            true => Tef::Underrun,
265        }
266    }
267    #[doc = "No underrun"]
268    #[inline(always)]
269    pub fn is_no_underrun(&self) -> bool {
270        *self == Tef::NoUnderrun
271    }
272    #[doc = "Underrun"]
273    #[inline(always)]
274    pub fn is_underrun(&self) -> bool {
275        *self == Tef::Underrun
276    }
277}
278#[doc = "Field `TEF` writer - Transmit Error Flag"]
279pub type TefW<'a, REG> = crate::BitWriter1C<'a, REG, Tef>;
280impl<'a, REG> TefW<'a, REG>
281where
282    REG: crate::Writable + crate::RegisterSpec,
283{
284    #[doc = "No underrun"]
285    #[inline(always)]
286    pub fn no_underrun(self) -> &'a mut crate::W<REG> {
287        self.variant(Tef::NoUnderrun)
288    }
289    #[doc = "Underrun"]
290    #[inline(always)]
291    pub fn underrun(self) -> &'a mut crate::W<REG> {
292        self.variant(Tef::Underrun)
293    }
294}
295#[doc = "Receive Error Flag\n\nValue on reset: 0"]
296#[cfg_attr(feature = "defmt", derive(defmt::Format))]
297#[derive(Clone, Copy, Debug, PartialEq, Eq)]
298pub enum Ref {
299    #[doc = "0: No overflow"]
300    NotOverflowed = 0,
301    #[doc = "1: Overflow"]
302    Overflowed = 1,
303}
304impl From<Ref> for bool {
305    #[inline(always)]
306    fn from(variant: Ref) -> Self {
307        variant as u8 != 0
308    }
309}
310#[doc = "Field `REF` reader - Receive Error Flag"]
311pub type RefR = crate::BitReader<Ref>;
312impl RefR {
313    #[doc = "Get enumerated values variant"]
314    #[inline(always)]
315    pub const fn variant(&self) -> Ref {
316        match self.bits {
317            false => Ref::NotOverflowed,
318            true => Ref::Overflowed,
319        }
320    }
321    #[doc = "No overflow"]
322    #[inline(always)]
323    pub fn is_not_overflowed(&self) -> bool {
324        *self == Ref::NotOverflowed
325    }
326    #[doc = "Overflow"]
327    #[inline(always)]
328    pub fn is_overflowed(&self) -> bool {
329        *self == Ref::Overflowed
330    }
331}
332#[doc = "Field `REF` writer - Receive Error Flag"]
333pub type RefW<'a, REG> = crate::BitWriter1C<'a, REG, Ref>;
334impl<'a, REG> RefW<'a, REG>
335where
336    REG: crate::Writable + crate::RegisterSpec,
337{
338    #[doc = "No overflow"]
339    #[inline(always)]
340    pub fn not_overflowed(self) -> &'a mut crate::W<REG> {
341        self.variant(Ref::NotOverflowed)
342    }
343    #[doc = "Overflow"]
344    #[inline(always)]
345    pub fn overflowed(self) -> &'a mut crate::W<REG> {
346        self.variant(Ref::Overflowed)
347    }
348}
349#[doc = "Data Match Flag\n\nValue on reset: 0"]
350#[cfg_attr(feature = "defmt", derive(defmt::Format))]
351#[derive(Clone, Copy, Debug, PartialEq, Eq)]
352pub enum Dmf {
353    #[doc = "0: No match"]
354    NoMatch = 0,
355    #[doc = "1: Match"]
356    Match = 1,
357}
358impl From<Dmf> for bool {
359    #[inline(always)]
360    fn from(variant: Dmf) -> Self {
361        variant as u8 != 0
362    }
363}
364#[doc = "Field `DMF` reader - Data Match Flag"]
365pub type DmfR = crate::BitReader<Dmf>;
366impl DmfR {
367    #[doc = "Get enumerated values variant"]
368    #[inline(always)]
369    pub const fn variant(&self) -> Dmf {
370        match self.bits {
371            false => Dmf::NoMatch,
372            true => Dmf::Match,
373        }
374    }
375    #[doc = "No match"]
376    #[inline(always)]
377    pub fn is_no_match(&self) -> bool {
378        *self == Dmf::NoMatch
379    }
380    #[doc = "Match"]
381    #[inline(always)]
382    pub fn is_match(&self) -> bool {
383        *self == Dmf::Match
384    }
385}
386#[doc = "Field `DMF` writer - Data Match Flag"]
387pub type DmfW<'a, REG> = crate::BitWriter1C<'a, REG, Dmf>;
388impl<'a, REG> DmfW<'a, REG>
389where
390    REG: crate::Writable + crate::RegisterSpec,
391{
392    #[doc = "No match"]
393    #[inline(always)]
394    pub fn no_match(self) -> &'a mut crate::W<REG> {
395        self.variant(Dmf::NoMatch)
396    }
397    #[doc = "Match"]
398    #[inline(always)]
399    pub fn match_(self) -> &'a mut crate::W<REG> {
400        self.variant(Dmf::Match)
401    }
402}
403#[doc = "Module Busy Flag\n\nValue on reset: 0"]
404#[cfg_attr(feature = "defmt", derive(defmt::Format))]
405#[derive(Clone, Copy, Debug, PartialEq, Eq)]
406pub enum Mbf {
407    #[doc = "0: LPSPI is idle"]
408    Idle = 0,
409    #[doc = "1: LPSPI is busy"]
410    Busy = 1,
411}
412impl From<Mbf> for bool {
413    #[inline(always)]
414    fn from(variant: Mbf) -> Self {
415        variant as u8 != 0
416    }
417}
418#[doc = "Field `MBF` reader - Module Busy Flag"]
419pub type MbfR = crate::BitReader<Mbf>;
420impl MbfR {
421    #[doc = "Get enumerated values variant"]
422    #[inline(always)]
423    pub const fn variant(&self) -> Mbf {
424        match self.bits {
425            false => Mbf::Idle,
426            true => Mbf::Busy,
427        }
428    }
429    #[doc = "LPSPI is idle"]
430    #[inline(always)]
431    pub fn is_idle(&self) -> bool {
432        *self == Mbf::Idle
433    }
434    #[doc = "LPSPI is busy"]
435    #[inline(always)]
436    pub fn is_busy(&self) -> bool {
437        *self == Mbf::Busy
438    }
439}
440impl R {
441    #[doc = "Bit 0 - Transmit Data Flag"]
442    #[inline(always)]
443    pub fn tdf(&self) -> TdfR {
444        TdfR::new((self.bits & 1) != 0)
445    }
446    #[doc = "Bit 1 - Receive Data Flag"]
447    #[inline(always)]
448    pub fn rdf(&self) -> RdfR {
449        RdfR::new(((self.bits >> 1) & 1) != 0)
450    }
451    #[doc = "Bit 8 - Word Complete Flag"]
452    #[inline(always)]
453    pub fn wcf(&self) -> WcfR {
454        WcfR::new(((self.bits >> 8) & 1) != 0)
455    }
456    #[doc = "Bit 9 - Frame Complete Flag"]
457    #[inline(always)]
458    pub fn fcf(&self) -> FcfR {
459        FcfR::new(((self.bits >> 9) & 1) != 0)
460    }
461    #[doc = "Bit 10 - Transfer Complete Flag"]
462    #[inline(always)]
463    pub fn tcf(&self) -> TcfR {
464        TcfR::new(((self.bits >> 10) & 1) != 0)
465    }
466    #[doc = "Bit 11 - Transmit Error Flag"]
467    #[inline(always)]
468    pub fn tef(&self) -> TefR {
469        TefR::new(((self.bits >> 11) & 1) != 0)
470    }
471    #[doc = "Bit 12 - Receive Error Flag"]
472    #[inline(always)]
473    pub fn ref_(&self) -> RefR {
474        RefR::new(((self.bits >> 12) & 1) != 0)
475    }
476    #[doc = "Bit 13 - Data Match Flag"]
477    #[inline(always)]
478    pub fn dmf(&self) -> DmfR {
479        DmfR::new(((self.bits >> 13) & 1) != 0)
480    }
481    #[doc = "Bit 24 - Module Busy Flag"]
482    #[inline(always)]
483    pub fn mbf(&self) -> MbfR {
484        MbfR::new(((self.bits >> 24) & 1) != 0)
485    }
486}
487#[cfg(feature = "debug")]
488impl core::fmt::Debug for R {
489    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
490        f.debug_struct("SR")
491            .field("tdf", &self.tdf())
492            .field("rdf", &self.rdf())
493            .field("wcf", &self.wcf())
494            .field("fcf", &self.fcf())
495            .field("tcf", &self.tcf())
496            .field("tef", &self.tef())
497            .field("ref_", &self.ref_())
498            .field("dmf", &self.dmf())
499            .field("mbf", &self.mbf())
500            .finish()
501    }
502}
503impl W {
504    #[doc = "Bit 8 - Word Complete Flag"]
505    #[inline(always)]
506    pub fn wcf(&mut self) -> WcfW<'_, SrSpec> {
507        WcfW::new(self, 8)
508    }
509    #[doc = "Bit 9 - Frame Complete Flag"]
510    #[inline(always)]
511    pub fn fcf(&mut self) -> FcfW<'_, SrSpec> {
512        FcfW::new(self, 9)
513    }
514    #[doc = "Bit 10 - Transfer Complete Flag"]
515    #[inline(always)]
516    pub fn tcf(&mut self) -> TcfW<'_, SrSpec> {
517        TcfW::new(self, 10)
518    }
519    #[doc = "Bit 11 - Transmit Error Flag"]
520    #[inline(always)]
521    pub fn tef(&mut self) -> TefW<'_, SrSpec> {
522        TefW::new(self, 11)
523    }
524    #[doc = "Bit 12 - Receive Error Flag"]
525    #[inline(always)]
526    pub fn ref_(&mut self) -> RefW<'_, SrSpec> {
527        RefW::new(self, 12)
528    }
529    #[doc = "Bit 13 - Data Match Flag"]
530    #[inline(always)]
531    pub fn dmf(&mut self) -> DmfW<'_, SrSpec> {
532        DmfW::new(self, 13)
533    }
534}
535#[doc = "Status\n\nYou can [`read`](crate::Reg::read) this register and get [`sr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
536pub struct SrSpec;
537impl crate::RegisterSpec for SrSpec {
538    type Ux = u32;
539}
540#[doc = "`read()` method returns [`sr::R`](R) reader structure"]
541impl crate::Readable for SrSpec {}
542#[doc = "`write(|w| ..)` method takes [`sr::W`](W) writer structure"]
543impl crate::Writable for SrSpec {
544    type Safety = crate::Unsafe;
545    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x3f00;
546}
547#[doc = "`reset()` method sets SR to value 0x01"]
548impl crate::Resettable for SrSpec {
549    const RESET_VALUE: u32 = 0x01;
550}