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
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
#[doc = "Register `SM3CTRL2` reader"]
pub type R = crate::R<Sm3ctrl2Spec>;
#[doc = "Register `SM3CTRL2` writer"]
pub type W = crate::W<Sm3ctrl2Spec>;
#[doc = "Clock Source Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ClkSel {
    #[doc = "0: The IPBus clock is used as the clock for the local prescaler and counter."]
    Ipbus = 0,
    #[doc = "1: EXT_CLK is used as the clock for the local prescaler and counter."]
    ExtClk = 1,
    #[doc = "2: Submodule 0's clock (AUX_CLK) is used as the source clock for the local prescaler and counter. This setting should not be used in submodule 0 as it forces the clock to logic 0."]
    AuxClk = 2,
}
impl From<ClkSel> for u8 {
    #[inline(always)]
    fn from(variant: ClkSel) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for ClkSel {
    type Ux = u8;
}
impl crate::IsEnum for ClkSel {}
#[doc = "Field `CLK_SEL` reader - Clock Source Select"]
pub type ClkSelR = crate::FieldReader<ClkSel>;
impl ClkSelR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<ClkSel> {
        match self.bits {
            0 => Some(ClkSel::Ipbus),
            1 => Some(ClkSel::ExtClk),
            2 => Some(ClkSel::AuxClk),
            _ => None,
        }
    }
    #[doc = "The IPBus clock is used as the clock for the local prescaler and counter."]
    #[inline(always)]
    pub fn is_ipbus(&self) -> bool {
        *self == ClkSel::Ipbus
    }
    #[doc = "EXT_CLK is used as the clock for the local prescaler and counter."]
    #[inline(always)]
    pub fn is_ext_clk(&self) -> bool {
        *self == ClkSel::ExtClk
    }
    #[doc = "Submodule 0's clock (AUX_CLK) is used as the source clock for the local prescaler and counter. This setting should not be used in submodule 0 as it forces the clock to logic 0."]
    #[inline(always)]
    pub fn is_aux_clk(&self) -> bool {
        *self == ClkSel::AuxClk
    }
}
#[doc = "Field `CLK_SEL` writer - Clock Source Select"]
pub type ClkSelW<'a, REG> = crate::FieldWriter<'a, REG, 2, ClkSel>;
impl<'a, REG> ClkSelW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "The IPBus clock is used as the clock for the local prescaler and counter."]
    #[inline(always)]
    pub fn ipbus(self) -> &'a mut crate::W<REG> {
        self.variant(ClkSel::Ipbus)
    }
    #[doc = "EXT_CLK is used as the clock for the local prescaler and counter."]
    #[inline(always)]
    pub fn ext_clk(self) -> &'a mut crate::W<REG> {
        self.variant(ClkSel::ExtClk)
    }
    #[doc = "Submodule 0's clock (AUX_CLK) is used as the source clock for the local prescaler and counter. This setting should not be used in submodule 0 as it forces the clock to logic 0."]
    #[inline(always)]
    pub fn aux_clk(self) -> &'a mut crate::W<REG> {
        self.variant(ClkSel::AuxClk)
    }
}
#[doc = "Reload Source Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ReloadSel {
    #[doc = "0: The local RELOAD signal is used to reload registers."]
    Local = 0,
    #[doc = "1: The master RELOAD signal (from submodule 0) is used to reload registers. This setting should not be used in submodule 0 as it forces the RELOAD signal to logic 0."]
    Master = 1,
}
impl From<ReloadSel> for bool {
    #[inline(always)]
    fn from(variant: ReloadSel) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RELOAD_SEL` reader - Reload Source Select"]
pub type ReloadSelR = crate::BitReader<ReloadSel>;
impl ReloadSelR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> ReloadSel {
        match self.bits {
            false => ReloadSel::Local,
            true => ReloadSel::Master,
        }
    }
    #[doc = "The local RELOAD signal is used to reload registers."]
    #[inline(always)]
    pub fn is_local(&self) -> bool {
        *self == ReloadSel::Local
    }
    #[doc = "The master RELOAD signal (from submodule 0) is used to reload registers. This setting should not be used in submodule 0 as it forces the RELOAD signal to logic 0."]
    #[inline(always)]
    pub fn is_master(&self) -> bool {
        *self == ReloadSel::Master
    }
}
#[doc = "Field `RELOAD_SEL` writer - Reload Source Select"]
pub type ReloadSelW<'a, REG> = crate::BitWriter<'a, REG, ReloadSel>;
impl<'a, REG> ReloadSelW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The local RELOAD signal is used to reload registers."]
    #[inline(always)]
    pub fn local(self) -> &'a mut crate::W<REG> {
        self.variant(ReloadSel::Local)
    }
    #[doc = "The master RELOAD signal (from submodule 0) is used to reload registers. This setting should not be used in submodule 0 as it forces the RELOAD signal to logic 0."]
    #[inline(always)]
    pub fn master(self) -> &'a mut crate::W<REG> {
        self.variant(ReloadSel::Master)
    }
}
#[doc = "Force Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ForceSel {
    #[doc = "0: The local force signal, CTRL2\\[FORCE\\], from this submodule is used to force updates."]
    Local = 0,
    #[doc = "1: The master force signal from submodule 0 is used to force updates. This setting should not be used in submodule 0 as it holds the FORCE OUTPUT signal to logic 0."]
    Master = 1,
    #[doc = "2: The local reload signal from this submodule is used to force updates without regard to the state of LDOK."]
    LocalReload = 2,
    #[doc = "3: The master reload signal from submodule0 is used to force updates if LDOK is set. This setting should not be used in submodule0 as it holds the FORCE OUTPUT signal to logic 0."]
    MasterReload = 3,
    #[doc = "4: The local sync signal from this submodule is used to force updates."]
    LocalSync = 4,
    #[doc = "5: The master sync signal from submodule0 is used to force updates. This setting should not be used in submodule0 as it holds the FORCE OUTPUT signal to logic 0."]
    MasterSync = 5,
    #[doc = "6: The external force signal, EXT_FORCE, from outside the PWM module causes updates."]
    ExtForce = 6,
    #[doc = "7: The external sync signal, EXT_SYNC, from outside the PWM module causes updates."]
    ExtSync = 7,
}
impl From<ForceSel> for u8 {
    #[inline(always)]
    fn from(variant: ForceSel) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for ForceSel {
    type Ux = u8;
}
impl crate::IsEnum for ForceSel {}
#[doc = "Field `FORCE_SEL` reader - Force Select"]
pub type ForceSelR = crate::FieldReader<ForceSel>;
impl ForceSelR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> ForceSel {
        match self.bits {
            0 => ForceSel::Local,
            1 => ForceSel::Master,
            2 => ForceSel::LocalReload,
            3 => ForceSel::MasterReload,
            4 => ForceSel::LocalSync,
            5 => ForceSel::MasterSync,
            6 => ForceSel::ExtForce,
            7 => ForceSel::ExtSync,
            _ => unreachable!(),
        }
    }
    #[doc = "The local force signal, CTRL2\\[FORCE\\], from this submodule is used to force updates."]
    #[inline(always)]
    pub fn is_local(&self) -> bool {
        *self == ForceSel::Local
    }
    #[doc = "The master force signal from submodule 0 is used to force updates. This setting should not be used in submodule 0 as it holds the FORCE OUTPUT signal to logic 0."]
    #[inline(always)]
    pub fn is_master(&self) -> bool {
        *self == ForceSel::Master
    }
    #[doc = "The local reload signal from this submodule is used to force updates without regard to the state of LDOK."]
    #[inline(always)]
    pub fn is_local_reload(&self) -> bool {
        *self == ForceSel::LocalReload
    }
    #[doc = "The master reload signal from submodule0 is used to force updates if LDOK is set. This setting should not be used in submodule0 as it holds the FORCE OUTPUT signal to logic 0."]
    #[inline(always)]
    pub fn is_master_reload(&self) -> bool {
        *self == ForceSel::MasterReload
    }
    #[doc = "The local sync signal from this submodule is used to force updates."]
    #[inline(always)]
    pub fn is_local_sync(&self) -> bool {
        *self == ForceSel::LocalSync
    }
    #[doc = "The master sync signal from submodule0 is used to force updates. This setting should not be used in submodule0 as it holds the FORCE OUTPUT signal to logic 0."]
    #[inline(always)]
    pub fn is_master_sync(&self) -> bool {
        *self == ForceSel::MasterSync
    }
    #[doc = "The external force signal, EXT_FORCE, from outside the PWM module causes updates."]
    #[inline(always)]
    pub fn is_ext_force(&self) -> bool {
        *self == ForceSel::ExtForce
    }
    #[doc = "The external sync signal, EXT_SYNC, from outside the PWM module causes updates."]
    #[inline(always)]
    pub fn is_ext_sync(&self) -> bool {
        *self == ForceSel::ExtSync
    }
}
#[doc = "Field `FORCE_SEL` writer - Force Select"]
pub type ForceSelW<'a, REG> = crate::FieldWriter<'a, REG, 3, ForceSel, crate::Safe>;
impl<'a, REG> ForceSelW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "The local force signal, CTRL2\\[FORCE\\], from this submodule is used to force updates."]
    #[inline(always)]
    pub fn local(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::Local)
    }
    #[doc = "The master force signal from submodule 0 is used to force updates. This setting should not be used in submodule 0 as it holds the FORCE OUTPUT signal to logic 0."]
    #[inline(always)]
    pub fn master(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::Master)
    }
    #[doc = "The local reload signal from this submodule is used to force updates without regard to the state of LDOK."]
    #[inline(always)]
    pub fn local_reload(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::LocalReload)
    }
    #[doc = "The master reload signal from submodule0 is used to force updates if LDOK is set. This setting should not be used in submodule0 as it holds the FORCE OUTPUT signal to logic 0."]
    #[inline(always)]
    pub fn master_reload(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::MasterReload)
    }
    #[doc = "The local sync signal from this submodule is used to force updates."]
    #[inline(always)]
    pub fn local_sync(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::LocalSync)
    }
    #[doc = "The master sync signal from submodule0 is used to force updates. This setting should not be used in submodule0 as it holds the FORCE OUTPUT signal to logic 0."]
    #[inline(always)]
    pub fn master_sync(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::MasterSync)
    }
    #[doc = "The external force signal, EXT_FORCE, from outside the PWM module causes updates."]
    #[inline(always)]
    pub fn ext_force(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::ExtForce)
    }
    #[doc = "The external sync signal, EXT_SYNC, from outside the PWM module causes updates."]
    #[inline(always)]
    pub fn ext_sync(self) -> &'a mut crate::W<REG> {
        self.variant(ForceSel::ExtSync)
    }
}
#[doc = "Field `FORCE` reader - Force Initialization"]
pub type ForceR = crate::BitReader;
#[doc = "Field `FORCE` writer - Force Initialization"]
pub type ForceW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Force Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Frcen {
    #[doc = "0: Initialization from a FORCE_OUT is disabled."]
    Disabled = 0,
    #[doc = "1: Initialization from a FORCE_OUT is enabled."]
    Enabled = 1,
}
impl From<Frcen> for bool {
    #[inline(always)]
    fn from(variant: Frcen) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `FRCEN` reader - Force Enable"]
pub type FrcenR = crate::BitReader<Frcen>;
impl FrcenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Frcen {
        match self.bits {
            false => Frcen::Disabled,
            true => Frcen::Enabled,
        }
    }
    #[doc = "Initialization from a FORCE_OUT is disabled."]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == Frcen::Disabled
    }
    #[doc = "Initialization from a FORCE_OUT is enabled."]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == Frcen::Enabled
    }
}
#[doc = "Field `FRCEN` writer - Force Enable"]
pub type FrcenW<'a, REG> = crate::BitWriter<'a, REG, Frcen>;
impl<'a, REG> FrcenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Initialization from a FORCE_OUT is disabled."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(Frcen::Disabled)
    }
    #[doc = "Initialization from a FORCE_OUT is enabled."]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(Frcen::Enabled)
    }
}
#[doc = "Initialization Control Select\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum InitSel {
    #[doc = "0: Local sync (PWM_X) causes initialization."]
    PwmX = 0,
    #[doc = "1: Master reload from submodule 0 causes initialization. This setting should not be used in submodule 0 as it forces the INIT signal to logic 0. The submodule counter will only re-initialize when a master reload occurs."]
    MasterReload = 1,
    #[doc = "2: Master sync from submodule 0 causes initialization. This setting should not be used in submodule 0 as it forces the INIT signal to logic 0."]
    MasterSync = 2,
    #[doc = "3: EXT_SYNC causes initialization."]
    ExtSync = 3,
}
impl From<InitSel> for u8 {
    #[inline(always)]
    fn from(variant: InitSel) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for InitSel {
    type Ux = u8;
}
impl crate::IsEnum for InitSel {}
#[doc = "Field `INIT_SEL` reader - Initialization Control Select"]
pub type InitSelR = crate::FieldReader<InitSel>;
impl InitSelR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> InitSel {
        match self.bits {
            0 => InitSel::PwmX,
            1 => InitSel::MasterReload,
            2 => InitSel::MasterSync,
            3 => InitSel::ExtSync,
            _ => unreachable!(),
        }
    }
    #[doc = "Local sync (PWM_X) causes initialization."]
    #[inline(always)]
    pub fn is_pwm_x(&self) -> bool {
        *self == InitSel::PwmX
    }
    #[doc = "Master reload from submodule 0 causes initialization. This setting should not be used in submodule 0 as it forces the INIT signal to logic 0. The submodule counter will only re-initialize when a master reload occurs."]
    #[inline(always)]
    pub fn is_master_reload(&self) -> bool {
        *self == InitSel::MasterReload
    }
    #[doc = "Master sync from submodule 0 causes initialization. This setting should not be used in submodule 0 as it forces the INIT signal to logic 0."]
    #[inline(always)]
    pub fn is_master_sync(&self) -> bool {
        *self == InitSel::MasterSync
    }
    #[doc = "EXT_SYNC causes initialization."]
    #[inline(always)]
    pub fn is_ext_sync(&self) -> bool {
        *self == InitSel::ExtSync
    }
}
#[doc = "Field `INIT_SEL` writer - Initialization Control Select"]
pub type InitSelW<'a, REG> = crate::FieldWriter<'a, REG, 2, InitSel, crate::Safe>;
impl<'a, REG> InitSelW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Local sync (PWM_X) causes initialization."]
    #[inline(always)]
    pub fn pwm_x(self) -> &'a mut crate::W<REG> {
        self.variant(InitSel::PwmX)
    }
    #[doc = "Master reload from submodule 0 causes initialization. This setting should not be used in submodule 0 as it forces the INIT signal to logic 0. The submodule counter will only re-initialize when a master reload occurs."]
    #[inline(always)]
    pub fn master_reload(self) -> &'a mut crate::W<REG> {
        self.variant(InitSel::MasterReload)
    }
    #[doc = "Master sync from submodule 0 causes initialization. This setting should not be used in submodule 0 as it forces the INIT signal to logic 0."]
    #[inline(always)]
    pub fn master_sync(self) -> &'a mut crate::W<REG> {
        self.variant(InitSel::MasterSync)
    }
    #[doc = "EXT_SYNC causes initialization."]
    #[inline(always)]
    pub fn ext_sync(self) -> &'a mut crate::W<REG> {
        self.variant(InitSel::ExtSync)
    }
}
#[doc = "Field `PWMX_INIT` reader - PWM_X Initial Value"]
pub type PwmxInitR = crate::BitReader;
#[doc = "Field `PWMX_INIT` writer - PWM_X Initial Value"]
pub type PwmxInitW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PWM45_INIT` reader - PWM45 Initial Value"]
pub type Pwm45InitR = crate::BitReader;
#[doc = "Field `PWM45_INIT` writer - PWM45 Initial Value"]
pub type Pwm45InitW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PWM23_INIT` reader - PWM23 Initial Value"]
pub type Pwm23InitR = crate::BitReader;
#[doc = "Field `PWM23_INIT` writer - PWM23 Initial Value"]
pub type Pwm23InitW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Independent or Complementary Pair Operation\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Indep {
    #[doc = "0: PWM_A and PWM_B form a complementary PWM pair."]
    Complementary = 0,
    #[doc = "1: PWM_A and PWM_B outputs are independent PWMs."]
    Independent = 1,
}
impl From<Indep> for bool {
    #[inline(always)]
    fn from(variant: Indep) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `INDEP` reader - Independent or Complementary Pair Operation"]
pub type IndepR = crate::BitReader<Indep>;
impl IndepR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Indep {
        match self.bits {
            false => Indep::Complementary,
            true => Indep::Independent,
        }
    }
    #[doc = "PWM_A and PWM_B form a complementary PWM pair."]
    #[inline(always)]
    pub fn is_complementary(&self) -> bool {
        *self == Indep::Complementary
    }
    #[doc = "PWM_A and PWM_B outputs are independent PWMs."]
    #[inline(always)]
    pub fn is_independent(&self) -> bool {
        *self == Indep::Independent
    }
}
#[doc = "Field `INDEP` writer - Independent or Complementary Pair Operation"]
pub type IndepW<'a, REG> = crate::BitWriter<'a, REG, Indep>;
impl<'a, REG> IndepW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "PWM_A and PWM_B form a complementary PWM pair."]
    #[inline(always)]
    pub fn complementary(self) -> &'a mut crate::W<REG> {
        self.variant(Indep::Complementary)
    }
    #[doc = "PWM_A and PWM_B outputs are independent PWMs."]
    #[inline(always)]
    pub fn independent(self) -> &'a mut crate::W<REG> {
        self.variant(Indep::Independent)
    }
}
#[doc = "Field `DBGEN` reader - Debug Enable"]
pub type DbgenR = crate::BitReader;
#[doc = "Field `DBGEN` writer - Debug Enable"]
pub type DbgenW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
    #[doc = "Bits 0:1 - Clock Source Select"]
    #[inline(always)]
    pub fn clk_sel(&self) -> ClkSelR {
        ClkSelR::new((self.bits & 3) as u8)
    }
    #[doc = "Bit 2 - Reload Source Select"]
    #[inline(always)]
    pub fn reload_sel(&self) -> ReloadSelR {
        ReloadSelR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bits 3:5 - Force Select"]
    #[inline(always)]
    pub fn force_sel(&self) -> ForceSelR {
        ForceSelR::new(((self.bits >> 3) & 7) as u8)
    }
    #[doc = "Bit 6 - Force Initialization"]
    #[inline(always)]
    pub fn force(&self) -> ForceR {
        ForceR::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Force Enable"]
    #[inline(always)]
    pub fn frcen(&self) -> FrcenR {
        FrcenR::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bits 8:9 - Initialization Control Select"]
    #[inline(always)]
    pub fn init_sel(&self) -> InitSelR {
        InitSelR::new(((self.bits >> 8) & 3) as u8)
    }
    #[doc = "Bit 10 - PWM_X Initial Value"]
    #[inline(always)]
    pub fn pwmx_init(&self) -> PwmxInitR {
        PwmxInitR::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - PWM45 Initial Value"]
    #[inline(always)]
    pub fn pwm45_init(&self) -> Pwm45InitR {
        Pwm45InitR::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - PWM23 Initial Value"]
    #[inline(always)]
    pub fn pwm23_init(&self) -> Pwm23InitR {
        Pwm23InitR::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - Independent or Complementary Pair Operation"]
    #[inline(always)]
    pub fn indep(&self) -> IndepR {
        IndepR::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bit 15 - Debug Enable"]
    #[inline(always)]
    pub fn dbgen(&self) -> DbgenR {
        DbgenR::new(((self.bits >> 15) & 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("SM3CTRL2")
            .field("clk_sel", &self.clk_sel())
            .field("reload_sel", &self.reload_sel())
            .field("force_sel", &self.force_sel())
            .field("force", &self.force())
            .field("frcen", &self.frcen())
            .field("init_sel", &self.init_sel())
            .field("pwmx_init", &self.pwmx_init())
            .field("pwm45_init", &self.pwm45_init())
            .field("pwm23_init", &self.pwm23_init())
            .field("indep", &self.indep())
            .field("dbgen", &self.dbgen())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:1 - Clock Source Select"]
    #[inline(always)]
    pub fn clk_sel(&mut self) -> ClkSelW<'_, Sm3ctrl2Spec> {
        ClkSelW::new(self, 0)
    }
    #[doc = "Bit 2 - Reload Source Select"]
    #[inline(always)]
    pub fn reload_sel(&mut self) -> ReloadSelW<'_, Sm3ctrl2Spec> {
        ReloadSelW::new(self, 2)
    }
    #[doc = "Bits 3:5 - Force Select"]
    #[inline(always)]
    pub fn force_sel(&mut self) -> ForceSelW<'_, Sm3ctrl2Spec> {
        ForceSelW::new(self, 3)
    }
    #[doc = "Bit 6 - Force Initialization"]
    #[inline(always)]
    pub fn force(&mut self) -> ForceW<'_, Sm3ctrl2Spec> {
        ForceW::new(self, 6)
    }
    #[doc = "Bit 7 - Force Enable"]
    #[inline(always)]
    pub fn frcen(&mut self) -> FrcenW<'_, Sm3ctrl2Spec> {
        FrcenW::new(self, 7)
    }
    #[doc = "Bits 8:9 - Initialization Control Select"]
    #[inline(always)]
    pub fn init_sel(&mut self) -> InitSelW<'_, Sm3ctrl2Spec> {
        InitSelW::new(self, 8)
    }
    #[doc = "Bit 10 - PWM_X Initial Value"]
    #[inline(always)]
    pub fn pwmx_init(&mut self) -> PwmxInitW<'_, Sm3ctrl2Spec> {
        PwmxInitW::new(self, 10)
    }
    #[doc = "Bit 11 - PWM45 Initial Value"]
    #[inline(always)]
    pub fn pwm45_init(&mut self) -> Pwm45InitW<'_, Sm3ctrl2Spec> {
        Pwm45InitW::new(self, 11)
    }
    #[doc = "Bit 12 - PWM23 Initial Value"]
    #[inline(always)]
    pub fn pwm23_init(&mut self) -> Pwm23InitW<'_, Sm3ctrl2Spec> {
        Pwm23InitW::new(self, 12)
    }
    #[doc = "Bit 13 - Independent or Complementary Pair Operation"]
    #[inline(always)]
    pub fn indep(&mut self) -> IndepW<'_, Sm3ctrl2Spec> {
        IndepW::new(self, 13)
    }
    #[doc = "Bit 15 - Debug Enable"]
    #[inline(always)]
    pub fn dbgen(&mut self) -> DbgenW<'_, Sm3ctrl2Spec> {
        DbgenW::new(self, 15)
    }
}
#[doc = "Control 2 Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sm3ctrl2::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sm3ctrl2::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Sm3ctrl2Spec;
impl crate::RegisterSpec for Sm3ctrl2Spec {
    type Ux = u16;
}
#[doc = "`read()` method returns [`sm3ctrl2::R`](R) reader structure"]
impl crate::Readable for Sm3ctrl2Spec {}
#[doc = "`write(|w| ..)` method takes [`sm3ctrl2::W`](W) writer structure"]
impl crate::Writable for Sm3ctrl2Spec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets SM3CTRL2 to value 0"]
impl crate::Resettable for Sm3ctrl2Spec {}