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
#[doc = "Register `ISTAT` reader"]
pub type R = crate::R<IstatSpec>;
#[doc = "Register `ISTAT` writer"]
pub type W = crate::W<IstatSpec>;
#[doc = "USB Reset Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Usbrst {
    #[doc = "0: Not detected"]
    IntNo = 0,
    #[doc = "1: Detected"]
    IntYes = 1,
}
impl From<Usbrst> for bool {
    #[inline(always)]
    fn from(variant: Usbrst) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `USBRST` reader - USB Reset Flag"]
pub type UsbrstR = crate::BitReader<Usbrst>;
impl UsbrstR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Usbrst {
        match self.bits {
            false => Usbrst::IntNo,
            true => Usbrst::IntYes,
        }
    }
    #[doc = "Not detected"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Usbrst::IntNo
    }
    #[doc = "Detected"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Usbrst::IntYes
    }
}
#[doc = "Field `USBRST` writer - USB Reset Flag"]
pub type UsbrstW<'a, REG> = crate::BitWriter1C<'a, REG, Usbrst>;
impl<'a, REG> UsbrstW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Not detected"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Usbrst::IntNo)
    }
    #[doc = "Detected"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Usbrst::IntYes)
    }
}
#[doc = "Error Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Error {
    #[doc = "0: Error did not occur"]
    IntNo = 0,
    #[doc = "1: Error occurred"]
    IntYes = 1,
}
impl From<Error> for bool {
    #[inline(always)]
    fn from(variant: Error) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ERROR` reader - Error Flag"]
pub type ErrorR = crate::BitReader<Error>;
impl ErrorR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Error {
        match self.bits {
            false => Error::IntNo,
            true => Error::IntYes,
        }
    }
    #[doc = "Error did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Error::IntNo
    }
    #[doc = "Error occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Error::IntYes
    }
}
#[doc = "Field `ERROR` writer - Error Flag"]
pub type ErrorW<'a, REG> = crate::BitWriter1C<'a, REG, Error>;
impl<'a, REG> ErrorW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Error did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Error::IntNo)
    }
    #[doc = "Error occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Error::IntYes)
    }
}
#[doc = "Start Of Frame (SOF) Token Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Softok {
    #[doc = "0: Did not receive"]
    IntNo = 0,
    #[doc = "1: Received"]
    IntYes = 1,
}
impl From<Softok> for bool {
    #[inline(always)]
    fn from(variant: Softok) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SOFTOK` reader - Start Of Frame (SOF) Token Flag"]
pub type SoftokR = crate::BitReader<Softok>;
impl SoftokR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Softok {
        match self.bits {
            false => Softok::IntNo,
            true => Softok::IntYes,
        }
    }
    #[doc = "Did not receive"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Softok::IntNo
    }
    #[doc = "Received"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Softok::IntYes
    }
}
#[doc = "Field `SOFTOK` writer - Start Of Frame (SOF) Token Flag"]
pub type SoftokW<'a, REG> = crate::BitWriter1C<'a, REG, Softok>;
impl<'a, REG> SoftokW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Did not receive"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Softok::IntNo)
    }
    #[doc = "Received"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Softok::IntYes)
    }
}
#[doc = "Current Token Processing Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tokdne {
    #[doc = "0: Not processed"]
    IntNo = 0,
    #[doc = "1: Processed"]
    IntYes = 1,
}
impl From<Tokdne> for bool {
    #[inline(always)]
    fn from(variant: Tokdne) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TOKDNE` reader - Current Token Processing Flag"]
pub type TokdneR = crate::BitReader<Tokdne>;
impl TokdneR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tokdne {
        match self.bits {
            false => Tokdne::IntNo,
            true => Tokdne::IntYes,
        }
    }
    #[doc = "Not processed"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Tokdne::IntNo
    }
    #[doc = "Processed"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Tokdne::IntYes
    }
}
#[doc = "Field `TOKDNE` writer - Current Token Processing Flag"]
pub type TokdneW<'a, REG> = crate::BitWriter1C<'a, REG, Tokdne>;
impl<'a, REG> TokdneW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Not processed"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Tokdne::IntNo)
    }
    #[doc = "Processed"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Tokdne::IntYes)
    }
}
#[doc = "Sleep Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Sleep {
    #[doc = "0: Interrupt did not occur"]
    IntNo = 0,
    #[doc = "1: Interrupt occurred"]
    IntYes = 1,
}
impl From<Sleep> for bool {
    #[inline(always)]
    fn from(variant: Sleep) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SLEEP` reader - Sleep Flag"]
pub type SleepR = crate::BitReader<Sleep>;
impl SleepR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Sleep {
        match self.bits {
            false => Sleep::IntNo,
            true => Sleep::IntYes,
        }
    }
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Sleep::IntNo
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Sleep::IntYes
    }
}
#[doc = "Field `SLEEP` writer - Sleep Flag"]
pub type SleepW<'a, REG> = crate::BitWriter1C<'a, REG, Sleep>;
impl<'a, REG> SleepW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Sleep::IntNo)
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Sleep::IntYes)
    }
}
#[doc = "Resume Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Resume {
    #[doc = "0: Interrupt did not occur"]
    IntNo = 0,
    #[doc = "1: Interrupt occurred"]
    IntYes = 1,
}
impl From<Resume> for bool {
    #[inline(always)]
    fn from(variant: Resume) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RESUME` reader - Resume Flag"]
pub type ResumeR = crate::BitReader<Resume>;
impl ResumeR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Resume {
        match self.bits {
            false => Resume::IntNo,
            true => Resume::IntYes,
        }
    }
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Resume::IntNo
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Resume::IntYes
    }
}
#[doc = "Field `RESUME` writer - Resume Flag"]
pub type ResumeW<'a, REG> = crate::BitWriter1C<'a, REG, Resume>;
impl<'a, REG> ResumeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Resume::IntNo)
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Resume::IntYes)
    }
}
#[doc = "Attach Interrupt Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Attach {
    #[doc = "0: Not detected"]
    IntNo = 0,
    #[doc = "1: Detected"]
    IntYes = 1,
}
impl From<Attach> for bool {
    #[inline(always)]
    fn from(variant: Attach) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ATTACH` reader - Attach Interrupt Flag"]
pub type AttachR = crate::BitReader<Attach>;
impl AttachR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Attach {
        match self.bits {
            false => Attach::IntNo,
            true => Attach::IntYes,
        }
    }
    #[doc = "Not detected"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Attach::IntNo
    }
    #[doc = "Detected"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Attach::IntYes
    }
}
#[doc = "Field `ATTACH` writer - Attach Interrupt Flag"]
pub type AttachW<'a, REG> = crate::BitWriter1C<'a, REG, Attach>;
impl<'a, REG> AttachW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Not detected"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Attach::IntNo)
    }
    #[doc = "Detected"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Attach::IntYes)
    }
}
#[doc = "Stall Interrupt Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Stall {
    #[doc = "0: Interrupt did not occur"]
    IntNo = 0,
    #[doc = "1: Interrupt occurred"]
    IntYes = 1,
}
impl From<Stall> for bool {
    #[inline(always)]
    fn from(variant: Stall) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `STALL` reader - Stall Interrupt Flag"]
pub type StallR = crate::BitReader<Stall>;
impl StallR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Stall {
        match self.bits {
            false => Stall::IntNo,
            true => Stall::IntYes,
        }
    }
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn is_int_no(&self) -> bool {
        *self == Stall::IntNo
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn is_int_yes(&self) -> bool {
        *self == Stall::IntYes
    }
}
#[doc = "Field `STALL` writer - Stall Interrupt Flag"]
pub type StallW<'a, REG> = crate::BitWriter1C<'a, REG, Stall>;
impl<'a, REG> StallW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Interrupt did not occur"]
    #[inline(always)]
    pub fn int_no(self) -> &'a mut crate::W<REG> {
        self.variant(Stall::IntNo)
    }
    #[doc = "Interrupt occurred"]
    #[inline(always)]
    pub fn int_yes(self) -> &'a mut crate::W<REG> {
        self.variant(Stall::IntYes)
    }
}
impl R {
    #[doc = "Bit 0 - USB Reset Flag"]
    #[inline(always)]
    pub fn usbrst(&self) -> UsbrstR {
        UsbrstR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Error Flag"]
    #[inline(always)]
    pub fn error(&self) -> ErrorR {
        ErrorR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Start Of Frame (SOF) Token Flag"]
    #[inline(always)]
    pub fn softok(&self) -> SoftokR {
        SoftokR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Current Token Processing Flag"]
    #[inline(always)]
    pub fn tokdne(&self) -> TokdneR {
        TokdneR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Sleep Flag"]
    #[inline(always)]
    pub fn sleep(&self) -> SleepR {
        SleepR::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - Resume Flag"]
    #[inline(always)]
    pub fn resume(&self) -> ResumeR {
        ResumeR::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Attach Interrupt Flag"]
    #[inline(always)]
    pub fn attach(&self) -> AttachR {
        AttachR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Stall Interrupt Flag"]
    #[inline(always)]
    pub fn stall(&self) -> StallR {
        StallR::new(((self.bits >> 7) & 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("ISTAT")
            .field("usbrst", &self.usbrst())
            .field("error", &self.error())
            .field("softok", &self.softok())
            .field("tokdne", &self.tokdne())
            .field("sleep", &self.sleep())
            .field("resume", &self.resume())
            .field("attach", &self.attach())
            .field("stall", &self.stall())
            .finish()
    }
}
impl W {
    #[doc = "Bit 0 - USB Reset Flag"]
    #[inline(always)]
    pub fn usbrst(&mut self) -> UsbrstW<'_, IstatSpec> {
        UsbrstW::new(self, 0)
    }
    #[doc = "Bit 1 - Error Flag"]
    #[inline(always)]
    pub fn error(&mut self) -> ErrorW<'_, IstatSpec> {
        ErrorW::new(self, 1)
    }
    #[doc = "Bit 2 - Start Of Frame (SOF) Token Flag"]
    #[inline(always)]
    pub fn softok(&mut self) -> SoftokW<'_, IstatSpec> {
        SoftokW::new(self, 2)
    }
    #[doc = "Bit 3 - Current Token Processing Flag"]
    #[inline(always)]
    pub fn tokdne(&mut self) -> TokdneW<'_, IstatSpec> {
        TokdneW::new(self, 3)
    }
    #[doc = "Bit 4 - Sleep Flag"]
    #[inline(always)]
    pub fn sleep(&mut self) -> SleepW<'_, IstatSpec> {
        SleepW::new(self, 4)
    }
    #[doc = "Bit 5 - Resume Flag"]
    #[inline(always)]
    pub fn resume(&mut self) -> ResumeW<'_, IstatSpec> {
        ResumeW::new(self, 5)
    }
    #[doc = "Bit 6 - Attach Interrupt Flag"]
    #[inline(always)]
    pub fn attach(&mut self) -> AttachW<'_, IstatSpec> {
        AttachW::new(self, 6)
    }
    #[doc = "Bit 7 - Stall Interrupt Flag"]
    #[inline(always)]
    pub fn stall(&mut self) -> StallW<'_, IstatSpec> {
        StallW::new(self, 7)
    }
}
#[doc = "Interrupt Status\n\nYou can [`read`](crate::Reg::read) this register and get [`istat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`istat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct IstatSpec;
impl crate::RegisterSpec for IstatSpec {
    type Ux = u8;
}
#[doc = "`read()` method returns [`istat::R`](R) reader structure"]
impl crate::Readable for IstatSpec {}
#[doc = "`write(|w| ..)` method takes [`istat::W`](W) writer structure"]
impl crate::Writable for IstatSpec {
    type Safety = crate::Unsafe;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0xff;
}
#[doc = "`reset()` method sets ISTAT to value 0"]
impl crate::Resettable for IstatSpec {}