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
#[doc = "Register `SHIFTCFG[%s]` reader"]
pub type R = crate::R<ShiftcfgSpec>;
#[doc = "Register `SHIFTCFG[%s]` writer"]
pub type W = crate::W<ShiftcfgSpec>;
#[doc = "Shifter Start\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Sstart {
    #[doc = "0: Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on enable"]
    Value00 = 0,
    #[doc = "1: Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on first shift"]
    Value01 = 1,
    #[doc = "2: Transmitter mode outputs start bit value 0 before loading data on first shift; if start bit is not 0, Receiver and Match Store modes set error flag"]
    Value10 = 2,
    #[doc = "3: Transmitter mode outputs start bit value 1 before loading data on first shift; if start bit is not 1, Receiver and Match Store modes set error flag"]
    Value11 = 3,
}
impl From<Sstart> for u8 {
    #[inline(always)]
    fn from(variant: Sstart) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Sstart {
    type Ux = u8;
}
impl crate::IsEnum for Sstart {}
#[doc = "Field `SSTART` reader - Shifter Start"]
pub type SstartR = crate::FieldReader<Sstart>;
impl SstartR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Sstart {
        match self.bits {
            0 => Sstart::Value00,
            1 => Sstart::Value01,
            2 => Sstart::Value10,
            3 => Sstart::Value11,
            _ => unreachable!(),
        }
    }
    #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on enable"]
    #[inline(always)]
    pub fn is_value00(&self) -> bool {
        *self == Sstart::Value00
    }
    #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on first shift"]
    #[inline(always)]
    pub fn is_value01(&self) -> bool {
        *self == Sstart::Value01
    }
    #[doc = "Transmitter mode outputs start bit value 0 before loading data on first shift; if start bit is not 0, Receiver and Match Store modes set error flag"]
    #[inline(always)]
    pub fn is_value10(&self) -> bool {
        *self == Sstart::Value10
    }
    #[doc = "Transmitter mode outputs start bit value 1 before loading data on first shift; if start bit is not 1, Receiver and Match Store modes set error flag"]
    #[inline(always)]
    pub fn is_value11(&self) -> bool {
        *self == Sstart::Value11
    }
}
#[doc = "Field `SSTART` writer - Shifter Start"]
pub type SstartW<'a, REG> = crate::FieldWriter<'a, REG, 2, Sstart, crate::Safe>;
impl<'a, REG> SstartW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on enable"]
    #[inline(always)]
    pub fn value00(self) -> &'a mut crate::W<REG> {
        self.variant(Sstart::Value00)
    }
    #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on first shift"]
    #[inline(always)]
    pub fn value01(self) -> &'a mut crate::W<REG> {
        self.variant(Sstart::Value01)
    }
    #[doc = "Transmitter mode outputs start bit value 0 before loading data on first shift; if start bit is not 0, Receiver and Match Store modes set error flag"]
    #[inline(always)]
    pub fn value10(self) -> &'a mut crate::W<REG> {
        self.variant(Sstart::Value10)
    }
    #[doc = "Transmitter mode outputs start bit value 1 before loading data on first shift; if start bit is not 1, Receiver and Match Store modes set error flag"]
    #[inline(always)]
    pub fn value11(self) -> &'a mut crate::W<REG> {
        self.variant(Sstart::Value11)
    }
}
#[doc = "Shifter Stop\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Sstop {
    #[doc = "0: Stop bit disabled for Transmitter, Receiver, and Match Store modes"]
    Value00 = 0,
    #[doc = "1: Stop bit disabled for Transmitter, Receiver, and Match Store modes; when timer is in stop condition, Receiver and Match Store modes store receive data on the configured shift edge"]
    Value01 = 1,
    #[doc = "2: Transmitter mode outputs stop bit value 0 in Match Store mode; if stop bit is not 0, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
    Value10 = 2,
    #[doc = "3: Transmitter mode outputs stop bit value 1 in Match Store mode; if stop bit is not 1, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
    Value11 = 3,
}
impl From<Sstop> for u8 {
    #[inline(always)]
    fn from(variant: Sstop) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Sstop {
    type Ux = u8;
}
impl crate::IsEnum for Sstop {}
#[doc = "Field `SSTOP` reader - Shifter Stop"]
pub type SstopR = crate::FieldReader<Sstop>;
impl SstopR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Sstop {
        match self.bits {
            0 => Sstop::Value00,
            1 => Sstop::Value01,
            2 => Sstop::Value10,
            3 => Sstop::Value11,
            _ => unreachable!(),
        }
    }
    #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes"]
    #[inline(always)]
    pub fn is_value00(&self) -> bool {
        *self == Sstop::Value00
    }
    #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes; when timer is in stop condition, Receiver and Match Store modes store receive data on the configured shift edge"]
    #[inline(always)]
    pub fn is_value01(&self) -> bool {
        *self == Sstop::Value01
    }
    #[doc = "Transmitter mode outputs stop bit value 0 in Match Store mode; if stop bit is not 0, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
    #[inline(always)]
    pub fn is_value10(&self) -> bool {
        *self == Sstop::Value10
    }
    #[doc = "Transmitter mode outputs stop bit value 1 in Match Store mode; if stop bit is not 1, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
    #[inline(always)]
    pub fn is_value11(&self) -> bool {
        *self == Sstop::Value11
    }
}
#[doc = "Field `SSTOP` writer - Shifter Stop"]
pub type SstopW<'a, REG> = crate::FieldWriter<'a, REG, 2, Sstop, crate::Safe>;
impl<'a, REG> SstopW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes"]
    #[inline(always)]
    pub fn value00(self) -> &'a mut crate::W<REG> {
        self.variant(Sstop::Value00)
    }
    #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes; when timer is in stop condition, Receiver and Match Store modes store receive data on the configured shift edge"]
    #[inline(always)]
    pub fn value01(self) -> &'a mut crate::W<REG> {
        self.variant(Sstop::Value01)
    }
    #[doc = "Transmitter mode outputs stop bit value 0 in Match Store mode; if stop bit is not 0, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
    #[inline(always)]
    pub fn value10(self) -> &'a mut crate::W<REG> {
        self.variant(Sstop::Value10)
    }
    #[doc = "Transmitter mode outputs stop bit value 1 in Match Store mode; if stop bit is not 1, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
    #[inline(always)]
    pub fn value11(self) -> &'a mut crate::W<REG> {
        self.variant(Sstop::Value11)
    }
}
#[doc = "Input Source\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Insrc {
    #[doc = "0: Pin"]
    Pin = 0,
    #[doc = "1: Shifter n+1 output"]
    ShifterNplus1 = 1,
}
impl From<Insrc> for bool {
    #[inline(always)]
    fn from(variant: Insrc) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `INSRC` reader - Input Source"]
pub type InsrcR = crate::BitReader<Insrc>;
impl InsrcR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Insrc {
        match self.bits {
            false => Insrc::Pin,
            true => Insrc::ShifterNplus1,
        }
    }
    #[doc = "Pin"]
    #[inline(always)]
    pub fn is_pin(&self) -> bool {
        *self == Insrc::Pin
    }
    #[doc = "Shifter n+1 output"]
    #[inline(always)]
    pub fn is_shifter_nplus1(&self) -> bool {
        *self == Insrc::ShifterNplus1
    }
}
#[doc = "Field `INSRC` writer - Input Source"]
pub type InsrcW<'a, REG> = crate::BitWriter<'a, REG, Insrc>;
impl<'a, REG> InsrcW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Pin"]
    #[inline(always)]
    pub fn pin(self) -> &'a mut crate::W<REG> {
        self.variant(Insrc::Pin)
    }
    #[doc = "Shifter n+1 output"]
    #[inline(always)]
    pub fn shifter_nplus1(self) -> &'a mut crate::W<REG> {
        self.variant(Insrc::ShifterNplus1)
    }
}
#[doc = "Late Store\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Latst {
    #[doc = "0: Store the pre-shift register state"]
    Preshift = 0,
    #[doc = "1: Store the post-shift register state"]
    Postshift = 1,
}
impl From<Latst> for bool {
    #[inline(always)]
    fn from(variant: Latst) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LATST` reader - Late Store"]
pub type LatstR = crate::BitReader<Latst>;
impl LatstR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Latst {
        match self.bits {
            false => Latst::Preshift,
            true => Latst::Postshift,
        }
    }
    #[doc = "Store the pre-shift register state"]
    #[inline(always)]
    pub fn is_preshift(&self) -> bool {
        *self == Latst::Preshift
    }
    #[doc = "Store the post-shift register state"]
    #[inline(always)]
    pub fn is_postshift(&self) -> bool {
        *self == Latst::Postshift
    }
}
#[doc = "Field `LATST` writer - Late Store"]
pub type LatstW<'a, REG> = crate::BitWriter<'a, REG, Latst>;
impl<'a, REG> LatstW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Store the pre-shift register state"]
    #[inline(always)]
    pub fn preshift(self) -> &'a mut crate::W<REG> {
        self.variant(Latst::Preshift)
    }
    #[doc = "Store the post-shift register state"]
    #[inline(always)]
    pub fn postshift(self) -> &'a mut crate::W<REG> {
        self.variant(Latst::Postshift)
    }
}
#[doc = "Shifter Size\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Ssize {
    #[doc = "0: 32-bit"]
    Width32 = 0,
    #[doc = "1: 24-bit"]
    Width24 = 1,
}
impl From<Ssize> for bool {
    #[inline(always)]
    fn from(variant: Ssize) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SSIZE` reader - Shifter Size"]
pub type SsizeR = crate::BitReader<Ssize>;
impl SsizeR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Ssize {
        match self.bits {
            false => Ssize::Width32,
            true => Ssize::Width24,
        }
    }
    #[doc = "32-bit"]
    #[inline(always)]
    pub fn is_width32(&self) -> bool {
        *self == Ssize::Width32
    }
    #[doc = "24-bit"]
    #[inline(always)]
    pub fn is_width24(&self) -> bool {
        *self == Ssize::Width24
    }
}
#[doc = "Field `SSIZE` writer - Shifter Size"]
pub type SsizeW<'a, REG> = crate::BitWriter<'a, REG, Ssize>;
impl<'a, REG> SsizeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "32-bit"]
    #[inline(always)]
    pub fn width32(self) -> &'a mut crate::W<REG> {
        self.variant(Ssize::Width32)
    }
    #[doc = "24-bit"]
    #[inline(always)]
    pub fn width24(self) -> &'a mut crate::W<REG> {
        self.variant(Ssize::Width24)
    }
}
#[doc = "Field `PWIDTH` reader - Parallel Width"]
pub type PwidthR = crate::FieldReader;
#[doc = "Field `PWIDTH` writer - Parallel Width"]
pub type PwidthW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
impl R {
    #[doc = "Bits 0:1 - Shifter Start"]
    #[inline(always)]
    pub fn sstart(&self) -> SstartR {
        SstartR::new((self.bits & 3) as u8)
    }
    #[doc = "Bits 4:5 - Shifter Stop"]
    #[inline(always)]
    pub fn sstop(&self) -> SstopR {
        SstopR::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bit 8 - Input Source"]
    #[inline(always)]
    pub fn insrc(&self) -> InsrcR {
        InsrcR::new(((self.bits >> 8) & 1) != 0)
    }
    #[doc = "Bit 9 - Late Store"]
    #[inline(always)]
    pub fn latst(&self) -> LatstR {
        LatstR::new(((self.bits >> 9) & 1) != 0)
    }
    #[doc = "Bit 12 - Shifter Size"]
    #[inline(always)]
    pub fn ssize(&self) -> SsizeR {
        SsizeR::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bits 16:20 - Parallel Width"]
    #[inline(always)]
    pub fn pwidth(&self) -> PwidthR {
        PwidthR::new(((self.bits >> 16) & 0x1f) 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("SHIFTCFG")
            .field("sstart", &self.sstart())
            .field("sstop", &self.sstop())
            .field("insrc", &self.insrc())
            .field("latst", &self.latst())
            .field("ssize", &self.ssize())
            .field("pwidth", &self.pwidth())
            .finish()
    }
}
impl W {
    #[doc = "Bits 0:1 - Shifter Start"]
    #[inline(always)]
    pub fn sstart(&mut self) -> SstartW<'_, ShiftcfgSpec> {
        SstartW::new(self, 0)
    }
    #[doc = "Bits 4:5 - Shifter Stop"]
    #[inline(always)]
    pub fn sstop(&mut self) -> SstopW<'_, ShiftcfgSpec> {
        SstopW::new(self, 4)
    }
    #[doc = "Bit 8 - Input Source"]
    #[inline(always)]
    pub fn insrc(&mut self) -> InsrcW<'_, ShiftcfgSpec> {
        InsrcW::new(self, 8)
    }
    #[doc = "Bit 9 - Late Store"]
    #[inline(always)]
    pub fn latst(&mut self) -> LatstW<'_, ShiftcfgSpec> {
        LatstW::new(self, 9)
    }
    #[doc = "Bit 12 - Shifter Size"]
    #[inline(always)]
    pub fn ssize(&mut self) -> SsizeW<'_, ShiftcfgSpec> {
        SsizeW::new(self, 12)
    }
    #[doc = "Bits 16:20 - Parallel Width"]
    #[inline(always)]
    pub fn pwidth(&mut self) -> PwidthW<'_, ShiftcfgSpec> {
        PwidthW::new(self, 16)
    }
}
#[doc = "Shifter Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`shiftcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`shiftcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct ShiftcfgSpec;
impl crate::RegisterSpec for ShiftcfgSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`shiftcfg::R`](R) reader structure"]
impl crate::Readable for ShiftcfgSpec {}
#[doc = "`write(|w| ..)` method takes [`shiftcfg::W`](W) writer structure"]
impl crate::Writable for ShiftcfgSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets SHIFTCFG[%s] to value 0"]
impl crate::Resettable for ShiftcfgSpec {}