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
#[doc = "Register `CTL0` reader"]
pub type R = crate::R<Ctl0Spec>;
#[doc = "Register `CTL0` writer"]
pub type W = crate::W<Ctl0Spec>;
#[doc = "Internal High Speed oscillator Enable\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Irc8men {
    #[doc = "0: Clock Off"]
    Off = 0,
    #[doc = "1: Clock On"]
    On = 1,
}
impl From<Irc8men> for bool {
    #[inline(always)]
    fn from(variant: Irc8men) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `IRC8MEN` reader - Internal High Speed oscillator Enable"]
pub type Irc8menR = crate::BitReader<Irc8men>;
impl Irc8menR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Irc8men {
        match self.bits {
            false => Irc8men::Off,
            true => Irc8men::On,
        }
    }
    #[doc = "Clock Off"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        *self == Irc8men::Off
    }
    #[doc = "Clock On"]
    #[inline(always)]
    pub fn is_on(&self) -> bool {
        *self == Irc8men::On
    }
}
#[doc = "Field `IRC8MEN` writer - Internal High Speed oscillator Enable"]
pub type Irc8menW<'a, REG> = crate::BitWriter<'a, REG, Irc8men>;
impl<'a, REG> Irc8menW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Clock Off"]
    #[inline(always)]
    pub fn off(self) -> &'a mut crate::W<REG> {
        self.variant(Irc8men::Off)
    }
    #[doc = "Clock On"]
    #[inline(always)]
    pub fn on(self) -> &'a mut crate::W<REG> {
        self.variant(Irc8men::On)
    }
}
#[doc = "IRC8M High Speed Internal Oscillator stabilization Flag\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Irc8mstbr {
    #[doc = "0: IRC8M is not stable"]
    NotReady = 0,
    #[doc = "1: IRC8M is stable"]
    Ready = 1,
}
impl From<Irc8mstbr> for bool {
    #[inline(always)]
    fn from(variant: Irc8mstbr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `IRC8MSTB` reader - IRC8M High Speed Internal Oscillator stabilization Flag"]
pub type Irc8mstbR = crate::BitReader<Irc8mstbr>;
impl Irc8mstbR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Irc8mstbr {
        match self.bits {
            false => Irc8mstbr::NotReady,
            true => Irc8mstbr::Ready,
        }
    }
    #[doc = "IRC8M is not stable"]
    #[inline(always)]
    pub fn is_not_ready(&self) -> bool {
        *self == Irc8mstbr::NotReady
    }
    #[doc = "IRC8M is stable"]
    #[inline(always)]
    pub fn is_ready(&self) -> bool {
        *self == Irc8mstbr::Ready
    }
}
#[doc = "Field `IRC8MADJ` reader - High Speed Internal Oscillator clock trim adjust value"]
pub type Irc8madjR = crate::FieldReader;
#[doc = "Field `IRC8MADJ` writer - High Speed Internal Oscillator clock trim adjust value"]
pub type Irc8madjW<'a, REG> = crate::FieldWriterSafe<'a, REG, 5>;
#[doc = "Field `IRC8MCALIB` reader - High Speed Internal Oscillator calibration value register"]
pub type Irc8mcalibR = crate::FieldReader;
#[doc = "Field `HXTALEN` reader - External High Speed oscillator Enable"]
pub use Irc8menR as HxtalenR;
#[doc = "Field `HXTALEN` writer - External High Speed oscillator Enable"]
pub use Irc8menW as HxtalenW;
#[doc = "External crystal oscillator (HXTAL) clock stabilization flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Hxtalstbr {
    #[doc = "0: HXTAL is not stable"]
    NotReady = 0,
    #[doc = "1: HXTAL is stable"]
    Ready = 1,
}
impl From<Hxtalstbr> for bool {
    #[inline(always)]
    fn from(variant: Hxtalstbr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HXTALSTB` reader - External crystal oscillator (HXTAL) clock stabilization flag"]
pub type HxtalstbR = crate::BitReader<Hxtalstbr>;
impl HxtalstbR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Hxtalstbr {
        match self.bits {
            false => Hxtalstbr::NotReady,
            true => Hxtalstbr::Ready,
        }
    }
    #[doc = "HXTAL is not stable"]
    #[inline(always)]
    pub fn is_not_ready(&self) -> bool {
        *self == Hxtalstbr::NotReady
    }
    #[doc = "HXTAL is stable"]
    #[inline(always)]
    pub fn is_ready(&self) -> bool {
        *self == Hxtalstbr::Ready
    }
}
#[doc = "External crystal oscillator (HXTAL) clock bypass mode enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Hxtalbps {
    #[doc = "0: HXTAL crystal oscillator not bypassed"]
    NotBypassed = 0,
    #[doc = "1: HXTAL crystal oscillator bypassed with external clock"]
    Bypassed = 1,
}
impl From<Hxtalbps> for bool {
    #[inline(always)]
    fn from(variant: Hxtalbps) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HXTALBPS` reader - External crystal oscillator (HXTAL) clock bypass mode enable"]
pub type HxtalbpsR = crate::BitReader<Hxtalbps>;
impl HxtalbpsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Hxtalbps {
        match self.bits {
            false => Hxtalbps::NotBypassed,
            true => Hxtalbps::Bypassed,
        }
    }
    #[doc = "HXTAL crystal oscillator not bypassed"]
    #[inline(always)]
    pub fn is_not_bypassed(&self) -> bool {
        *self == Hxtalbps::NotBypassed
    }
    #[doc = "HXTAL crystal oscillator bypassed with external clock"]
    #[inline(always)]
    pub fn is_bypassed(&self) -> bool {
        *self == Hxtalbps::Bypassed
    }
}
#[doc = "Field `HXTALBPS` writer - External crystal oscillator (HXTAL) clock bypass mode enable"]
pub type HxtalbpsW<'a, REG> = crate::BitWriter<'a, REG, Hxtalbps>;
impl<'a, REG> HxtalbpsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "HXTAL crystal oscillator not bypassed"]
    #[inline(always)]
    pub fn not_bypassed(self) -> &'a mut crate::W<REG> {
        self.variant(Hxtalbps::NotBypassed)
    }
    #[doc = "HXTAL crystal oscillator bypassed with external clock"]
    #[inline(always)]
    pub fn bypassed(self) -> &'a mut crate::W<REG> {
        self.variant(Hxtalbps::Bypassed)
    }
}
#[doc = "HXTAL Clock Monitor Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Ckmen {
    #[doc = "0: Clock monitor disabled"]
    Off = 0,
    #[doc = "1: Clock monitor enabled"]
    On = 1,
}
impl From<Ckmen> for bool {
    #[inline(always)]
    fn from(variant: Ckmen) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `CKMEN` reader - HXTAL Clock Monitor Enable"]
pub type CkmenR = crate::BitReader<Ckmen>;
impl CkmenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Ckmen {
        match self.bits {
            false => Ckmen::Off,
            true => Ckmen::On,
        }
    }
    #[doc = "Clock monitor disabled"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        *self == Ckmen::Off
    }
    #[doc = "Clock monitor enabled"]
    #[inline(always)]
    pub fn is_on(&self) -> bool {
        *self == Ckmen::On
    }
}
#[doc = "Field `CKMEN` writer - HXTAL Clock Monitor Enable"]
pub type CkmenW<'a, REG> = crate::BitWriter<'a, REG, Ckmen>;
impl<'a, REG> CkmenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Clock monitor disabled"]
    #[inline(always)]
    pub fn off(self) -> &'a mut crate::W<REG> {
        self.variant(Ckmen::Off)
    }
    #[doc = "Clock monitor enabled"]
    #[inline(always)]
    pub fn on(self) -> &'a mut crate::W<REG> {
        self.variant(Ckmen::On)
    }
}
#[doc = "PLL enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Pllen {
    #[doc = "0: Clock Off"]
    Off = 0,
    #[doc = "1: Clock On"]
    On = 1,
}
impl From<Pllen> for bool {
    #[inline(always)]
    fn from(variant: Pllen) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PLLEN` reader - PLL enable"]
pub type PllenR = crate::BitReader<Pllen>;
impl PllenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pllen {
        match self.bits {
            false => Pllen::Off,
            true => Pllen::On,
        }
    }
    #[doc = "Clock Off"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        *self == Pllen::Off
    }
    #[doc = "Clock On"]
    #[inline(always)]
    pub fn is_on(&self) -> bool {
        *self == Pllen::On
    }
}
#[doc = "Field `PLLEN` writer - PLL enable"]
pub type PllenW<'a, REG> = crate::BitWriter<'a, REG, Pllen>;
impl<'a, REG> PllenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Clock Off"]
    #[inline(always)]
    pub fn off(self) -> &'a mut crate::W<REG> {
        self.variant(Pllen::Off)
    }
    #[doc = "Clock On"]
    #[inline(always)]
    pub fn on(self) -> &'a mut crate::W<REG> {
        self.variant(Pllen::On)
    }
}
#[doc = "PLL Clock Stabilization Flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Pllstbr {
    #[doc = "0: PLL is not stable"]
    NotReady = 0,
    #[doc = "1: PLL is stable"]
    Ready = 1,
}
impl From<Pllstbr> for bool {
    #[inline(always)]
    fn from(variant: Pllstbr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PLLSTB` reader - PLL Clock Stabilization Flag"]
pub type PllstbR = crate::BitReader<Pllstbr>;
impl PllstbR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pllstbr {
        match self.bits {
            false => Pllstbr::NotReady,
            true => Pllstbr::Ready,
        }
    }
    #[doc = "PLL is not stable"]
    #[inline(always)]
    pub fn is_not_ready(&self) -> bool {
        *self == Pllstbr::NotReady
    }
    #[doc = "PLL is stable"]
    #[inline(always)]
    pub fn is_ready(&self) -> bool {
        *self == Pllstbr::Ready
    }
}
impl R {
    #[doc = "Bit 0 - Internal High Speed oscillator Enable"]
    #[inline(always)]
    pub fn irc8men(&self) -> Irc8menR {
        Irc8menR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - IRC8M High Speed Internal Oscillator stabilization Flag"]
    #[inline(always)]
    pub fn irc8mstb(&self) -> Irc8mstbR {
        Irc8mstbR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 3:7 - High Speed Internal Oscillator clock trim adjust value"]
    #[inline(always)]
    pub fn irc8madj(&self) -> Irc8madjR {
        Irc8madjR::new(((self.bits >> 3) & 0x1f) as u8)
    }
    #[doc = "Bits 8:15 - High Speed Internal Oscillator calibration value register"]
    #[inline(always)]
    pub fn irc8mcalib(&self) -> Irc8mcalibR {
        Irc8mcalibR::new(((self.bits >> 8) & 0xff) as u8)
    }
    #[doc = "Bit 16 - External High Speed oscillator Enable"]
    #[inline(always)]
    pub fn hxtalen(&self) -> HxtalenR {
        HxtalenR::new(((self.bits >> 16) & 1) != 0)
    }
    #[doc = "Bit 17 - External crystal oscillator (HXTAL) clock stabilization flag"]
    #[inline(always)]
    pub fn hxtalstb(&self) -> HxtalstbR {
        HxtalstbR::new(((self.bits >> 17) & 1) != 0)
    }
    #[doc = "Bit 18 - External crystal oscillator (HXTAL) clock bypass mode enable"]
    #[inline(always)]
    pub fn hxtalbps(&self) -> HxtalbpsR {
        HxtalbpsR::new(((self.bits >> 18) & 1) != 0)
    }
    #[doc = "Bit 19 - HXTAL Clock Monitor Enable"]
    #[inline(always)]
    pub fn ckmen(&self) -> CkmenR {
        CkmenR::new(((self.bits >> 19) & 1) != 0)
    }
    #[doc = "Bit 24 - PLL enable"]
    #[inline(always)]
    pub fn pllen(&self) -> PllenR {
        PllenR::new(((self.bits >> 24) & 1) != 0)
    }
    #[doc = "Bit 25 - PLL Clock Stabilization Flag"]
    #[inline(always)]
    pub fn pllstb(&self) -> PllstbR {
        PllstbR::new(((self.bits >> 25) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Internal High Speed oscillator Enable"]
    #[inline(always)]
    #[must_use]
    pub fn irc8men(&mut self) -> Irc8menW<Ctl0Spec> {
        Irc8menW::new(self, 0)
    }
    #[doc = "Bits 3:7 - High Speed Internal Oscillator clock trim adjust value"]
    #[inline(always)]
    #[must_use]
    pub fn irc8madj(&mut self) -> Irc8madjW<Ctl0Spec> {
        Irc8madjW::new(self, 3)
    }
    #[doc = "Bit 16 - External High Speed oscillator Enable"]
    #[inline(always)]
    #[must_use]
    pub fn hxtalen(&mut self) -> HxtalenW<Ctl0Spec> {
        HxtalenW::new(self, 16)
    }
    #[doc = "Bit 18 - External crystal oscillator (HXTAL) clock bypass mode enable"]
    #[inline(always)]
    #[must_use]
    pub fn hxtalbps(&mut self) -> HxtalbpsW<Ctl0Spec> {
        HxtalbpsW::new(self, 18)
    }
    #[doc = "Bit 19 - HXTAL Clock Monitor Enable"]
    #[inline(always)]
    #[must_use]
    pub fn ckmen(&mut self) -> CkmenW<Ctl0Spec> {
        CkmenW::new(self, 19)
    }
    #[doc = "Bit 24 - PLL enable"]
    #[inline(always)]
    #[must_use]
    pub fn pllen(&mut self) -> PllenW<Ctl0Spec> {
        PllenW::new(self, 24)
    }
}
#[doc = "Control register 0\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ctl0::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 [`ctl0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct Ctl0Spec;
impl crate::RegisterSpec for Ctl0Spec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`ctl0::R`](R) reader structure"]
impl crate::Readable for Ctl0Spec {}
#[doc = "`write(|w| ..)` method takes [`ctl0::W`](W) writer structure"]
impl crate::Writable for Ctl0Spec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets CTL0 to value 0x83"]
impl crate::Resettable for Ctl0Spec {
    const RESET_VALUE: u32 = 0x83;
}