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
#[doc = "Register `CTRL` reader"]
pub type R = crate::R<CtrlSpec>;
#[doc = "Register `CTRL` writer"]
pub type W = crate::W<CtrlSpec>;
#[doc = "TCRC\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tcrc {
    #[doc = "0: 16 bits"]
    B16 = 0,
    #[doc = "1: 32 bits"]
    B32 = 1,
}
impl From<Tcrc> for bool {
    #[inline(always)]
    fn from(variant: Tcrc) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `TCRC` reader - TCRC"]
pub type TcrcR = crate::BitReader<Tcrc>;
impl TcrcR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tcrc {
        match self.bits {
            false => Tcrc::B16,
            true => Tcrc::B32,
        }
    }
    #[doc = "16 bits"]
    #[inline(always)]
    pub fn is_b16(&self) -> bool {
        *self == Tcrc::B16
    }
    #[doc = "32 bits"]
    #[inline(always)]
    pub fn is_b32(&self) -> bool {
        *self == Tcrc::B32
    }
}
#[doc = "Field `TCRC` writer - TCRC"]
pub type TcrcW<'a, REG> = crate::BitWriter<'a, REG, Tcrc>;
impl<'a, REG> TcrcW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "16 bits"]
    #[inline(always)]
    pub fn b16(self) -> &'a mut crate::W<REG> {
        self.variant(Tcrc::B16)
    }
    #[doc = "32 bits"]
    #[inline(always)]
    pub fn b32(self) -> &'a mut crate::W<REG> {
        self.variant(Tcrc::B32)
    }
}
#[doc = "Write as Seed\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Was {
    #[doc = "0: Data values"]
    Data = 0,
    #[doc = "1: Seed values"]
    Seed = 1,
}
impl From<Was> for bool {
    #[inline(always)]
    fn from(variant: Was) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `WAS` reader - Write as Seed"]
pub type WasR = crate::BitReader<Was>;
impl WasR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Was {
        match self.bits {
            false => Was::Data,
            true => Was::Seed,
        }
    }
    #[doc = "Data values"]
    #[inline(always)]
    pub fn is_data(&self) -> bool {
        *self == Was::Data
    }
    #[doc = "Seed values"]
    #[inline(always)]
    pub fn is_seed(&self) -> bool {
        *self == Was::Seed
    }
}
#[doc = "Field `WAS` writer - Write as Seed"]
pub type WasW<'a, REG> = crate::BitWriter<'a, REG, Was>;
impl<'a, REG> WasW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Data values"]
    #[inline(always)]
    pub fn data(self) -> &'a mut crate::W<REG> {
        self.variant(Was::Data)
    }
    #[doc = "Seed values"]
    #[inline(always)]
    pub fn seed(self) -> &'a mut crate::W<REG> {
        self.variant(Was::Seed)
    }
}
#[doc = "Complement Read of CRC Data Register\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Fxor {
    #[doc = "0: Disables XOR on reading data."]
    Noxor = 0,
    #[doc = "1: Inverts or complements the read value of the CRC Data."]
    Invert = 1,
}
impl From<Fxor> for bool {
    #[inline(always)]
    fn from(variant: Fxor) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `FXOR` reader - Complement Read of CRC Data Register"]
pub type FxorR = crate::BitReader<Fxor>;
impl FxorR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Fxor {
        match self.bits {
            false => Fxor::Noxor,
            true => Fxor::Invert,
        }
    }
    #[doc = "Disables XOR on reading data."]
    #[inline(always)]
    pub fn is_noxor(&self) -> bool {
        *self == Fxor::Noxor
    }
    #[doc = "Inverts or complements the read value of the CRC Data."]
    #[inline(always)]
    pub fn is_invert(&self) -> bool {
        *self == Fxor::Invert
    }
}
#[doc = "Field `FXOR` writer - Complement Read of CRC Data Register"]
pub type FxorW<'a, REG> = crate::BitWriter<'a, REG, Fxor>;
impl<'a, REG> FxorW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disables XOR on reading data."]
    #[inline(always)]
    pub fn noxor(self) -> &'a mut crate::W<REG> {
        self.variant(Fxor::Noxor)
    }
    #[doc = "Inverts or complements the read value of the CRC Data."]
    #[inline(always)]
    pub fn invert(self) -> &'a mut crate::W<REG> {
        self.variant(Fxor::Invert)
    }
}
#[doc = "Transpose Type for Read\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Totr {
    #[doc = "0: No transposition"]
    Notrnps = 0,
    #[doc = "1: Bits in bytes are transposed, but bytes are not transposed."]
    BtsTrnps = 1,
    #[doc = "2: Both bits in bytes and bytes are transposed."]
    BytsBtsTrnps = 2,
    #[doc = "3: Only bytes are transposed, no bits in a byte are transposed."]
    BytsTrnps = 3,
}
impl From<Totr> for u8 {
    #[inline(always)]
    fn from(variant: Totr) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Totr {
    type Ux = u8;
}
impl crate::IsEnum for Totr {}
#[doc = "Field `TOTR` reader - Transpose Type for Read"]
pub type TotrR = crate::FieldReader<Totr>;
impl TotrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Totr {
        match self.bits {
            0 => Totr::Notrnps,
            1 => Totr::BtsTrnps,
            2 => Totr::BytsBtsTrnps,
            3 => Totr::BytsTrnps,
            _ => unreachable!(),
        }
    }
    #[doc = "No transposition"]
    #[inline(always)]
    pub fn is_notrnps(&self) -> bool {
        *self == Totr::Notrnps
    }
    #[doc = "Bits in bytes are transposed, but bytes are not transposed."]
    #[inline(always)]
    pub fn is_bts_trnps(&self) -> bool {
        *self == Totr::BtsTrnps
    }
    #[doc = "Both bits in bytes and bytes are transposed."]
    #[inline(always)]
    pub fn is_byts_bts_trnps(&self) -> bool {
        *self == Totr::BytsBtsTrnps
    }
    #[doc = "Only bytes are transposed, no bits in a byte are transposed."]
    #[inline(always)]
    pub fn is_byts_trnps(&self) -> bool {
        *self == Totr::BytsTrnps
    }
}
#[doc = "Field `TOTR` writer - Transpose Type for Read"]
pub type TotrW<'a, REG> = crate::FieldWriter<'a, REG, 2, Totr, crate::Safe>;
impl<'a, REG> TotrW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "No transposition"]
    #[inline(always)]
    pub fn notrnps(self) -> &'a mut crate::W<REG> {
        self.variant(Totr::Notrnps)
    }
    #[doc = "Bits in bytes are transposed, but bytes are not transposed."]
    #[inline(always)]
    pub fn bts_trnps(self) -> &'a mut crate::W<REG> {
        self.variant(Totr::BtsTrnps)
    }
    #[doc = "Both bits in bytes and bytes are transposed."]
    #[inline(always)]
    pub fn byts_bts_trnps(self) -> &'a mut crate::W<REG> {
        self.variant(Totr::BytsBtsTrnps)
    }
    #[doc = "Only bytes are transposed, no bits in a byte are transposed."]
    #[inline(always)]
    pub fn byts_trnps(self) -> &'a mut crate::W<REG> {
        self.variant(Totr::BytsTrnps)
    }
}
#[doc = "Transpose Type for Write\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Tot {
    #[doc = "0: No transposition"]
    Notrnps = 0,
    #[doc = "1: Bits in bytes are transposed, but bytes are not transposed."]
    BtsTrnps = 1,
    #[doc = "2: Both bits in bytes and bytes are transposed."]
    BytsBtsTrnps = 2,
    #[doc = "3: Only bytes are transposed, no bits in a byte are transposed."]
    BytsTrnps = 3,
}
impl From<Tot> for u8 {
    #[inline(always)]
    fn from(variant: Tot) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Tot {
    type Ux = u8;
}
impl crate::IsEnum for Tot {}
#[doc = "Field `TOT` reader - Transpose Type for Write"]
pub type TotR = crate::FieldReader<Tot>;
impl TotR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Tot {
        match self.bits {
            0 => Tot::Notrnps,
            1 => Tot::BtsTrnps,
            2 => Tot::BytsBtsTrnps,
            3 => Tot::BytsTrnps,
            _ => unreachable!(),
        }
    }
    #[doc = "No transposition"]
    #[inline(always)]
    pub fn is_notrnps(&self) -> bool {
        *self == Tot::Notrnps
    }
    #[doc = "Bits in bytes are transposed, but bytes are not transposed."]
    #[inline(always)]
    pub fn is_bts_trnps(&self) -> bool {
        *self == Tot::BtsTrnps
    }
    #[doc = "Both bits in bytes and bytes are transposed."]
    #[inline(always)]
    pub fn is_byts_bts_trnps(&self) -> bool {
        *self == Tot::BytsBtsTrnps
    }
    #[doc = "Only bytes are transposed, no bits in a byte are transposed."]
    #[inline(always)]
    pub fn is_byts_trnps(&self) -> bool {
        *self == Tot::BytsTrnps
    }
}
#[doc = "Field `TOT` writer - Transpose Type for Write"]
pub type TotW<'a, REG> = crate::FieldWriter<'a, REG, 2, Tot, crate::Safe>;
impl<'a, REG> TotW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "No transposition"]
    #[inline(always)]
    pub fn notrnps(self) -> &'a mut crate::W<REG> {
        self.variant(Tot::Notrnps)
    }
    #[doc = "Bits in bytes are transposed, but bytes are not transposed."]
    #[inline(always)]
    pub fn bts_trnps(self) -> &'a mut crate::W<REG> {
        self.variant(Tot::BtsTrnps)
    }
    #[doc = "Both bits in bytes and bytes are transposed."]
    #[inline(always)]
    pub fn byts_bts_trnps(self) -> &'a mut crate::W<REG> {
        self.variant(Tot::BytsBtsTrnps)
    }
    #[doc = "Only bytes are transposed, no bits in a byte are transposed."]
    #[inline(always)]
    pub fn byts_trnps(self) -> &'a mut crate::W<REG> {
        self.variant(Tot::BytsTrnps)
    }
}
impl R {
    #[doc = "Bit 24 - TCRC"]
    #[inline(always)]
    pub fn tcrc(&self) -> TcrcR {
        TcrcR::new(((self.bits >> 24) & 1) != 0)
    }
    #[doc = "Bit 25 - Write as Seed"]
    #[inline(always)]
    pub fn was(&self) -> WasR {
        WasR::new(((self.bits >> 25) & 1) != 0)
    }
    #[doc = "Bit 26 - Complement Read of CRC Data Register"]
    #[inline(always)]
    pub fn fxor(&self) -> FxorR {
        FxorR::new(((self.bits >> 26) & 1) != 0)
    }
    #[doc = "Bits 28:29 - Transpose Type for Read"]
    #[inline(always)]
    pub fn totr(&self) -> TotrR {
        TotrR::new(((self.bits >> 28) & 3) as u8)
    }
    #[doc = "Bits 30:31 - Transpose Type for Write"]
    #[inline(always)]
    pub fn tot(&self) -> TotR {
        TotR::new(((self.bits >> 30) & 3) 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("CTRL")
            .field("tcrc", &self.tcrc())
            .field("was", &self.was())
            .field("fxor", &self.fxor())
            .field("totr", &self.totr())
            .field("tot", &self.tot())
            .finish()
    }
}
impl W {
    #[doc = "Bit 24 - TCRC"]
    #[inline(always)]
    pub fn tcrc(&mut self) -> TcrcW<'_, CtrlSpec> {
        TcrcW::new(self, 24)
    }
    #[doc = "Bit 25 - Write as Seed"]
    #[inline(always)]
    pub fn was(&mut self) -> WasW<'_, CtrlSpec> {
        WasW::new(self, 25)
    }
    #[doc = "Bit 26 - Complement Read of CRC Data Register"]
    #[inline(always)]
    pub fn fxor(&mut self) -> FxorW<'_, CtrlSpec> {
        FxorW::new(self, 26)
    }
    #[doc = "Bits 28:29 - Transpose Type for Read"]
    #[inline(always)]
    pub fn totr(&mut self) -> TotrW<'_, CtrlSpec> {
        TotrW::new(self, 28)
    }
    #[doc = "Bits 30:31 - Transpose Type for Write"]
    #[inline(always)]
    pub fn tot(&mut self) -> TotW<'_, CtrlSpec> {
        TotW::new(self, 30)
    }
}
#[doc = "Control\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CtrlSpec;
impl crate::RegisterSpec for CtrlSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
impl crate::Readable for CtrlSpec {}
#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
impl crate::Writable for CtrlSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets CTRL to value 0"]
impl crate::Resettable for CtrlSpec {}