sam3x8e-pac 0.1.6-dev

Peripheral Access Crate (PAC) for the Atmel SAM3X8E.
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
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RcmrCkg {
    #[doc = "None"]
    CONTINUOUS = 0x0,
    #[doc = "Receive Clock enabled only if RF Low"]
    EN_RF_LOW = 0x01,
    #[doc = "Receive Clock enabled only if RF High"]
    EN_RF_HIGH = 0x02,
    _RESERVED_3 = 0x03,
}
impl RcmrCkg {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> RcmrCkg {
        unsafe { core::mem::transmute(val & 0x03) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for RcmrCkg {
    #[inline(always)]
    fn from(val: u8) -> RcmrCkg {
        RcmrCkg::from_bits(val)
    }
}
impl From<RcmrCkg> for u8 {
    #[inline(always)]
    fn from(val: RcmrCkg) -> u8 {
        RcmrCkg::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RcmrCko {
    #[doc = "None, RK pin is an input"]
    NONE = 0x0,
    #[doc = "Continuous Receive Clock, RK pin is an output"]
    CONTINUOUS = 0x01,
    #[doc = "Receive Clock only during data transfers, RK pin is an output"]
    TRANSFER = 0x02,
    _RESERVED_3 = 0x03,
    _RESERVED_4 = 0x04,
    _RESERVED_5 = 0x05,
    _RESERVED_6 = 0x06,
    _RESERVED_7 = 0x07,
}
impl RcmrCko {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> RcmrCko {
        unsafe { core::mem::transmute(val & 0x07) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for RcmrCko {
    #[inline(always)]
    fn from(val: u8) -> RcmrCko {
        RcmrCko::from_bits(val)
    }
}
impl From<RcmrCko> for u8 {
    #[inline(always)]
    fn from(val: RcmrCko) -> u8 {
        RcmrCko::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RcmrCks {
    #[doc = "Divided Clock"]
    MCK = 0x0,
    #[doc = "TK Clock signal"]
    TK = 0x01,
    #[doc = "RK pin"]
    RK = 0x02,
    _RESERVED_3 = 0x03,
}
impl RcmrCks {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> RcmrCks {
        unsafe { core::mem::transmute(val & 0x03) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for RcmrCks {
    #[inline(always)]
    fn from(val: u8) -> RcmrCks {
        RcmrCks::from_bits(val)
    }
}
impl From<RcmrCks> for u8 {
    #[inline(always)]
    fn from(val: RcmrCks) -> u8 {
        RcmrCks::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RcmrStart {
    #[doc = "Continuous, as soon as the receiver is enabled, and immediately after the end of transfer of the previous data."]
    CONTINUOUS = 0x0,
    #[doc = "Transmit start"]
    TRANSMIT = 0x01,
    #[doc = "Detection of a low level on RF signal"]
    RF_LOW = 0x02,
    #[doc = "Detection of a high level on RF signal"]
    RF_HIGH = 0x03,
    #[doc = "Detection of a falling edge on RF signal"]
    RF_FALLING = 0x04,
    #[doc = "Detection of a rising edge on RF signal"]
    RF_RISING = 0x05,
    #[doc = "Detection of any level change on RF signal"]
    RF_LEVEL = 0x06,
    #[doc = "Detection of any edge on RF signal"]
    RF_EDGE = 0x07,
    #[doc = "Compare 0"]
    CMP_0 = 0x08,
    _RESERVED_9 = 0x09,
    _RESERVED_a = 0x0a,
    _RESERVED_b = 0x0b,
    _RESERVED_c = 0x0c,
    _RESERVED_d = 0x0d,
    _RESERVED_e = 0x0e,
    _RESERVED_f = 0x0f,
}
impl RcmrStart {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> RcmrStart {
        unsafe { core::mem::transmute(val & 0x0f) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for RcmrStart {
    #[inline(always)]
    fn from(val: u8) -> RcmrStart {
        RcmrStart::from_bits(val)
    }
}
impl From<RcmrStart> for u8 {
    #[inline(always)]
    fn from(val: RcmrStart) -> u8 {
        RcmrStart::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RfmrFsedge {
    #[doc = "Positive Edge Detection"]
    POSITIVE = 0x0,
    #[doc = "Negative Edge Detection"]
    NEGATIVE = 0x01,
}
impl RfmrFsedge {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> RfmrFsedge {
        unsafe { core::mem::transmute(val & 0x01) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for RfmrFsedge {
    #[inline(always)]
    fn from(val: u8) -> RfmrFsedge {
        RfmrFsedge::from_bits(val)
    }
}
impl From<RfmrFsedge> for u8 {
    #[inline(always)]
    fn from(val: RfmrFsedge) -> u8 {
        RfmrFsedge::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RfmrFsos {
    #[doc = "None, RF pin is an input"]
    NONE = 0x0,
    #[doc = "Negative Pulse, RF pin is an output"]
    NEGATIVE = 0x01,
    #[doc = "Positive Pulse, RF pin is an output"]
    POSITIVE = 0x02,
    #[doc = "Driven Low during data transfer, RF pin is an output"]
    LOW = 0x03,
    #[doc = "Driven High during data transfer, RF pin is an output"]
    HIGH = 0x04,
    #[doc = "Toggling at each start of data transfer, RF pin is an output"]
    TOGGLING = 0x05,
    _RESERVED_6 = 0x06,
    _RESERVED_7 = 0x07,
}
impl RfmrFsos {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> RfmrFsos {
        unsafe { core::mem::transmute(val & 0x07) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for RfmrFsos {
    #[inline(always)]
    fn from(val: u8) -> RfmrFsos {
        RfmrFsos::from_bits(val)
    }
}
impl From<RfmrFsos> for u8 {
    #[inline(always)]
    fn from(val: RfmrFsos) -> u8 {
        RfmrFsos::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TcmrCkg {
    #[doc = "None"]
    CONTINUOUS = 0x0,
    #[doc = "Transmit Clock enabled only if TF Low"]
    EN_TF_LOW = 0x01,
    #[doc = "Transmit Clock enabled only if TF High"]
    EN_TF_HIGH = 0x02,
    _RESERVED_3 = 0x03,
}
impl TcmrCkg {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> TcmrCkg {
        unsafe { core::mem::transmute(val & 0x03) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for TcmrCkg {
    #[inline(always)]
    fn from(val: u8) -> TcmrCkg {
        TcmrCkg::from_bits(val)
    }
}
impl From<TcmrCkg> for u8 {
    #[inline(always)]
    fn from(val: TcmrCkg) -> u8 {
        TcmrCkg::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TcmrCko {
    #[doc = "None, TK pin is an input"]
    NONE = 0x0,
    #[doc = "Continuous Transmit Clock, TK pin is an output"]
    CONTINUOUS = 0x01,
    #[doc = "Transmit Clock only during data transfers, TK pin is an output"]
    TRANSFER = 0x02,
    _RESERVED_3 = 0x03,
    _RESERVED_4 = 0x04,
    _RESERVED_5 = 0x05,
    _RESERVED_6 = 0x06,
    _RESERVED_7 = 0x07,
}
impl TcmrCko {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> TcmrCko {
        unsafe { core::mem::transmute(val & 0x07) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for TcmrCko {
    #[inline(always)]
    fn from(val: u8) -> TcmrCko {
        TcmrCko::from_bits(val)
    }
}
impl From<TcmrCko> for u8 {
    #[inline(always)]
    fn from(val: TcmrCko) -> u8 {
        TcmrCko::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TcmrCks {
    #[doc = "Divided Clock"]
    MCK = 0x0,
    #[doc = "RK Clock signal"]
    RK = 0x01,
    #[doc = "TK pin"]
    TK = 0x02,
    _RESERVED_3 = 0x03,
}
impl TcmrCks {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> TcmrCks {
        unsafe { core::mem::transmute(val & 0x03) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for TcmrCks {
    #[inline(always)]
    fn from(val: u8) -> TcmrCks {
        TcmrCks::from_bits(val)
    }
}
impl From<TcmrCks> for u8 {
    #[inline(always)]
    fn from(val: TcmrCks) -> u8 {
        TcmrCks::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TcmrStart {
    #[doc = "Continuous, as soon as a word is written in the SSC_THR Register (if Transmit is enabled), and immediately after the end of transfer of the previous data"]
    CONTINUOUS = 0x0,
    #[doc = "Receive start"]
    RECEIVE = 0x01,
    #[doc = "Detection of a low level on TF signal"]
    TF_LOW = 0x02,
    #[doc = "Detection of a high level on TF signal"]
    TF_HIGH = 0x03,
    #[doc = "Detection of a falling edge on TF signal"]
    TF_FALLING = 0x04,
    #[doc = "Detection of a rising edge on TF signal"]
    TF_RISING = 0x05,
    #[doc = "Detection of any level change on TF signal"]
    TF_LEVEL = 0x06,
    #[doc = "Detection of any edge on TF signal"]
    TF_EDGE = 0x07,
    _RESERVED_8 = 0x08,
    _RESERVED_9 = 0x09,
    _RESERVED_a = 0x0a,
    _RESERVED_b = 0x0b,
    _RESERVED_c = 0x0c,
    _RESERVED_d = 0x0d,
    _RESERVED_e = 0x0e,
    _RESERVED_f = 0x0f,
}
impl TcmrStart {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> TcmrStart {
        unsafe { core::mem::transmute(val & 0x0f) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for TcmrStart {
    #[inline(always)]
    fn from(val: u8) -> TcmrStart {
        TcmrStart::from_bits(val)
    }
}
impl From<TcmrStart> for u8 {
    #[inline(always)]
    fn from(val: TcmrStart) -> u8 {
        TcmrStart::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TfmrFsedge {
    #[doc = "Positive Edge Detection"]
    POSITIVE = 0x0,
    #[doc = "Negative Edge Detection"]
    NEGATIVE = 0x01,
}
impl TfmrFsedge {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> TfmrFsedge {
        unsafe { core::mem::transmute(val & 0x01) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for TfmrFsedge {
    #[inline(always)]
    fn from(val: u8) -> TfmrFsedge {
        TfmrFsedge::from_bits(val)
    }
}
impl From<TfmrFsedge> for u8 {
    #[inline(always)]
    fn from(val: TfmrFsedge) -> u8 {
        TfmrFsedge::to_bits(val)
    }
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TfmrFsos {
    #[doc = "None, RF pin is an input"]
    NONE = 0x0,
    #[doc = "Negative Pulse, RF pin is an output"]
    NEGATIVE = 0x01,
    #[doc = "Positive Pulse, RF pin is an output"]
    POSITIVE = 0x02,
    #[doc = "Driven Low during data transfer"]
    LOW = 0x03,
    #[doc = "Driven High during data transfer"]
    HIGH = 0x04,
    #[doc = "Toggling at each start of data transfer"]
    TOGGLING = 0x05,
    _RESERVED_6 = 0x06,
    _RESERVED_7 = 0x07,
}
impl TfmrFsos {
    #[inline(always)]
    pub const fn from_bits(val: u8) -> TfmrFsos {
        unsafe { core::mem::transmute(val & 0x07) }
    }
    #[inline(always)]
    pub const fn to_bits(self) -> u8 {
        unsafe { core::mem::transmute(self) }
    }
}
impl From<u8> for TfmrFsos {
    #[inline(always)]
    fn from(val: u8) -> TfmrFsos {
        TfmrFsos::from_bits(val)
    }
}
impl From<TfmrFsos> for u8 {
    #[inline(always)]
    fn from(val: TfmrFsos) -> u8 {
        TfmrFsos::to_bits(val)
    }
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Wpkey(u32);
impl Wpkey {
    #[doc = "Writing any other value in this field aborts the write operation of the WPEN bit.Always reads as 0."]
    pub const PASSWD: Self = Self(0x0053_5343);
}
impl Wpkey {
    pub const fn from_bits(val: u32) -> Wpkey {
        Self(val & 0x00ff_ffff)
    }
    pub const fn to_bits(self) -> u32 {
        self.0
    }
}
impl core::fmt::Debug for Wpkey {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        match self.0 {
            0x0053_5343 => f.write_str("PASSWD"),
            other => core::write!(f, "0x{:02X}", other),
        }
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wpkey {
    fn format(&self, f: defmt::Formatter) {
        match self.0 {
            0x0053_5343 => defmt::write!(f, "PASSWD"),
            other => defmt::write!(f, "0x{:02X}", other),
        }
    }
}
impl From<u32> for Wpkey {
    #[inline(always)]
    fn from(val: u32) -> Wpkey {
        Wpkey::from_bits(val)
    }
}
impl From<Wpkey> for u32 {
    #[inline(always)]
    fn from(val: Wpkey) -> u32 {
        Wpkey::to_bits(val)
    }
}