mcxa-pac 0.2.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
#[doc = "Register `SCONFIG` reader"]
pub type R = crate::R<SconfigSpec>;
#[doc = "Register `SCONFIG` writer"]
pub type W = crate::W<SconfigSpec>;
#[doc = "Target Enable\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Slvena {
    #[doc = "0: Disable"]
    Disable = 0,
    #[doc = "1: Enable"]
    Enable = 1,
}
impl From<Slvena> for bool {
    #[inline(always)]
    fn from(variant: Slvena) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SLVENA` reader - Target Enable"]
pub type SlvenaR = crate::BitReader<Slvena>;
impl SlvenaR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Slvena {
        match self.bits {
            false => Slvena::Disable,
            true => Slvena::Enable,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == Slvena::Disable
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Slvena::Enable
    }
}
#[doc = "Field `SLVENA` writer - Target Enable"]
pub type SlvenaW<'a, REG> = crate::BitWriter<'a, REG, Slvena>;
impl<'a, REG> SlvenaW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(Slvena::Disable)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Slvena::Enable)
    }
}
#[doc = "Not Acknowledge\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Nack {
    #[doc = "0: Always disable NACK mode"]
    Disable = 0,
    #[doc = "1: Always enable NACK mode (works normally)"]
    Enable = 1,
}
impl From<Nack> for bool {
    #[inline(always)]
    fn from(variant: Nack) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `NACK` reader - Not Acknowledge"]
pub type NackR = crate::BitReader<Nack>;
impl NackR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Nack {
        match self.bits {
            false => Nack::Disable,
            true => Nack::Enable,
        }
    }
    #[doc = "Always disable NACK mode"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == Nack::Disable
    }
    #[doc = "Always enable NACK mode (works normally)"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Nack::Enable
    }
}
#[doc = "Field `NACK` writer - Not Acknowledge"]
pub type NackW<'a, REG> = crate::BitWriter<'a, REG, Nack>;
impl<'a, REG> NackW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Always disable NACK mode"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(Nack::Disable)
    }
    #[doc = "Always enable NACK mode (works normally)"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Nack::Enable)
    }
}
#[doc = "Match Start or Stop\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Matchss {
    #[doc = "0: Disable"]
    Disable = 0,
    #[doc = "1: Enable"]
    Enable = 1,
}
impl From<Matchss> for bool {
    #[inline(always)]
    fn from(variant: Matchss) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `MATCHSS` reader - Match Start or Stop"]
pub type MatchssR = crate::BitReader<Matchss>;
impl MatchssR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Matchss {
        match self.bits {
            false => Matchss::Disable,
            true => Matchss::Enable,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == Matchss::Disable
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Matchss::Enable
    }
}
#[doc = "Field `MATCHSS` writer - Match Start or Stop"]
pub type MatchssW<'a, REG> = crate::BitWriter<'a, REG, Matchss>;
impl<'a, REG> MatchssW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(Matchss::Disable)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Matchss::Enable)
    }
}
#[doc = "Ignore TE0 or TE1 Errors\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum S0ignore {
    #[doc = "0: Do not ignore TE0 or TE1 errors"]
    Disable = 0,
    #[doc = "1: Ignore TE0 or TE1 errors"]
    Enable = 1,
}
impl From<S0ignore> for bool {
    #[inline(always)]
    fn from(variant: S0ignore) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `S0IGNORE` reader - Ignore TE0 or TE1 Errors"]
pub type S0ignoreR = crate::BitReader<S0ignore>;
impl S0ignoreR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> S0ignore {
        match self.bits {
            false => S0ignore::Disable,
            true => S0ignore::Enable,
        }
    }
    #[doc = "Do not ignore TE0 or TE1 errors"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == S0ignore::Disable
    }
    #[doc = "Ignore TE0 or TE1 errors"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == S0ignore::Enable
    }
}
#[doc = "Field `S0IGNORE` writer - Ignore TE0 or TE1 Errors"]
pub type S0ignoreW<'a, REG> = crate::BitWriter<'a, REG, S0ignore>;
impl<'a, REG> S0ignoreW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Do not ignore TE0 or TE1 errors"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(S0ignore::Disable)
    }
    #[doc = "Ignore TE0 or TE1 errors"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(S0ignore::Enable)
    }
}
#[doc = "HDR OK\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Hdrok {
    #[doc = "0: Disable HDR OK"]
    Disable = 0,
    #[doc = "1: Enable HDR OK"]
    Enable = 1,
}
impl From<Hdrok> for bool {
    #[inline(always)]
    fn from(variant: Hdrok) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HDROK` reader - HDR OK"]
pub type HdrokR = crate::BitReader<Hdrok>;
impl HdrokR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Hdrok {
        match self.bits {
            false => Hdrok::Disable,
            true => Hdrok::Enable,
        }
    }
    #[doc = "Disable HDR OK"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == Hdrok::Disable
    }
    #[doc = "Enable HDR OK"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Hdrok::Enable
    }
}
#[doc = "Field `HDROK` writer - HDR OK"]
pub type HdrokW<'a, REG> = crate::BitWriter<'a, REG, Hdrok>;
impl<'a, REG> HdrokW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable HDR OK"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(Hdrok::Disable)
    }
    #[doc = "Enable HDR OK"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Hdrok::Enable)
    }
}
#[doc = "Offline\n\nValue on reset: 0"]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Offline {
    #[doc = "0: Disable"]
    Disable = 0,
    #[doc = "1: Enable"]
    Enable = 1,
}
impl From<Offline> for bool {
    #[inline(always)]
    fn from(variant: Offline) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `OFFLINE` reader - Offline"]
pub type OfflineR = crate::BitReader<Offline>;
impl OfflineR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Offline {
        match self.bits {
            false => Offline::Disable,
            true => Offline::Enable,
        }
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == Offline::Disable
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == Offline::Enable
    }
}
#[doc = "Field `OFFLINE` writer - Offline"]
pub type OfflineW<'a, REG> = crate::BitWriter<'a, REG, Offline>;
impl<'a, REG> OfflineW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Disable"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut crate::W<REG> {
        self.variant(Offline::Disable)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut crate::W<REG> {
        self.variant(Offline::Enable)
    }
}
#[doc = "Field `BAMATCH` reader - Bus Available Match"]
pub type BamatchR = crate::FieldReader;
#[doc = "Field `BAMATCH` writer - Bus Available Match"]
pub type BamatchW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
#[doc = "Field `SADDR` reader - Static Address"]
pub type SaddrR = crate::FieldReader;
#[doc = "Field `SADDR` writer - Static Address"]
pub type SaddrW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
impl R {
    #[doc = "Bit 0 - Target Enable"]
    #[inline(always)]
    pub fn slvena(&self) -> SlvenaR {
        SlvenaR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Not Acknowledge"]
    #[inline(always)]
    pub fn nack(&self) -> NackR {
        NackR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Match Start or Stop"]
    #[inline(always)]
    pub fn matchss(&self) -> MatchssR {
        MatchssR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Ignore TE0 or TE1 Errors"]
    #[inline(always)]
    pub fn s0ignore(&self) -> S0ignoreR {
        S0ignoreR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - HDR OK"]
    #[inline(always)]
    pub fn hdrok(&self) -> HdrokR {
        HdrokR::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 9 - Offline"]
    #[inline(always)]
    pub fn offline(&self) -> OfflineR {
        OfflineR::new(((self.bits >> 9) & 1) != 0)
    }
    #[doc = "Bits 16:21 - Bus Available Match"]
    #[inline(always)]
    pub fn bamatch(&self) -> BamatchR {
        BamatchR::new(((self.bits >> 16) & 0x3f) as u8)
    }
    #[doc = "Bits 25:31 - Static Address"]
    #[inline(always)]
    pub fn saddr(&self) -> SaddrR {
        SaddrR::new(((self.bits >> 25) & 0x7f) 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("SCONFIG")
            .field("slvena", &self.slvena())
            .field("nack", &self.nack())
            .field("matchss", &self.matchss())
            .field("s0ignore", &self.s0ignore())
            .field("hdrok", &self.hdrok())
            .field("offline", &self.offline())
            .field("bamatch", &self.bamatch())
            .field("saddr", &self.saddr())
            .finish()
    }
}
impl W {
    #[doc = "Bit 0 - Target Enable"]
    #[inline(always)]
    pub fn slvena(&mut self) -> SlvenaW<'_, SconfigSpec> {
        SlvenaW::new(self, 0)
    }
    #[doc = "Bit 1 - Not Acknowledge"]
    #[inline(always)]
    pub fn nack(&mut self) -> NackW<'_, SconfigSpec> {
        NackW::new(self, 1)
    }
    #[doc = "Bit 2 - Match Start or Stop"]
    #[inline(always)]
    pub fn matchss(&mut self) -> MatchssW<'_, SconfigSpec> {
        MatchssW::new(self, 2)
    }
    #[doc = "Bit 3 - Ignore TE0 or TE1 Errors"]
    #[inline(always)]
    pub fn s0ignore(&mut self) -> S0ignoreW<'_, SconfigSpec> {
        S0ignoreW::new(self, 3)
    }
    #[doc = "Bit 4 - HDR OK"]
    #[inline(always)]
    pub fn hdrok(&mut self) -> HdrokW<'_, SconfigSpec> {
        HdrokW::new(self, 4)
    }
    #[doc = "Bit 9 - Offline"]
    #[inline(always)]
    pub fn offline(&mut self) -> OfflineW<'_, SconfigSpec> {
        OfflineW::new(self, 9)
    }
    #[doc = "Bits 16:21 - Bus Available Match"]
    #[inline(always)]
    pub fn bamatch(&mut self) -> BamatchW<'_, SconfigSpec> {
        BamatchW::new(self, 16)
    }
    #[doc = "Bits 25:31 - Static Address"]
    #[inline(always)]
    pub fn saddr(&mut self) -> SaddrW<'_, SconfigSpec> {
        SaddrW::new(self, 25)
    }
}
#[doc = "Target Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`sconfig::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sconfig::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct SconfigSpec;
impl crate::RegisterSpec for SconfigSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`sconfig::R`](R) reader structure"]
impl crate::Readable for SconfigSpec {}
#[doc = "`write(|w| ..)` method takes [`sconfig::W`](W) writer structure"]
impl crate::Writable for SconfigSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets SCONFIG to value 0x0017_0000"]
impl crate::Resettable for SconfigSpec {
    const RESET_VALUE: u32 = 0x0017_0000;
}