mcxa-pac 0.1.1

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
#[doc = "Register `SM3CAPTCTRLX` reader"]
pub type R = crate::R<Sm3captctrlxSpec>;
#[doc = "Register `SM3CAPTCTRLX` writer"]
pub type W = crate::W<Sm3captctrlxSpec>;
#[doc = "Arm X\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Armx {
    #[doc = "0: Input capture operation is disabled."]
    Disabled = 0,
    #[doc = "1: Input capture operation as specified by CAPTCTRLX\\[EDGXx\\] is enabled."]
    Enabled = 1,
}
impl From<Armx> for bool {
    #[inline(always)]
    fn from(variant: Armx) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ARMX` reader - Arm X"]
pub type ArmxR = crate::BitReader<Armx>;
impl ArmxR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Armx {
        match self.bits {
            false => Armx::Disabled,
            true => Armx::Enabled,
        }
    }
    #[doc = "Input capture operation is disabled."]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Armx::Disabled
    }
    #[doc = "Input capture operation as specified by CAPTCTRLX\\[EDGXx\\] is enabled."]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Armx::Enabled
    }
}
#[doc = "Field `ARMX` writer - Arm X"]
pub type ArmxW<'a, REG> = crate::BitWriter<'a, REG, Armx>;
impl<'a, REG> ArmxW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Input capture operation is disabled."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Armx::Disabled)
    }
    #[doc = "Input capture operation as specified by CAPTCTRLX\\[EDGXx\\] is enabled."]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Armx::Enabled)
    }
}
#[doc = "One Shot Mode Aux\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Oneshotx {
    #[doc = "0: Free Running"]
    FreeRunning = 0,
    #[doc = "1: One Shot"]
    OneShot = 1,
}
impl From<Oneshotx> for bool {
    #[inline(always)]
    fn from(variant: Oneshotx) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ONESHOTX` reader - One Shot Mode Aux"]
pub type OneshotxR = crate::BitReader<Oneshotx>;
impl OneshotxR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Oneshotx {
        match self.bits {
            false => Oneshotx::FreeRunning,
            true => Oneshotx::OneShot,
        }
    }
    #[doc = "Free Running"]
    #[inline(always)]
    pub fn is_free_running(&self) -> bool {
        *self == Oneshotx::FreeRunning
    }
    #[doc = "One Shot"]
    #[inline(always)]
    pub fn is_one_shot(&self) -> bool {
        *self == Oneshotx::OneShot
    }
}
#[doc = "Field `ONESHOTX` writer - One Shot Mode Aux"]
pub type OneshotxW<'a, REG> = crate::BitWriter<'a, REG, Oneshotx>;
impl<'a, REG> OneshotxW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Free Running"]
    #[inline(always)]
    pub fn free_running(self) -> &'a mut crate::W<REG> {
        self.variant(Oneshotx::FreeRunning)
    }
    #[doc = "One Shot"]
    #[inline(always)]
    pub fn one_shot(self) -> &'a mut crate::W<REG> {
        self.variant(Oneshotx::OneShot)
    }
}
#[doc = "Edge X 0\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Edgx0 {
    #[doc = "0: Disabled"]
    Disabled = 0,
    #[doc = "1: Capture falling edges"]
    FallingEdge = 1,
    #[doc = "2: Capture rising edges"]
    RisingEdge = 2,
    #[doc = "3: Capture any edge"]
    AnyEdge = 3,
}
impl From<Edgx0> for u8 {
    #[inline(always)]
    fn from(variant: Edgx0) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Edgx0 {
    type Ux = u8;
}
impl crate::IsEnum for Edgx0 {}
#[doc = "Field `EDGX0` reader - Edge X 0"]
pub type Edgx0R = crate::FieldReader<Edgx0>;
impl Edgx0R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Edgx0 {
        match self.bits {
            0 => Edgx0::Disabled,
            1 => Edgx0::FallingEdge,
            2 => Edgx0::RisingEdge,
            3 => Edgx0::AnyEdge,
            _ => unreachable!(),
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Edgx0::Disabled
    }
    #[doc = "Capture falling edges"]
    #[inline(always)]
    pub fn is_falling_edge(&self) -> bool {
        *self == Edgx0::FallingEdge
    }
    #[doc = "Capture rising edges"]
    #[inline(always)]
    pub fn is_rising_edge(&self) -> bool {
        *self == Edgx0::RisingEdge
    }
    #[doc = "Capture any edge"]
    #[inline(always)]
    pub fn is_any_edge(&self) -> bool {
        *self == Edgx0::AnyEdge
    }
}
#[doc = "Field `EDGX0` writer - Edge X 0"]
pub type Edgx0W<'a, REG> = crate::FieldWriter<'a, REG, 2, Edgx0, crate::Safe>;
impl<'a, REG> Edgx0W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx0::Disabled)
    }
    #[doc = "Capture falling edges"]
    #[inline(always)]
    pub fn falling_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx0::FallingEdge)
    }
    #[doc = "Capture rising edges"]
    #[inline(always)]
    pub fn rising_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx0::RisingEdge)
    }
    #[doc = "Capture any edge"]
    #[inline(always)]
    pub fn any_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx0::AnyEdge)
    }
}
#[doc = "Edge X 1\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Edgx1 {
    #[doc = "0: Disabled"]
    Disabled = 0,
    #[doc = "1: Capture falling edges"]
    FallingEdge = 1,
    #[doc = "2: Capture rising edges"]
    RisingEdge = 2,
    #[doc = "3: Capture any edge"]
    AnyEdge = 3,
}
impl From<Edgx1> for u8 {
    #[inline(always)]
    fn from(variant: Edgx1) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Edgx1 {
    type Ux = u8;
}
impl crate::IsEnum for Edgx1 {}
#[doc = "Field `EDGX1` reader - Edge X 1"]
pub type Edgx1R = crate::FieldReader<Edgx1>;
impl Edgx1R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Edgx1 {
        match self.bits {
            0 => Edgx1::Disabled,
            1 => Edgx1::FallingEdge,
            2 => Edgx1::RisingEdge,
            3 => Edgx1::AnyEdge,
            _ => unreachable!(),
        }
    }
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Edgx1::Disabled
    }
    #[doc = "Capture falling edges"]
    #[inline(always)]
    pub fn is_falling_edge(&self) -> bool {
        *self == Edgx1::FallingEdge
    }
    #[doc = "Capture rising edges"]
    #[inline(always)]
    pub fn is_rising_edge(&self) -> bool {
        *self == Edgx1::RisingEdge
    }
    #[doc = "Capture any edge"]
    #[inline(always)]
    pub fn is_any_edge(&self) -> bool {
        *self == Edgx1::AnyEdge
    }
}
#[doc = "Field `EDGX1` writer - Edge X 1"]
pub type Edgx1W<'a, REG> = crate::FieldWriter<'a, REG, 2, Edgx1, crate::Safe>;
impl<'a, REG> Edgx1W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Disabled"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx1::Disabled)
    }
    #[doc = "Capture falling edges"]
    #[inline(always)]
    pub fn falling_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx1::FallingEdge)
    }
    #[doc = "Capture rising edges"]
    #[inline(always)]
    pub fn rising_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx1::RisingEdge)
    }
    #[doc = "Capture any edge"]
    #[inline(always)]
    pub fn any_edge(self) -> &'a mut crate::W<REG> {
        self.variant(Edgx1::AnyEdge)
    }
}
#[doc = "Input Select X\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum InpSelx {
    #[doc = "0: Raw PWM_X input signal selected as source."]
    PwmX = 0,
    #[doc = "1: Edge Counter"]
    EdgeCounter = 1,
}
impl From<InpSelx> for bool {
    #[inline(always)]
    fn from(variant: InpSelx) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `INP_SELX` reader - Input Select X"]
pub type InpSelxR = crate::BitReader<InpSelx>;
impl InpSelxR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> InpSelx {
        match self.bits {
            false => InpSelx::PwmX,
            true => InpSelx::EdgeCounter,
        }
    }
    #[doc = "Raw PWM_X input signal selected as source."]
    #[inline(always)]
    pub fn is_pwm_x(&self) -> bool {
        *self == InpSelx::PwmX
    }
    #[doc = "Edge Counter"]
    #[inline(always)]
    pub fn is_edge_counter(&self) -> bool {
        *self == InpSelx::EdgeCounter
    }
}
#[doc = "Field `INP_SELX` writer - Input Select X"]
pub type InpSelxW<'a, REG> = crate::BitWriter<'a, REG, InpSelx>;
impl<'a, REG> InpSelxW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Raw PWM_X input signal selected as source."]
    #[inline(always)]
    pub fn pwm_x(self) -> &'a mut crate::W<REG> {
        self.variant(InpSelx::PwmX)
    }
    #[doc = "Edge Counter"]
    #[inline(always)]
    pub fn edge_counter(self) -> &'a mut crate::W<REG> {
        self.variant(InpSelx::EdgeCounter)
    }
}
#[doc = "Edge Counter X Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EdgcntxEn {
    #[doc = "0: Edge counter disabled and held in reset"]
    Disabled = 0,
    #[doc = "1: Edge counter enabled"]
    Enabled = 1,
}
impl From<EdgcntxEn> for bool {
    #[inline(always)]
    fn from(variant: EdgcntxEn) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `EDGCNTX_EN` reader - Edge Counter X Enable"]
pub type EdgcntxEnR = crate::BitReader<EdgcntxEn>;
impl EdgcntxEnR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> EdgcntxEn {
        match self.bits {
            false => EdgcntxEn::Disabled,
            true => EdgcntxEn::Enabled,
        }
    }
    #[doc = "Edge counter disabled and held in reset"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == EdgcntxEn::Disabled
    }
    #[doc = "Edge counter enabled"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == EdgcntxEn::Enabled
    }
}
#[doc = "Field `EDGCNTX_EN` writer - Edge Counter X Enable"]
pub type EdgcntxEnW<'a, REG> = crate::BitWriter<'a, REG, EdgcntxEn>;
impl<'a, REG> EdgcntxEnW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Edge counter disabled and held in reset"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(EdgcntxEn::Disabled)
    }
    #[doc = "Edge counter enabled"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(EdgcntxEn::Enabled)
    }
}
#[doc = "Field `CFXWM` reader - Capture X FIFOs Water Mark"]
pub type CfxwmR = crate::FieldReader;
#[doc = "Field `CFXWM` writer - Capture X FIFOs Water Mark"]
pub type CfxwmW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[doc = "Field `CX0CNT` reader - Capture X0 FIFO Word Count"]
pub type Cx0cntR = crate::FieldReader;
#[doc = "Field `CX1CNT` reader - Capture X1 FIFO Word Count"]
pub type Cx1cntR = crate::FieldReader;
impl R {
    #[doc = "Bit 0 - Arm X"]
    #[inline(always)]
    pub fn armx(&self) -> ArmxR {
        ArmxR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - One Shot Mode Aux"]
    #[inline(always)]
    pub fn oneshotx(&self) -> OneshotxR {
        OneshotxR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 2:3 - Edge X 0"]
    #[inline(always)]
    pub fn edgx0(&self) -> Edgx0R {
        Edgx0R::new(((self.bits >> 2) & 3) as u8)
    }
    #[doc = "Bits 4:5 - Edge X 1"]
    #[inline(always)]
    pub fn edgx1(&self) -> Edgx1R {
        Edgx1R::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bit 6 - Input Select X"]
    #[inline(always)]
    pub fn inp_selx(&self) -> InpSelxR {
        InpSelxR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Edge Counter X Enable"]
    #[inline(always)]
    pub fn edgcntx_en(&self) -> EdgcntxEnR {
        EdgcntxEnR::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bits 8:9 - Capture X FIFOs Water Mark"]
    #[inline(always)]
    pub fn cfxwm(&self) -> CfxwmR {
        CfxwmR::new(((self.bits >> 8) & 3) as u8)
    }
    #[doc = "Bits 10:12 - Capture X0 FIFO Word Count"]
    #[inline(always)]
    pub fn cx0cnt(&self) -> Cx0cntR {
        Cx0cntR::new(((self.bits >> 10) & 7) as u8)
    }
    #[doc = "Bits 13:15 - Capture X1 FIFO Word Count"]
    #[inline(always)]
    pub fn cx1cnt(&self) -> Cx1cntR {
        Cx1cntR::new(((self.bits >> 13) & 7) 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("SM3CAPTCTRLX")
            .field("armx", &self.armx())
            .field("oneshotx", &self.oneshotx())
            .field("edgx0", &self.edgx0())
            .field("edgx1", &self.edgx1())
            .field("inp_selx", &self.inp_selx())
            .field("edgcntx_en", &self.edgcntx_en())
            .field("cfxwm", &self.cfxwm())
            .field("cx0cnt", &self.cx0cnt())
            .field("cx1cnt", &self.cx1cnt())
            .finish()
    }
}
impl W {
    #[doc = "Bit 0 - Arm X"]
    #[inline(always)]
    pub fn armx(&mut self) -> ArmxW<'_, Sm3captctrlxSpec> {
        ArmxW::new(self, 0)
    }
    #[doc = "Bit 1 - One Shot Mode Aux"]
    #[inline(always)]
    pub fn oneshotx(&mut self) -> OneshotxW<'_, Sm3captctrlxSpec> {
        OneshotxW::new(self, 1)
    }
    #[doc = "Bits 2:3 - Edge X 0"]
    #[inline(always)]
    pub fn edgx0(&mut self) -> Edgx0W<'_, Sm3captctrlxSpec> {
        Edgx0W::new(self, 2)
    }
    #[doc = "Bits 4:5 - Edge X 1"]
    #[inline(always)]
    pub fn edgx1(&mut self) -> Edgx1W<'_, Sm3captctrlxSpec> {
        Edgx1W::new(self, 4)
    }
    #[doc = "Bit 6 - Input Select X"]
    #[inline(always)]
    pub fn inp_selx(&mut self) -> InpSelxW<'_, Sm3captctrlxSpec> {
        InpSelxW::new(self, 6)
    }
    #[doc = "Bit 7 - Edge Counter X Enable"]
    #[inline(always)]
    pub fn edgcntx_en(&mut self) -> EdgcntxEnW<'_, Sm3captctrlxSpec> {
        EdgcntxEnW::new(self, 7)
    }
    #[doc = "Bits 8:9 - Capture X FIFOs Water Mark"]
    #[inline(always)]
    pub fn cfxwm(&mut self) -> CfxwmW<'_, Sm3captctrlxSpec> {
        CfxwmW::new(self, 8)
    }
}
#[doc = "Capture Control X Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sm3captctrlx::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sm3captctrlx::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Sm3captctrlxSpec;
impl crate::RegisterSpec for Sm3captctrlxSpec {
    type Ux = u16;
}
#[doc = "`read()` method returns [`sm3captctrlx::R`](R) reader structure"]
impl crate::Readable for Sm3captctrlxSpec {}
#[doc = "`write(|w| ..)` method takes [`sm3captctrlx::W`](W) writer structure"]
impl crate::Writable for Sm3captctrlxSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets SM3CAPTCTRLX to value 0"]
impl crate::Resettable for Sm3captctrlxSpec {}