max32660 0.2.1

Register mappings for the Analog Devices MAX32660 Cortex-M4 microcontroller
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
#[doc = "Register `CTRL` reader"]
pub type R = crate::R<CTRL_SPEC>;
#[doc = "Register `CTRL` writer"]
pub type W = crate::W<CTRL_SPEC>;
#[doc = "Field `enabled` reader - SPI Enable."]
pub type ENABLED_R = crate::BitReader<ENABLED_A>;
#[doc = "SPI Enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENABLED_A {
    #[doc = "0: `0`"]
    DISABLED = 0,
    #[doc = "1: `1`"]
    ENABLED = 1,
}
impl From<ENABLED_A> for bool {
    #[inline(always)]
    fn from(variant: ENABLED_A) -> Self {
        variant as u8 != 0
    }
}
impl ENABLED_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ENABLED_A {
        match self.bits {
            false => ENABLED_A::DISABLED,
            true => ENABLED_A::ENABLED,
        }
    }
    #[doc = "`0`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == ENABLED_A::DISABLED
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == ENABLED_A::ENABLED
    }
}
#[doc = "Field `enabled` writer - SPI Enable."]
pub type ENABLED_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, ENABLED_A>;
impl<'a, REG, const O: u8> ENABLED_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "`0`"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(ENABLED_A::DISABLED)
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(ENABLED_A::ENABLED)
    }
}
#[doc = "Field `MMEN` reader - SPI Master Mode Enable."]
pub type MMEN_R = crate::BitReader<MMEN_A>;
#[doc = "SPI Master Mode Enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MMEN_A {
    #[doc = "0: `0`"]
    SLAVE = 0,
    #[doc = "1: `1`"]
    MASTER = 1,
}
impl From<MMEN_A> for bool {
    #[inline(always)]
    fn from(variant: MMEN_A) -> Self {
        variant as u8 != 0
    }
}
impl MMEN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> MMEN_A {
        match self.bits {
            false => MMEN_A::SLAVE,
            true => MMEN_A::MASTER,
        }
    }
    #[doc = "`0`"]
    #[inline(always)]
    pub fn is_slave(&self) -> bool {
        *self == MMEN_A::SLAVE
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn is_master(&self) -> bool {
        *self == MMEN_A::MASTER
    }
}
#[doc = "Field `MMEN` writer - SPI Master Mode Enable."]
pub type MMEN_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, MMEN_A>;
impl<'a, REG, const O: u8> MMEN_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "`0`"]
    #[inline(always)]
    pub fn slave(self) -> &'a mut crate::W<REG> {
        self.variant(MMEN_A::SLAVE)
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn master(self) -> &'a mut crate::W<REG> {
        self.variant(MMEN_A::MASTER)
    }
}
#[doc = "Field `WOR` reader - Wired OR (open drain) Enable."]
pub type WOR_R = crate::BitReader<WOR_A>;
#[doc = "Wired OR (open drain) Enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum WOR_A {
    #[doc = "0: `0`"]
    DISABLED = 0,
    #[doc = "1: `1`"]
    ENABLED = 1,
}
impl From<WOR_A> for bool {
    #[inline(always)]
    fn from(variant: WOR_A) -> Self {
        variant as u8 != 0
    }
}
impl WOR_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> WOR_A {
        match self.bits {
            false => WOR_A::DISABLED,
            true => WOR_A::ENABLED,
        }
    }
    #[doc = "`0`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == WOR_A::DISABLED
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == WOR_A::ENABLED
    }
}
#[doc = "Field `WOR` writer - Wired OR (open drain) Enable."]
pub type WOR_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, WOR_A>;
impl<'a, REG, const O: u8> WOR_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "`0`"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(WOR_A::DISABLED)
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(WOR_A::ENABLED)
    }
}
#[doc = "Field `CLKPOL` reader - Clock Polarity."]
pub type CLKPOL_R = crate::BitReader<CLKPOL_A>;
#[doc = "Clock Polarity.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CLKPOL_A {
    #[doc = "0: SCLK idles Low (0) after character transmission/reception."]
    IDLE_LOW = 0,
    #[doc = "1: SCLK idles High (1) after character transmission/reception."]
    IDLE_HIGH = 1,
}
impl From<CLKPOL_A> for bool {
    #[inline(always)]
    fn from(variant: CLKPOL_A) -> Self {
        variant as u8 != 0
    }
}
impl CLKPOL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CLKPOL_A {
        match self.bits {
            false => CLKPOL_A::IDLE_LOW,
            true => CLKPOL_A::IDLE_HIGH,
        }
    }
    #[doc = "SCLK idles Low (0) after character transmission/reception."]
    #[inline(always)]
    pub fn is_idle_low(&self) -> bool {
        *self == CLKPOL_A::IDLE_LOW
    }
    #[doc = "SCLK idles High (1) after character transmission/reception."]
    #[inline(always)]
    pub fn is_idle_high(&self) -> bool {
        *self == CLKPOL_A::IDLE_HIGH
    }
}
#[doc = "Field `CLKPOL` writer - Clock Polarity."]
pub type CLKPOL_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, CLKPOL_A>;
impl<'a, REG, const O: u8> CLKPOL_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "SCLK idles Low (0) after character transmission/reception."]
    #[inline(always)]
    pub fn idle_low(self) -> &'a mut crate::W<REG> {
        self.variant(CLKPOL_A::IDLE_LOW)
    }
    #[doc = "SCLK idles High (1) after character transmission/reception."]
    #[inline(always)]
    pub fn idle_high(self) -> &'a mut crate::W<REG> {
        self.variant(CLKPOL_A::IDLE_HIGH)
    }
}
#[doc = "Field `PHASE` reader - Phase Select."]
pub type PHASE_R = crate::BitReader<PHASE_A>;
#[doc = "Phase Select.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PHASE_A {
    #[doc = "0: Transmit on active edge of SCLK."]
    ACTIVE_EDGE = 0,
    #[doc = "1: Transmit on inactive edge of SCLK."]
    INACTIVE_EDGE = 1,
}
impl From<PHASE_A> for bool {
    #[inline(always)]
    fn from(variant: PHASE_A) -> Self {
        variant as u8 != 0
    }
}
impl PHASE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PHASE_A {
        match self.bits {
            false => PHASE_A::ACTIVE_EDGE,
            true => PHASE_A::INACTIVE_EDGE,
        }
    }
    #[doc = "Transmit on active edge of SCLK."]
    #[inline(always)]
    pub fn is_active_edge(&self) -> bool {
        *self == PHASE_A::ACTIVE_EDGE
    }
    #[doc = "Transmit on inactive edge of SCLK."]
    #[inline(always)]
    pub fn is_inactive_edge(&self) -> bool {
        *self == PHASE_A::INACTIVE_EDGE
    }
}
#[doc = "Field `PHASE` writer - Phase Select."]
pub type PHASE_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, PHASE_A>;
impl<'a, REG, const O: u8> PHASE_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Transmit on active edge of SCLK."]
    #[inline(always)]
    pub fn active_edge(self) -> &'a mut crate::W<REG> {
        self.variant(PHASE_A::ACTIVE_EDGE)
    }
    #[doc = "Transmit on inactive edge of SCLK."]
    #[inline(always)]
    pub fn inactive_edge(self) -> &'a mut crate::W<REG> {
        self.variant(PHASE_A::INACTIVE_EDGE)
    }
}
#[doc = "Field `BIRQ` reader - Baud Rate Generator Timer Interrupt Request."]
pub type BIRQ_R = crate::BitReader<BIRQ_A>;
#[doc = "Baud Rate Generator Timer Interrupt Request.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BIRQ_A {
    #[doc = "0: `0`"]
    DISABLED = 0,
    #[doc = "1: `1`"]
    ENABLED = 1,
}
impl From<BIRQ_A> for bool {
    #[inline(always)]
    fn from(variant: BIRQ_A) -> Self {
        variant as u8 != 0
    }
}
impl BIRQ_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BIRQ_A {
        match self.bits {
            false => BIRQ_A::DISABLED,
            true => BIRQ_A::ENABLED,
        }
    }
    #[doc = "`0`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == BIRQ_A::DISABLED
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == BIRQ_A::ENABLED
    }
}
#[doc = "Field `BIRQ` writer - Baud Rate Generator Timer Interrupt Request."]
pub type BIRQ_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, BIRQ_A>;
impl<'a, REG, const O: u8> BIRQ_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "`0`"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(BIRQ_A::DISABLED)
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(BIRQ_A::ENABLED)
    }
}
#[doc = "Field `STR` reader - Start SPI Interrupt."]
pub type STR_R = crate::BitReader<STR_A>;
#[doc = "Start SPI Interrupt.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum STR_A {
    #[doc = "0: No operation/complete."]
    COMPLETE = 0,
    #[doc = "1: Start operation."]
    START = 1,
}
impl From<STR_A> for bool {
    #[inline(always)]
    fn from(variant: STR_A) -> Self {
        variant as u8 != 0
    }
}
impl STR_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> STR_A {
        match self.bits {
            false => STR_A::COMPLETE,
            true => STR_A::START,
        }
    }
    #[doc = "No operation/complete."]
    #[inline(always)]
    pub fn is_complete(&self) -> bool {
        *self == STR_A::COMPLETE
    }
    #[doc = "Start operation."]
    #[inline(always)]
    pub fn is_start(&self) -> bool {
        *self == STR_A::START
    }
}
#[doc = "Field `STR` writer - Start SPI Interrupt."]
pub type STR_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, STR_A>;
impl<'a, REG, const O: u8> STR_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "No operation/complete."]
    #[inline(always)]
    pub fn complete(self) -> &'a mut crate::W<REG> {
        self.variant(STR_A::COMPLETE)
    }
    #[doc = "Start operation."]
    #[inline(always)]
    pub fn start(self) -> &'a mut crate::W<REG> {
        self.variant(STR_A::START)
    }
}
#[doc = "Field `IRQE` reader - Interrupt Request Enable."]
pub type IRQE_R = crate::BitReader<IRQE_A>;
#[doc = "Interrupt Request Enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IRQE_A {
    #[doc = "0: `0`"]
    DISABLED = 0,
    #[doc = "1: `1`"]
    ENABLED = 1,
}
impl From<IRQE_A> for bool {
    #[inline(always)]
    fn from(variant: IRQE_A) -> Self {
        variant as u8 != 0
    }
}
impl IRQE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> IRQE_A {
        match self.bits {
            false => IRQE_A::DISABLED,
            true => IRQE_A::ENABLED,
        }
    }
    #[doc = "`0`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == IRQE_A::DISABLED
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == IRQE_A::ENABLED
    }
}
#[doc = "Field `IRQE` writer - Interrupt Request Enable."]
pub type IRQE_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, IRQE_A>;
impl<'a, REG, const O: u8> IRQE_W<'a, REG, O>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "`0`"]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(IRQE_A::DISABLED)
    }
    #[doc = "`1`"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(IRQE_A::ENABLED)
    }
}
impl R {
    #[doc = "Bit 0 - SPI Enable."]
    #[inline(always)]
    pub fn enabled(&self) -> ENABLED_R {
        ENABLED_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - SPI Master Mode Enable."]
    #[inline(always)]
    pub fn mmen(&self) -> MMEN_R {
        MMEN_R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Wired OR (open drain) Enable."]
    #[inline(always)]
    pub fn wor(&self) -> WOR_R {
        WOR_R::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Clock Polarity."]
    #[inline(always)]
    pub fn clkpol(&self) -> CLKPOL_R {
        CLKPOL_R::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Phase Select."]
    #[inline(always)]
    pub fn phase(&self) -> PHASE_R {
        PHASE_R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - Baud Rate Generator Timer Interrupt Request."]
    #[inline(always)]
    pub fn birq(&self) -> BIRQ_R {
        BIRQ_R::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Start SPI Interrupt."]
    #[inline(always)]
    pub fn str(&self) -> STR_R {
        STR_R::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Interrupt Request Enable."]
    #[inline(always)]
    pub fn irqe(&self) -> IRQE_R {
        IRQE_R::new(((self.bits >> 7) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - SPI Enable."]
    #[inline(always)]
    #[must_use]
    pub fn enabled(&mut self) -> ENABLED_W<CTRL_SPEC, 0> {
        ENABLED_W::new(self)
    }
    #[doc = "Bit 1 - SPI Master Mode Enable."]
    #[inline(always)]
    #[must_use]
    pub fn mmen(&mut self) -> MMEN_W<CTRL_SPEC, 1> {
        MMEN_W::new(self)
    }
    #[doc = "Bit 2 - Wired OR (open drain) Enable."]
    #[inline(always)]
    #[must_use]
    pub fn wor(&mut self) -> WOR_W<CTRL_SPEC, 2> {
        WOR_W::new(self)
    }
    #[doc = "Bit 3 - Clock Polarity."]
    #[inline(always)]
    #[must_use]
    pub fn clkpol(&mut self) -> CLKPOL_W<CTRL_SPEC, 3> {
        CLKPOL_W::new(self)
    }
    #[doc = "Bit 4 - Phase Select."]
    #[inline(always)]
    #[must_use]
    pub fn phase(&mut self) -> PHASE_W<CTRL_SPEC, 4> {
        PHASE_W::new(self)
    }
    #[doc = "Bit 5 - Baud Rate Generator Timer Interrupt Request."]
    #[inline(always)]
    #[must_use]
    pub fn birq(&mut self) -> BIRQ_W<CTRL_SPEC, 5> {
        BIRQ_W::new(self)
    }
    #[doc = "Bit 6 - Start SPI Interrupt."]
    #[inline(always)]
    #[must_use]
    pub fn str(&mut self) -> STR_W<CTRL_SPEC, 6> {
        STR_W::new(self)
    }
    #[doc = "Bit 7 - Interrupt Request Enable."]
    #[inline(always)]
    #[must_use]
    pub fn irqe(&mut self) -> IRQE_W<CTRL_SPEC, 7> {
        IRQE_W::new(self)
    }
    #[doc = r" Writes raw bits to the register."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.bits = bits;
        self
    }
}
#[doc = "SPI Control.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ctrl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CTRL_SPEC;
impl crate::RegisterSpec for CTRL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
impl crate::Readable for CTRL_SPEC {}
#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
impl crate::Writable for CTRL_SPEC {
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets CTRL to value 0"]
impl crate::Resettable for CTRL_SPEC {
    const RESET_VALUE: Self::Ux = 0;
}