mcxa-pac 0.3.0

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