ra2a1 0.2.0

Peripheral access API for ra2a1 microcontrollers (generated using svd2rust)
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
#[doc = "Register `WDTCR` reader"]
pub struct R(crate::R<WDTCR_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<WDTCR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<WDTCR_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<WDTCR_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `WDTCR` writer"]
pub struct W(crate::W<WDTCR_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<WDTCR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<WDTCR_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<WDTCR_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `TOPS` reader - Timeout Period Selection"]
pub type TOPS_R = crate::FieldReader<u8, TOPS_A>;
#[doc = "Timeout Period Selection\n\nValue on reset: 3"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TOPS_A {
    #[doc = "0: 1,024 cycles (03FFh)"]
    _00 = 0,
    #[doc = "1: 4,096 cycles (0FFFh)"]
    _01 = 1,
    #[doc = "2: 8,192 cycles (1FFFh)"]
    _10 = 2,
    #[doc = "3: 16,384 cycles (3FFFh)"]
    _11 = 3,
}
impl From<TOPS_A> for u8 {
    #[inline(always)]
    fn from(variant: TOPS_A) -> Self {
        variant as _
    }
}
impl TOPS_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TOPS_A {
        match self.bits {
            0 => TOPS_A::_00,
            1 => TOPS_A::_01,
            2 => TOPS_A::_10,
            3 => TOPS_A::_11,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `_00`"]
    #[inline(always)]
    pub fn is_00(&self) -> bool {
        *self == TOPS_A::_00
    }
    #[doc = "Checks if the value of the field is `_01`"]
    #[inline(always)]
    pub fn is_01(&self) -> bool {
        *self == TOPS_A::_01
    }
    #[doc = "Checks if the value of the field is `_10`"]
    #[inline(always)]
    pub fn is_10(&self) -> bool {
        *self == TOPS_A::_10
    }
    #[doc = "Checks if the value of the field is `_11`"]
    #[inline(always)]
    pub fn is_11(&self) -> bool {
        *self == TOPS_A::_11
    }
}
#[doc = "Field `TOPS` writer - Timeout Period Selection"]
pub type TOPS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, WDTCR_SPEC, u8, TOPS_A, 2, O>;
impl<'a, const O: u8> TOPS_W<'a, O> {
    #[doc = "1,024 cycles (03FFh)"]
    #[inline(always)]
    pub fn _00(self) -> &'a mut W {
        self.variant(TOPS_A::_00)
    }
    #[doc = "4,096 cycles (0FFFh)"]
    #[inline(always)]
    pub fn _01(self) -> &'a mut W {
        self.variant(TOPS_A::_01)
    }
    #[doc = "8,192 cycles (1FFFh)"]
    #[inline(always)]
    pub fn _10(self) -> &'a mut W {
        self.variant(TOPS_A::_10)
    }
    #[doc = "16,384 cycles (3FFFh)"]
    #[inline(always)]
    pub fn _11(self) -> &'a mut W {
        self.variant(TOPS_A::_11)
    }
}
#[doc = "Field `CKS` reader - Clock Division Ratio Selection"]
pub type CKS_R = crate::FieldReader<u8, CKS_A>;
#[doc = "Clock Division Ratio Selection\n\nValue on reset: 15"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CKS_A {
    #[doc = "1: PCLK/4"]
    _0001 = 1,
    #[doc = "4: PCLK/64"]
    _0100 = 4,
    #[doc = "15: PCLK/128"]
    _1111 = 15,
    #[doc = "6: PCLK/512"]
    _0110 = 6,
    #[doc = "7: PCLK/2048"]
    _0111 = 7,
    #[doc = "8: PCLK/8192"]
    _1000 = 8,
}
impl From<CKS_A> for u8 {
    #[inline(always)]
    fn from(variant: CKS_A) -> Self {
        variant as _
    }
}
impl CKS_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<CKS_A> {
        match self.bits {
            1 => Some(CKS_A::_0001),
            4 => Some(CKS_A::_0100),
            15 => Some(CKS_A::_1111),
            6 => Some(CKS_A::_0110),
            7 => Some(CKS_A::_0111),
            8 => Some(CKS_A::_1000),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `_0001`"]
    #[inline(always)]
    pub fn is_0001(&self) -> bool {
        *self == CKS_A::_0001
    }
    #[doc = "Checks if the value of the field is `_0100`"]
    #[inline(always)]
    pub fn is_0100(&self) -> bool {
        *self == CKS_A::_0100
    }
    #[doc = "Checks if the value of the field is `_1111`"]
    #[inline(always)]
    pub fn is_1111(&self) -> bool {
        *self == CKS_A::_1111
    }
    #[doc = "Checks if the value of the field is `_0110`"]
    #[inline(always)]
    pub fn is_0110(&self) -> bool {
        *self == CKS_A::_0110
    }
    #[doc = "Checks if the value of the field is `_0111`"]
    #[inline(always)]
    pub fn is_0111(&self) -> bool {
        *self == CKS_A::_0111
    }
    #[doc = "Checks if the value of the field is `_1000`"]
    #[inline(always)]
    pub fn is_1000(&self) -> bool {
        *self == CKS_A::_1000
    }
}
#[doc = "Field `CKS` writer - Clock Division Ratio Selection"]
pub type CKS_W<'a, const O: u8> = crate::FieldWriter<'a, u16, WDTCR_SPEC, u8, CKS_A, 4, O>;
impl<'a, const O: u8> CKS_W<'a, O> {
    #[doc = "PCLK/4"]
    #[inline(always)]
    pub fn _0001(self) -> &'a mut W {
        self.variant(CKS_A::_0001)
    }
    #[doc = "PCLK/64"]
    #[inline(always)]
    pub fn _0100(self) -> &'a mut W {
        self.variant(CKS_A::_0100)
    }
    #[doc = "PCLK/128"]
    #[inline(always)]
    pub fn _1111(self) -> &'a mut W {
        self.variant(CKS_A::_1111)
    }
    #[doc = "PCLK/512"]
    #[inline(always)]
    pub fn _0110(self) -> &'a mut W {
        self.variant(CKS_A::_0110)
    }
    #[doc = "PCLK/2048"]
    #[inline(always)]
    pub fn _0111(self) -> &'a mut W {
        self.variant(CKS_A::_0111)
    }
    #[doc = "PCLK/8192"]
    #[inline(always)]
    pub fn _1000(self) -> &'a mut W {
        self.variant(CKS_A::_1000)
    }
}
#[doc = "Field `RPES` reader - Window End Position Selection"]
pub type RPES_R = crate::FieldReader<u8, RPES_A>;
#[doc = "Window End Position Selection\n\nValue on reset: 3"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RPES_A {
    #[doc = "0: 75 percent"]
    _00 = 0,
    #[doc = "1: 50 percent"]
    _01 = 1,
    #[doc = "2: 25 percent"]
    _10 = 2,
    #[doc = "3: 0 percent (window end position is not specified)"]
    _11 = 3,
}
impl From<RPES_A> for u8 {
    #[inline(always)]
    fn from(variant: RPES_A) -> Self {
        variant as _
    }
}
impl RPES_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RPES_A {
        match self.bits {
            0 => RPES_A::_00,
            1 => RPES_A::_01,
            2 => RPES_A::_10,
            3 => RPES_A::_11,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `_00`"]
    #[inline(always)]
    pub fn is_00(&self) -> bool {
        *self == RPES_A::_00
    }
    #[doc = "Checks if the value of the field is `_01`"]
    #[inline(always)]
    pub fn is_01(&self) -> bool {
        *self == RPES_A::_01
    }
    #[doc = "Checks if the value of the field is `_10`"]
    #[inline(always)]
    pub fn is_10(&self) -> bool {
        *self == RPES_A::_10
    }
    #[doc = "Checks if the value of the field is `_11`"]
    #[inline(always)]
    pub fn is_11(&self) -> bool {
        *self == RPES_A::_11
    }
}
#[doc = "Field `RPES` writer - Window End Position Selection"]
pub type RPES_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, WDTCR_SPEC, u8, RPES_A, 2, O>;
impl<'a, const O: u8> RPES_W<'a, O> {
    #[doc = "75 percent"]
    #[inline(always)]
    pub fn _00(self) -> &'a mut W {
        self.variant(RPES_A::_00)
    }
    #[doc = "50 percent"]
    #[inline(always)]
    pub fn _01(self) -> &'a mut W {
        self.variant(RPES_A::_01)
    }
    #[doc = "25 percent"]
    #[inline(always)]
    pub fn _10(self) -> &'a mut W {
        self.variant(RPES_A::_10)
    }
    #[doc = "0 percent (window end position is not specified)"]
    #[inline(always)]
    pub fn _11(self) -> &'a mut W {
        self.variant(RPES_A::_11)
    }
}
#[doc = "Field `RPSS` reader - Window Start Position Selection"]
pub type RPSS_R = crate::FieldReader<u8, RPSS_A>;
#[doc = "Window Start Position Selection\n\nValue on reset: 3"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RPSS_A {
    #[doc = "0: 25 percent"]
    _00 = 0,
    #[doc = "1: 50 percent"]
    _01 = 1,
    #[doc = "2: 75 percent"]
    _10 = 2,
    #[doc = "3: 100 percent (window start position is not specified)"]
    _11 = 3,
}
impl From<RPSS_A> for u8 {
    #[inline(always)]
    fn from(variant: RPSS_A) -> Self {
        variant as _
    }
}
impl RPSS_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RPSS_A {
        match self.bits {
            0 => RPSS_A::_00,
            1 => RPSS_A::_01,
            2 => RPSS_A::_10,
            3 => RPSS_A::_11,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `_00`"]
    #[inline(always)]
    pub fn is_00(&self) -> bool {
        *self == RPSS_A::_00
    }
    #[doc = "Checks if the value of the field is `_01`"]
    #[inline(always)]
    pub fn is_01(&self) -> bool {
        *self == RPSS_A::_01
    }
    #[doc = "Checks if the value of the field is `_10`"]
    #[inline(always)]
    pub fn is_10(&self) -> bool {
        *self == RPSS_A::_10
    }
    #[doc = "Checks if the value of the field is `_11`"]
    #[inline(always)]
    pub fn is_11(&self) -> bool {
        *self == RPSS_A::_11
    }
}
#[doc = "Field `RPSS` writer - Window Start Position Selection"]
pub type RPSS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, WDTCR_SPEC, u8, RPSS_A, 2, O>;
impl<'a, const O: u8> RPSS_W<'a, O> {
    #[doc = "25 percent"]
    #[inline(always)]
    pub fn _00(self) -> &'a mut W {
        self.variant(RPSS_A::_00)
    }
    #[doc = "50 percent"]
    #[inline(always)]
    pub fn _01(self) -> &'a mut W {
        self.variant(RPSS_A::_01)
    }
    #[doc = "75 percent"]
    #[inline(always)]
    pub fn _10(self) -> &'a mut W {
        self.variant(RPSS_A::_10)
    }
    #[doc = "100 percent (window start position is not specified)"]
    #[inline(always)]
    pub fn _11(self) -> &'a mut W {
        self.variant(RPSS_A::_11)
    }
}
impl R {
    #[doc = "Bits 0:1 - Timeout Period Selection"]
    #[inline(always)]
    pub fn tops(&self) -> TOPS_R {
        TOPS_R::new((self.bits & 3) as u8)
    }
    #[doc = "Bits 4:7 - Clock Division Ratio Selection"]
    #[inline(always)]
    pub fn cks(&self) -> CKS_R {
        CKS_R::new(((self.bits >> 4) & 0x0f) as u8)
    }
    #[doc = "Bits 8:9 - Window End Position Selection"]
    #[inline(always)]
    pub fn rpes(&self) -> RPES_R {
        RPES_R::new(((self.bits >> 8) & 3) as u8)
    }
    #[doc = "Bits 12:13 - Window Start Position Selection"]
    #[inline(always)]
    pub fn rpss(&self) -> RPSS_R {
        RPSS_R::new(((self.bits >> 12) & 3) as u8)
    }
}
impl W {
    #[doc = "Bits 0:1 - Timeout Period Selection"]
    #[inline(always)]
    #[must_use]
    pub fn tops(&mut self) -> TOPS_W<0> {
        TOPS_W::new(self)
    }
    #[doc = "Bits 4:7 - Clock Division Ratio Selection"]
    #[inline(always)]
    #[must_use]
    pub fn cks(&mut self) -> CKS_W<4> {
        CKS_W::new(self)
    }
    #[doc = "Bits 8:9 - Window End Position Selection"]
    #[inline(always)]
    #[must_use]
    pub fn rpes(&mut self) -> RPES_W<8> {
        RPES_W::new(self)
    }
    #[doc = "Bits 12:13 - Window Start Position Selection"]
    #[inline(always)]
    #[must_use]
    pub fn rpss(&mut self) -> RPSS_W<12> {
        RPSS_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "WDT Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [wdtcr](index.html) module"]
pub struct WDTCR_SPEC;
impl crate::RegisterSpec for WDTCR_SPEC {
    type Ux = u16;
}
#[doc = "`read()` method returns [wdtcr::R](R) reader structure"]
impl crate::Readable for WDTCR_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [wdtcr::W](W) writer structure"]
impl crate::Writable for WDTCR_SPEC {
    type Writer = W;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets WDTCR to value 0x33f3"]
impl crate::Resettable for WDTCR_SPEC {
    const RESET_VALUE: Self::Ux = 0x33f3;
}