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
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
#[doc = "Register `CSR` reader"]
pub type R = crate::R<CsrSpec>;
#[doc = "Register `CSR` writer"]
pub type W = crate::W<CsrSpec>;
#[doc = "Timer Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Ten {
    #[doc = "0: Disable"]
    Ten0 = 0,
    #[doc = "1: Enable"]
    Ten1 = 1,
}
impl From<Ten> for bool {
    #[inline(always)]
    fn from(variant: Ten) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TEN` reader - Timer Enable"]
pub type TenR = crate::BitReader<Ten>;
impl TenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Ten {
        match self.bits {
            false => Ten::Ten0,
            true => Ten::Ten1,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_ten0(&self) -> bool {
        *self == Ten::Ten0
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_ten1(&self) -> bool {
        *self == Ten::Ten1
    }
}
#[doc = "Field `TEN` writer - Timer Enable"]
pub type TenW<'a, REG> = crate::BitWriter<'a, REG, Ten>;
impl<'a, REG> TenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn ten0(self) -> &'a mut crate::W<REG> {
        self.variant(Ten::Ten0)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn ten1(self) -> &'a mut crate::W<REG> {
        self.variant(Ten::Ten1)
    }
}
#[doc = "Timer Mode Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tms {
    #[doc = "0: Time Counter"]
    Tms0 = 0,
    #[doc = "1: Pulse Counter"]
    Tms1 = 1,
}
impl From<Tms> for bool {
    #[inline(always)]
    fn from(variant: Tms) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TMS` reader - Timer Mode Select"]
pub type TmsR = crate::BitReader<Tms>;
impl TmsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tms {
        match self.bits {
            false => Tms::Tms0,
            true => Tms::Tms1,
        }
    }
    #[doc = "Time Counter"]
    #[inline(always)]
    pub fn is_tms0(&self) -> bool {
        *self == Tms::Tms0
    }
    #[doc = "Pulse Counter"]
    #[inline(always)]
    pub fn is_tms1(&self) -> bool {
        *self == Tms::Tms1
    }
}
#[doc = "Field `TMS` writer - Timer Mode Select"]
pub type TmsW<'a, REG> = crate::BitWriter<'a, REG, Tms>;
impl<'a, REG> TmsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Time Counter"]
    #[inline(always)]
    pub fn tms0(self) -> &'a mut crate::W<REG> {
        self.variant(Tms::Tms0)
    }
    #[doc = "Pulse Counter"]
    #[inline(always)]
    pub fn tms1(self) -> &'a mut crate::W<REG> {
        self.variant(Tms::Tms1)
    }
}
#[doc = "Timer Free-Running Counter\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tfc {
    #[doc = "0: Reset when TCF asserts"]
    Tfc0 = 0,
    #[doc = "1: Reset on overflow"]
    Tfc1 = 1,
}
impl From<Tfc> for bool {
    #[inline(always)]
    fn from(variant: Tfc) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TFC` reader - Timer Free-Running Counter"]
pub type TfcR = crate::BitReader<Tfc>;
impl TfcR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tfc {
        match self.bits {
            false => Tfc::Tfc0,
            true => Tfc::Tfc1,
        }
    }
    #[doc = "Reset when TCF asserts"]
    #[inline(always)]
    pub fn is_tfc0(&self) -> bool {
        *self == Tfc::Tfc0
    }
    #[doc = "Reset on overflow"]
    #[inline(always)]
    pub fn is_tfc1(&self) -> bool {
        *self == Tfc::Tfc1
    }
}
#[doc = "Field `TFC` writer - Timer Free-Running Counter"]
pub type TfcW<'a, REG> = crate::BitWriter<'a, REG, Tfc>;
impl<'a, REG> TfcW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Reset when TCF asserts"]
    #[inline(always)]
    pub fn tfc0(self) -> &'a mut crate::W<REG> {
        self.variant(Tfc::Tfc0)
    }
    #[doc = "Reset on overflow"]
    #[inline(always)]
    pub fn tfc1(self) -> &'a mut crate::W<REG> {
        self.variant(Tfc::Tfc1)
    }
}
#[doc = "Timer Pin Polarity\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tpp {
    #[doc = "0: Active-high"]
    Tpp0 = 0,
    #[doc = "1: Active-low"]
    Tpp1 = 1,
}
impl From<Tpp> for bool {
    #[inline(always)]
    fn from(variant: Tpp) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TPP` reader - Timer Pin Polarity"]
pub type TppR = crate::BitReader<Tpp>;
impl TppR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tpp {
        match self.bits {
            false => Tpp::Tpp0,
            true => Tpp::Tpp1,
        }
    }
    #[doc = "Active-high"]
    #[inline(always)]
    pub fn is_tpp0(&self) -> bool {
        *self == Tpp::Tpp0
    }
    #[doc = "Active-low"]
    #[inline(always)]
    pub fn is_tpp1(&self) -> bool {
        *self == Tpp::Tpp1
    }
}
#[doc = "Field `TPP` writer - Timer Pin Polarity"]
pub type TppW<'a, REG> = crate::BitWriter<'a, REG, Tpp>;
impl<'a, REG> TppW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Active-high"]
    #[inline(always)]
    pub fn tpp0(self) -> &'a mut crate::W<REG> {
        self.variant(Tpp::Tpp0)
    }
    #[doc = "Active-low"]
    #[inline(always)]
    pub fn tpp1(self) -> &'a mut crate::W<REG> {
        self.variant(Tpp::Tpp1)
    }
}
#[doc = "Timer Pin Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Tps {
    #[doc = "0: Input 0"]
    Tps00 = 0,
    #[doc = "1: Input 1"]
    Tps01 = 1,
    #[doc = "2: Input 2"]
    Tps10 = 2,
    #[doc = "3: Input 3"]
    Tps11 = 3,
}
impl From<Tps> for u8 {
    #[inline(always)]
    fn from(variant: Tps) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Tps {
    type Ux = u8;
}
impl crate::IsEnum for Tps {}
#[doc = "Field `TPS` reader - Timer Pin Select"]
pub type TpsR = crate::FieldReader<Tps>;
impl TpsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tps {
        match self.bits {
            0 => Tps::Tps00,
            1 => Tps::Tps01,
            2 => Tps::Tps10,
            3 => Tps::Tps11,
            _ => unreachable!(),
        }
    }
    #[doc = "Input 0"]
    #[inline(always)]
    pub fn is_tps00(&self) -> bool {
        *self == Tps::Tps00
    }
    #[doc = "Input 1"]
    #[inline(always)]
    pub fn is_tps01(&self) -> bool {
        *self == Tps::Tps01
    }
    #[doc = "Input 2"]
    #[inline(always)]
    pub fn is_tps10(&self) -> bool {
        *self == Tps::Tps10
    }
    #[doc = "Input 3"]
    #[inline(always)]
    pub fn is_tps11(&self) -> bool {
        *self == Tps::Tps11
    }
}
#[doc = "Field `TPS` writer - Timer Pin Select"]
pub type TpsW<'a, REG> = crate::FieldWriter<'a, REG, 2, Tps, crate::Safe>;
impl<'a, REG> TpsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Input 0"]
    #[inline(always)]
    pub fn tps00(self) -> &'a mut crate::W<REG> {
        self.variant(Tps::Tps00)
    }
    #[doc = "Input 1"]
    #[inline(always)]
    pub fn tps01(self) -> &'a mut crate::W<REG> {
        self.variant(Tps::Tps01)
    }
    #[doc = "Input 2"]
    #[inline(always)]
    pub fn tps10(self) -> &'a mut crate::W<REG> {
        self.variant(Tps::Tps10)
    }
    #[doc = "Input 3"]
    #[inline(always)]
    pub fn tps11(self) -> &'a mut crate::W<REG> {
        self.variant(Tps::Tps11)
    }
}
#[doc = "Timer Interrupt Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tie {
    #[doc = "0: Disable"]
    Tie0 = 0,
    #[doc = "1: Enable"]
    Tie1 = 1,
}
impl From<Tie> for bool {
    #[inline(always)]
    fn from(variant: Tie) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TIE` reader - Timer Interrupt Enable"]
pub type TieR = crate::BitReader<Tie>;
impl TieR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tie {
        match self.bits {
            false => Tie::Tie0,
            true => Tie::Tie1,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_tie0(&self) -> bool {
        *self == Tie::Tie0
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_tie1(&self) -> bool {
        *self == Tie::Tie1
    }
}
#[doc = "Field `TIE` writer - Timer Interrupt Enable"]
pub type TieW<'a, REG> = crate::BitWriter<'a, REG, Tie>;
impl<'a, REG> TieW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn tie0(self) -> &'a mut crate::W<REG> {
        self.variant(Tie::Tie0)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn tie1(self) -> &'a mut crate::W<REG> {
        self.variant(Tie::Tie1)
    }
}
#[doc = "Timer Compare Flag\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tcf {
    #[doc = "0: CNR != (CMR + 1)"]
    Tcf0 = 0,
    #[doc = "1: CNR = (CMR + 1)"]
    Tcf1 = 1,
}
impl From<Tcf> for bool {
    #[inline(always)]
    fn from(variant: Tcf) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TCF` reader - Timer Compare 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::Tcf0,
            true => Tcf::Tcf1,
        }
    }
    #[doc = "CNR != (CMR + 1)"]
    #[inline(always)]
    pub fn is_tcf0(&self) -> bool {
        *self == Tcf::Tcf0
    }
    #[doc = "CNR = (CMR + 1)"]
    #[inline(always)]
    pub fn is_tcf1(&self) -> bool {
        *self == Tcf::Tcf1
    }
}
#[doc = "Field `TCF` writer - Timer Compare Flag"]
pub type TcfW<'a, REG> = crate::BitWriter1C<'a, REG, Tcf>;
impl<'a, REG> TcfW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "CNR != (CMR + 1)"]
    #[inline(always)]
    pub fn tcf0(self) -> &'a mut crate::W<REG> {
        self.variant(Tcf::Tcf0)
    }
    #[doc = "CNR = (CMR + 1)"]
    #[inline(always)]
    pub fn tcf1(self) -> &'a mut crate::W<REG> {
        self.variant(Tcf::Tcf1)
    }
}
#[doc = "Timer DMA Request Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tdre {
    #[doc = "0: Disable"]
    Trde0 = 0,
    #[doc = "1: Enable"]
    Trde1 = 1,
}
impl From<Tdre> for bool {
    #[inline(always)]
    fn from(variant: Tdre) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TDRE` reader - Timer DMA Request Enable"]
pub type TdreR = crate::BitReader<Tdre>;
impl TdreR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tdre {
        match self.bits {
            false => Tdre::Trde0,
            true => Tdre::Trde1,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_trde0(&self) -> bool {
        *self == Tdre::Trde0
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_trde1(&self) -> bool {
        *self == Tdre::Trde1
    }
}
#[doc = "Field `TDRE` writer - Timer DMA Request Enable"]
pub type TdreW<'a, REG> = crate::BitWriter<'a, REG, Tdre>;
impl<'a, REG> TdreW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn trde0(self) -> &'a mut crate::W<REG> {
        self.variant(Tdre::Trde0)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn trde1(self) -> &'a mut crate::W<REG> {
        self.variant(Tdre::Trde1)
    }
}
impl R {
    #[doc = "Bit 0 - Timer Enable"]
    #[inline(always)]
    pub fn ten(&self) -> TenR {
        TenR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Timer Mode Select"]
    #[inline(always)]
    pub fn tms(&self) -> TmsR {
        TmsR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Timer Free-Running Counter"]
    #[inline(always)]
    pub fn tfc(&self) -> TfcR {
        TfcR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Timer Pin Polarity"]
    #[inline(always)]
    pub fn tpp(&self) -> TppR {
        TppR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bits 4:5 - Timer Pin Select"]
    #[inline(always)]
    pub fn tps(&self) -> TpsR {
        TpsR::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bit 6 - Timer Interrupt Enable"]
    #[inline(always)]
    pub fn tie(&self) -> TieR {
        TieR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Timer Compare Flag"]
    #[inline(always)]
    pub fn tcf(&self) -> TcfR {
        TcfR::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bit 8 - Timer DMA Request Enable"]
    #[inline(always)]
    pub fn tdre(&self) -> TdreR {
        TdreR::new(((self.bits >> 8) & 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("CSR")
            .field("ten", &self.ten())
            .field("tms", &self.tms())
            .field("tfc", &self.tfc())
            .field("tpp", &self.tpp())
            .field("tps", &self.tps())
            .field("tie", &self.tie())
            .field("tcf", &self.tcf())
            .field("tdre", &self.tdre())
            .finish()
    }
}
impl W {
    #[doc = "Bit 0 - Timer Enable"]
    #[inline(always)]
    pub fn ten(&mut self) -> TenW<'_, CsrSpec> {
        TenW::new(self, 0)
    }
    #[doc = "Bit 1 - Timer Mode Select"]
    #[inline(always)]
    pub fn tms(&mut self) -> TmsW<'_, CsrSpec> {
        TmsW::new(self, 1)
    }
    #[doc = "Bit 2 - Timer Free-Running Counter"]
    #[inline(always)]
    pub fn tfc(&mut self) -> TfcW<'_, CsrSpec> {
        TfcW::new(self, 2)
    }
    #[doc = "Bit 3 - Timer Pin Polarity"]
    #[inline(always)]
    pub fn tpp(&mut self) -> TppW<'_, CsrSpec> {
        TppW::new(self, 3)
    }
    #[doc = "Bits 4:5 - Timer Pin Select"]
    #[inline(always)]
    pub fn tps(&mut self) -> TpsW<'_, CsrSpec> {
        TpsW::new(self, 4)
    }
    #[doc = "Bit 6 - Timer Interrupt Enable"]
    #[inline(always)]
    pub fn tie(&mut self) -> TieW<'_, CsrSpec> {
        TieW::new(self, 6)
    }
    #[doc = "Bit 7 - Timer Compare Flag"]
    #[inline(always)]
    pub fn tcf(&mut self) -> TcfW<'_, CsrSpec> {
        TcfW::new(self, 7)
    }
    #[doc = "Bit 8 - Timer DMA Request Enable"]
    #[inline(always)]
    pub fn tdre(&mut self) -> TdreW<'_, CsrSpec> {
        TdreW::new(self, 8)
    }
}
#[doc = "Control Status\n\nYou can [`read`](crate::Reg::read) this register and get [`csr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`csr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CsrSpec;
impl crate::RegisterSpec for CsrSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`csr::R`](R) reader structure"]
impl crate::Readable for CsrSpec {}
#[doc = "`write(|w| ..)` method takes [`csr::W`](W) writer structure"]
impl crate::Writable for CsrSpec {
    type Safety = crate::Unsafe;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x80;
}
#[doc = "`reset()` method sets CSR to value 0"]
impl crate::Resettable for CsrSpec {}