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
#[doc = "Register `PSR` reader"]
pub type R = crate::R<PsrSpec>;
#[doc = "Register `PSR` writer"]
pub type W = crate::W<PsrSpec>;
#[doc = "Prescaler and Glitch Filter Clock Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Pcs {
    #[doc = "0: Clock 0"]
    Pcs00 = 0,
    #[doc = "1: Clock 1"]
    Pcs01 = 1,
    #[doc = "2: Clock 2"]
    Pcs10 = 2,
    #[doc = "3: Clock 3"]
    Pcs11 = 3,
}
impl From<Pcs> for u8 {
    #[inline(always)]
    fn from(variant: Pcs) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Pcs {
    type Ux = u8;
}
impl crate::IsEnum for Pcs {}
#[doc = "Field `PCS` reader - Prescaler and Glitch Filter Clock Select"]
pub type PcsR = crate::FieldReader<Pcs>;
impl PcsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pcs {
        match self.bits {
            0 => Pcs::Pcs00,
            1 => Pcs::Pcs01,
            2 => Pcs::Pcs10,
            3 => Pcs::Pcs11,
            _ => unreachable!(),
        }
    }
    #[doc = "Clock 0"]
    #[inline(always)]
    pub fn is_pcs00(&self) -> bool {
        *self == Pcs::Pcs00
    }
    #[doc = "Clock 1"]
    #[inline(always)]
    pub fn is_pcs01(&self) -> bool {
        *self == Pcs::Pcs01
    }
    #[doc = "Clock 2"]
    #[inline(always)]
    pub fn is_pcs10(&self) -> bool {
        *self == Pcs::Pcs10
    }
    #[doc = "Clock 3"]
    #[inline(always)]
    pub fn is_pcs11(&self) -> bool {
        *self == Pcs::Pcs11
    }
}
#[doc = "Field `PCS` writer - Prescaler and Glitch Filter Clock Select"]
pub type PcsW<'a, REG> = crate::FieldWriter<'a, REG, 2, Pcs, crate::Safe>;
impl<'a, REG> PcsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Clock 0"]
    #[inline(always)]
    pub fn pcs00(self) -> &'a mut crate::W<REG> {
        self.variant(Pcs::Pcs00)
    }
    #[doc = "Clock 1"]
    #[inline(always)]
    pub fn pcs01(self) -> &'a mut crate::W<REG> {
        self.variant(Pcs::Pcs01)
    }
    #[doc = "Clock 2"]
    #[inline(always)]
    pub fn pcs10(self) -> &'a mut crate::W<REG> {
        self.variant(Pcs::Pcs10)
    }
    #[doc = "Clock 3"]
    #[inline(always)]
    pub fn pcs11(self) -> &'a mut crate::W<REG> {
        self.variant(Pcs::Pcs11)
    }
}
#[doc = "Prescaler and Glitch Filter Bypass\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Pbyp {
    #[doc = "0: Prescaler and glitch filter enable"]
    Pbyp0 = 0,
    #[doc = "1: Prescaler and glitch filter bypass"]
    Pbyp1 = 1,
}
impl From<Pbyp> for bool {
    #[inline(always)]
    fn from(variant: Pbyp) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PBYP` reader - Prescaler and Glitch Filter Bypass"]
pub type PbypR = crate::BitReader<Pbyp>;
impl PbypR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pbyp {
        match self.bits {
            false => Pbyp::Pbyp0,
            true => Pbyp::Pbyp1,
        }
    }
    #[doc = "Prescaler and glitch filter enable"]
    #[inline(always)]
    pub fn is_pbyp0(&self) -> bool {
        *self == Pbyp::Pbyp0
    }
    #[doc = "Prescaler and glitch filter bypass"]
    #[inline(always)]
    pub fn is_pbyp1(&self) -> bool {
        *self == Pbyp::Pbyp1
    }
}
#[doc = "Field `PBYP` writer - Prescaler and Glitch Filter Bypass"]
pub type PbypW<'a, REG> = crate::BitWriter<'a, REG, Pbyp>;
impl<'a, REG> PbypW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Prescaler and glitch filter enable"]
    #[inline(always)]
    pub fn pbyp0(self) -> &'a mut crate::W<REG> {
        self.variant(Pbyp::Pbyp0)
    }
    #[doc = "Prescaler and glitch filter bypass"]
    #[inline(always)]
    pub fn pbyp1(self) -> &'a mut crate::W<REG> {
        self.variant(Pbyp::Pbyp1)
    }
}
#[doc = "Prescaler and Glitch Filter Value\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Prescale {
    #[doc = "0: Prescaler divides the prescaler clock by 2; glitch filter does not support this configuration"]
    Prescale0000 = 0,
    #[doc = "1: Prescaler divides the prescaler clock by 4; glitch filter recognizes change on input pin after two rising clock edges"]
    Prescale0001 = 1,
    #[doc = "2: Prescaler divides the prescaler clock by 8; glitch filter recognizes change on input pin after four rising clock edges"]
    Prescale0010 = 2,
    #[doc = "3: Prescaler divides the prescaler clock by 16; glitch filter recognizes change on input pin after eight rising clock edges"]
    Prescale0011 = 3,
    #[doc = "4: Prescaler divides the prescaler clock by 32; glitch filter recognizes change on input pin after 16 rising clock edges"]
    Prescale0100 = 4,
    #[doc = "5: Prescaler divides the prescaler clock by 64; glitch filter recognizes change on input pin after 32 rising clock edges"]
    Prescale0101 = 5,
    #[doc = "6: Prescaler divides the prescaler clock by 128; glitch filter recognizes change on input pin after 64 rising clock edges"]
    Prescale0110 = 6,
    #[doc = "7: Prescaler divides the prescaler clock by 256; glitch filter recognizes change on input pin after 128 rising clock edges"]
    Prescale0111 = 7,
    #[doc = "8: Prescaler divides the prescaler clock by 512; glitch filter recognizes change on input pin after 256 rising clock edges"]
    Prescale1000 = 8,
    #[doc = "9: Prescaler divides the prescaler clock by 1024; glitch filter recognizes change on input pin after 512 rising clock edges"]
    Prescale1001 = 9,
    #[doc = "10: Prescaler divides the prescaler clock by 2048; glitch filter recognizes change on input pin after 1024 rising clock edges"]
    Prescale1010 = 10,
    #[doc = "11: Prescaler divides the prescaler clock by 4096; glitch filter recognizes change on input pin after 2048 rising clock edges"]
    Prescale1011 = 11,
    #[doc = "12: Prescaler divides the prescaler clock by 8192; glitch filter recognizes change on input pin after 4096 rising clock edges"]
    Prescale1100 = 12,
    #[doc = "13: Prescaler divides the prescaler clock by 16,384; glitch filter recognizes change on input pin after 8192 rising clock edges"]
    Prescale1101 = 13,
    #[doc = "14: Prescaler divides the prescaler clock by 32,768; glitch filter recognizes change on input pin after 16,384 rising clock edges"]
    Prescale1110 = 14,
    #[doc = "15: Prescaler divides the prescaler clock by 65,536; glitch filter recognizes change on input pin after 32,768 rising clock edges"]
    Prescale1111 = 15,
}
impl From<Prescale> for u8 {
    #[inline(always)]
    fn from(variant: Prescale) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Prescale {
    type Ux = u8;
}
impl crate::IsEnum for Prescale {}
#[doc = "Field `PRESCALE` reader - Prescaler and Glitch Filter Value"]
pub type PrescaleR = crate::FieldReader<Prescale>;
impl PrescaleR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Prescale {
        match self.bits {
            0 => Prescale::Prescale0000,
            1 => Prescale::Prescale0001,
            2 => Prescale::Prescale0010,
            3 => Prescale::Prescale0011,
            4 => Prescale::Prescale0100,
            5 => Prescale::Prescale0101,
            6 => Prescale::Prescale0110,
            7 => Prescale::Prescale0111,
            8 => Prescale::Prescale1000,
            9 => Prescale::Prescale1001,
            10 => Prescale::Prescale1010,
            11 => Prescale::Prescale1011,
            12 => Prescale::Prescale1100,
            13 => Prescale::Prescale1101,
            14 => Prescale::Prescale1110,
            15 => Prescale::Prescale1111,
            _ => unreachable!(),
        }
    }
    #[doc = "Prescaler divides the prescaler clock by 2; glitch filter does not support this configuration"]
    #[inline(always)]
    pub fn is_prescale0000(&self) -> bool {
        *self == Prescale::Prescale0000
    }
    #[doc = "Prescaler divides the prescaler clock by 4; glitch filter recognizes change on input pin after two rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0001(&self) -> bool {
        *self == Prescale::Prescale0001
    }
    #[doc = "Prescaler divides the prescaler clock by 8; glitch filter recognizes change on input pin after four rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0010(&self) -> bool {
        *self == Prescale::Prescale0010
    }
    #[doc = "Prescaler divides the prescaler clock by 16; glitch filter recognizes change on input pin after eight rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0011(&self) -> bool {
        *self == Prescale::Prescale0011
    }
    #[doc = "Prescaler divides the prescaler clock by 32; glitch filter recognizes change on input pin after 16 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0100(&self) -> bool {
        *self == Prescale::Prescale0100
    }
    #[doc = "Prescaler divides the prescaler clock by 64; glitch filter recognizes change on input pin after 32 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0101(&self) -> bool {
        *self == Prescale::Prescale0101
    }
    #[doc = "Prescaler divides the prescaler clock by 128; glitch filter recognizes change on input pin after 64 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0110(&self) -> bool {
        *self == Prescale::Prescale0110
    }
    #[doc = "Prescaler divides the prescaler clock by 256; glitch filter recognizes change on input pin after 128 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale0111(&self) -> bool {
        *self == Prescale::Prescale0111
    }
    #[doc = "Prescaler divides the prescaler clock by 512; glitch filter recognizes change on input pin after 256 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1000(&self) -> bool {
        *self == Prescale::Prescale1000
    }
    #[doc = "Prescaler divides the prescaler clock by 1024; glitch filter recognizes change on input pin after 512 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1001(&self) -> bool {
        *self == Prescale::Prescale1001
    }
    #[doc = "Prescaler divides the prescaler clock by 2048; glitch filter recognizes change on input pin after 1024 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1010(&self) -> bool {
        *self == Prescale::Prescale1010
    }
    #[doc = "Prescaler divides the prescaler clock by 4096; glitch filter recognizes change on input pin after 2048 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1011(&self) -> bool {
        *self == Prescale::Prescale1011
    }
    #[doc = "Prescaler divides the prescaler clock by 8192; glitch filter recognizes change on input pin after 4096 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1100(&self) -> bool {
        *self == Prescale::Prescale1100
    }
    #[doc = "Prescaler divides the prescaler clock by 16,384; glitch filter recognizes change on input pin after 8192 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1101(&self) -> bool {
        *self == Prescale::Prescale1101
    }
    #[doc = "Prescaler divides the prescaler clock by 32,768; glitch filter recognizes change on input pin after 16,384 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1110(&self) -> bool {
        *self == Prescale::Prescale1110
    }
    #[doc = "Prescaler divides the prescaler clock by 65,536; glitch filter recognizes change on input pin after 32,768 rising clock edges"]
    #[inline(always)]
    pub fn is_prescale1111(&self) -> bool {
        *self == Prescale::Prescale1111
    }
}
#[doc = "Field `PRESCALE` writer - Prescaler and Glitch Filter Value"]
pub type PrescaleW<'a, REG> = crate::FieldWriter<'a, REG, 4, Prescale, crate::Safe>;
impl<'a, REG> PrescaleW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Prescaler divides the prescaler clock by 2; glitch filter does not support this configuration"]
    #[inline(always)]
    pub fn prescale0000(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0000)
    }
    #[doc = "Prescaler divides the prescaler clock by 4; glitch filter recognizes change on input pin after two rising clock edges"]
    #[inline(always)]
    pub fn prescale0001(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0001)
    }
    #[doc = "Prescaler divides the prescaler clock by 8; glitch filter recognizes change on input pin after four rising clock edges"]
    #[inline(always)]
    pub fn prescale0010(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0010)
    }
    #[doc = "Prescaler divides the prescaler clock by 16; glitch filter recognizes change on input pin after eight rising clock edges"]
    #[inline(always)]
    pub fn prescale0011(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0011)
    }
    #[doc = "Prescaler divides the prescaler clock by 32; glitch filter recognizes change on input pin after 16 rising clock edges"]
    #[inline(always)]
    pub fn prescale0100(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0100)
    }
    #[doc = "Prescaler divides the prescaler clock by 64; glitch filter recognizes change on input pin after 32 rising clock edges"]
    #[inline(always)]
    pub fn prescale0101(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0101)
    }
    #[doc = "Prescaler divides the prescaler clock by 128; glitch filter recognizes change on input pin after 64 rising clock edges"]
    #[inline(always)]
    pub fn prescale0110(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0110)
    }
    #[doc = "Prescaler divides the prescaler clock by 256; glitch filter recognizes change on input pin after 128 rising clock edges"]
    #[inline(always)]
    pub fn prescale0111(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale0111)
    }
    #[doc = "Prescaler divides the prescaler clock by 512; glitch filter recognizes change on input pin after 256 rising clock edges"]
    #[inline(always)]
    pub fn prescale1000(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1000)
    }
    #[doc = "Prescaler divides the prescaler clock by 1024; glitch filter recognizes change on input pin after 512 rising clock edges"]
    #[inline(always)]
    pub fn prescale1001(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1001)
    }
    #[doc = "Prescaler divides the prescaler clock by 2048; glitch filter recognizes change on input pin after 1024 rising clock edges"]
    #[inline(always)]
    pub fn prescale1010(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1010)
    }
    #[doc = "Prescaler divides the prescaler clock by 4096; glitch filter recognizes change on input pin after 2048 rising clock edges"]
    #[inline(always)]
    pub fn prescale1011(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1011)
    }
    #[doc = "Prescaler divides the prescaler clock by 8192; glitch filter recognizes change on input pin after 4096 rising clock edges"]
    #[inline(always)]
    pub fn prescale1100(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1100)
    }
    #[doc = "Prescaler divides the prescaler clock by 16,384; glitch filter recognizes change on input pin after 8192 rising clock edges"]
    #[inline(always)]
    pub fn prescale1101(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1101)
    }
    #[doc = "Prescaler divides the prescaler clock by 32,768; glitch filter recognizes change on input pin after 16,384 rising clock edges"]
    #[inline(always)]
    pub fn prescale1110(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1110)
    }
    #[doc = "Prescaler divides the prescaler clock by 65,536; glitch filter recognizes change on input pin after 32,768 rising clock edges"]
    #[inline(always)]
    pub fn prescale1111(self) -> &'a mut crate::W<REG> {
        self.variant(Prescale::Prescale1111)
    }
}
impl R {
    #[doc = "Bits 0:1 - Prescaler and Glitch Filter Clock Select"]
    #[inline(always)]
    pub fn pcs(&self) -> PcsR {
        PcsR::new((self.bits & 3) as u8)
    }
    #[doc = "Bit 2 - Prescaler and Glitch Filter Bypass"]
    #[inline(always)]
    pub fn pbyp(&self) -> PbypR {
        PbypR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bits 3:6 - Prescaler and Glitch Filter Value"]
    #[inline(always)]
    pub fn prescale(&self) -> PrescaleR {
        PrescaleR::new(((self.bits >> 3) & 0x0f) as u8)
    }
}
#[cfg(feature = "debug")]
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("PSR")
            .field("pcs", &self.pcs())
            .field("pbyp", &self.pbyp())
            .field("prescale", &self.prescale())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:1 - Prescaler and Glitch Filter Clock Select"]
    #[inline(always)]
    pub fn pcs(&mut self) -> PcsW<'_, PsrSpec> {
        PcsW::new(self, 0)
    }
    #[doc = "Bit 2 - Prescaler and Glitch Filter Bypass"]
    #[inline(always)]
    pub fn pbyp(&mut self) -> PbypW<'_, PsrSpec> {
        PbypW::new(self, 2)
    }
    #[doc = "Bits 3:6 - Prescaler and Glitch Filter Value"]
    #[inline(always)]
    pub fn prescale(&mut self) -> PrescaleW<'_, PsrSpec> {
        PrescaleW::new(self, 3)
    }
}
#[doc = "Prescaler and Glitch Filter\n\nYou can [`read`](crate::Reg::read) this register and get [`psr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`psr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct PsrSpec;
impl crate::RegisterSpec for PsrSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`psr::R`](R) reader structure"]
impl crate::Readable for PsrSpec {}
#[doc = "`write(|w| ..)` method takes [`psr::W`](W) writer structure"]
impl crate::Writable for PsrSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets PSR to value 0"]
impl crate::Resettable for PsrSpec {}