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
#[doc = "Register `losc_ctrl` reader"]
pub struct R(crate::R<LOSC_CTRL_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<LOSC_CTRL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<LOSC_CTRL_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<LOSC_CTRL_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `losc_ctrl` writer"]
pub struct W(crate::W<LOSC_CTRL_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<LOSC_CTRL_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<LOSC_CTRL_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<LOSC_CTRL_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `losc_src_sel` reader - LOSC Clock Source Select"]
pub type LOSC_SRC_SEL_R = crate::BitReader<LOSC_SRC_SEL_A>;
#[doc = "LOSC Clock Source Select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LOSC_SRC_SEL_A {
    #[doc = "0: Low frequency clock from 16M RC"]
    LOW = 0,
    #[doc = "1: External 32.768 kHz OSC"]
    EXTERNAL = 1,
}
impl From<LOSC_SRC_SEL_A> for bool {
    #[inline(always)]
    fn from(variant: LOSC_SRC_SEL_A) -> Self {
        variant as u8 != 0
    }
}
impl LOSC_SRC_SEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LOSC_SRC_SEL_A {
        match self.bits {
            false => LOSC_SRC_SEL_A::LOW,
            true => LOSC_SRC_SEL_A::EXTERNAL,
        }
    }
    #[doc = "Checks if the value of the field is `LOW`"]
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == LOSC_SRC_SEL_A::LOW
    }
    #[doc = "Checks if the value of the field is `EXTERNAL`"]
    #[inline(always)]
    pub fn is_external(&self) -> bool {
        *self == LOSC_SRC_SEL_A::EXTERNAL
    }
}
#[doc = "Field `losc_src_sel` writer - LOSC Clock Source Select"]
pub type LOSC_SRC_SEL_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, LOSC_SRC_SEL_A, O>;
impl<'a, const O: u8> LOSC_SRC_SEL_W<'a, O> {
    #[doc = "Low frequency clock from 16M RC"]
    #[inline(always)]
    pub fn low(self) -> &'a mut W {
        self.variant(LOSC_SRC_SEL_A::LOW)
    }
    #[doc = "External 32.768 kHz OSC"]
    #[inline(always)]
    pub fn external(self) -> &'a mut W {
        self.variant(LOSC_SRC_SEL_A::EXTERNAL)
    }
}
#[doc = "Field `rtc_src_sel` reader - RTC_TIMER Clock Source Select"]
pub type RTC_SRC_SEL_R = crate::BitReader<RTC_SRC_SEL_A>;
#[doc = "RTC_TIMER Clock Source Select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RTC_SRC_SEL_A {
    #[doc = "0: LOSC_SRC"]
    LOSC_SRC = 0,
    #[doc = "1: 24MDIV32K\n\nBefore switching the bit, make sure that the 24MDIV32K function is enabled, that is, the bit16 of the 32K Fanout Control Register is 1."]
    _24MDIV32K = 1,
}
impl From<RTC_SRC_SEL_A> for bool {
    #[inline(always)]
    fn from(variant: RTC_SRC_SEL_A) -> Self {
        variant as u8 != 0
    }
}
impl RTC_SRC_SEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RTC_SRC_SEL_A {
        match self.bits {
            false => RTC_SRC_SEL_A::LOSC_SRC,
            true => RTC_SRC_SEL_A::_24MDIV32K,
        }
    }
    #[doc = "Checks if the value of the field is `LOSC_SRC`"]
    #[inline(always)]
    pub fn is_losc_src(&self) -> bool {
        *self == RTC_SRC_SEL_A::LOSC_SRC
    }
    #[doc = "Checks if the value of the field is `_24MDIV32K`"]
    #[inline(always)]
    pub fn is_24mdiv32k(&self) -> bool {
        *self == RTC_SRC_SEL_A::_24MDIV32K
    }
}
#[doc = "Field `rtc_src_sel` writer - RTC_TIMER Clock Source Select"]
pub type RTC_SRC_SEL_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, RTC_SRC_SEL_A, O>;
impl<'a, const O: u8> RTC_SRC_SEL_W<'a, O> {
    #[doc = "LOSC_SRC"]
    #[inline(always)]
    pub fn losc_src(self) -> &'a mut W {
        self.variant(RTC_SRC_SEL_A::LOSC_SRC)
    }
    #[doc = "24MDIV32K\n\nBefore switching the bit, make sure that the 24MDIV32K function is enabled, that is, the bit16 of the 32K Fanout Control Register is 1."]
    #[inline(always)]
    pub fn _24mdiv32k(self) -> &'a mut W {
        self.variant(RTC_SRC_SEL_A::_24MDIV32K)
    }
}
#[doc = "Field `ext_losc_gsm` reader - External 32.768 kHz Crystal GSM\n\nWhen GSM is changed, the 32K oscillation circuit will arise transient instability. If the autoswitch function (bit 15) is enabled, 32K changes to RC16M with certain probability. The GSM can influence the time of 32K starting oscillation, the more the GSM, the shorter the time of starting oscillation. So modifying GSM is not recommended.\n\nIf you need to modify the GSM, firstly disable the auto switch function (bit 15), with a delay of 50 us, then change the GSM, the 32K clock source is changed to external clock."]
pub type EXT_LOSC_GSM_R = crate::FieldReader<u8, EXT_LOSC_GSM_A>;
#[doc = "External 32.768 kHz Crystal GSM\n\nWhen GSM is changed, the 32K oscillation circuit will arise transient instability. If the autoswitch function (bit 15) is enabled, 32K changes to RC16M with certain probability. The GSM can influence the time of 32K starting oscillation, the more the GSM, the shorter the time of starting oscillation. So modifying GSM is not recommended.\n\nIf you need to modify the GSM, firstly disable the auto switch function (bit 15), with a delay of 50 us, then change the GSM, the 32K clock source is changed to external clock.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EXT_LOSC_GSM_A {
    #[doc = "0: Low"]
    LOW = 0,
    #[doc = "3: High"]
    HIGH = 3,
}
impl From<EXT_LOSC_GSM_A> for u8 {
    #[inline(always)]
    fn from(variant: EXT_LOSC_GSM_A) -> Self {
        variant as _
    }
}
impl EXT_LOSC_GSM_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<EXT_LOSC_GSM_A> {
        match self.bits {
            0 => Some(EXT_LOSC_GSM_A::LOW),
            3 => Some(EXT_LOSC_GSM_A::HIGH),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `LOW`"]
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == EXT_LOSC_GSM_A::LOW
    }
    #[doc = "Checks if the value of the field is `HIGH`"]
    #[inline(always)]
    pub fn is_high(&self) -> bool {
        *self == EXT_LOSC_GSM_A::HIGH
    }
}
#[doc = "Field `ext_losc_gsm` writer - External 32.768 kHz Crystal GSM\n\nWhen GSM is changed, the 32K oscillation circuit will arise transient instability. If the autoswitch function (bit 15) is enabled, 32K changes to RC16M with certain probability. The GSM can influence the time of 32K starting oscillation, the more the GSM, the shorter the time of starting oscillation. So modifying GSM is not recommended.\n\nIf you need to modify the GSM, firstly disable the auto switch function (bit 15), with a delay of 50 us, then change the GSM, the 32K clock source is changed to external clock."]
pub type EXT_LOSC_GSM_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, LOSC_CTRL_SPEC, u8, EXT_LOSC_GSM_A, 2, O>;
impl<'a, const O: u8> EXT_LOSC_GSM_W<'a, O> {
    #[doc = "Low"]
    #[inline(always)]
    pub fn low(self) -> &'a mut W {
        self.variant(EXT_LOSC_GSM_A::LOW)
    }
    #[doc = "High"]
    #[inline(always)]
    pub fn high(self) -> &'a mut W {
        self.variant(EXT_LOSC_GSM_A::HIGH)
    }
}
#[doc = "Field `ext_losc_en` reader - External 32.768 kHz Crystal Enable"]
pub type EXT_LOSC_EN_R = crate::BitReader<EXT_LOSC_EN_A>;
#[doc = "External 32.768 kHz Crystal Enable\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EXT_LOSC_EN_A {
    #[doc = "0: Disable"]
    DISABLE = 0,
    #[doc = "1: Enable"]
    ENABLE = 1,
}
impl From<EXT_LOSC_EN_A> for bool {
    #[inline(always)]
    fn from(variant: EXT_LOSC_EN_A) -> Self {
        variant as u8 != 0
    }
}
impl EXT_LOSC_EN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> EXT_LOSC_EN_A {
        match self.bits {
            false => EXT_LOSC_EN_A::DISABLE,
            true => EXT_LOSC_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == EXT_LOSC_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == EXT_LOSC_EN_A::ENABLE
    }
}
#[doc = "Field `ext_losc_en` writer - External 32.768 kHz Crystal Enable"]
pub type EXT_LOSC_EN_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, EXT_LOSC_EN_A, O>;
impl<'a, const O: u8> EXT_LOSC_EN_W<'a, O> {
    #[doc = "Disable"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(EXT_LOSC_EN_A::DISABLE)
    }
    #[doc = "Enable"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(EXT_LOSC_EN_A::ENABLE)
    }
}
#[doc = "Field `rtc_day_acce` reader - RTC DAY access\n\nAfter writing the RTC DAY register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC DAY register, the DAY register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
pub type RTC_DAY_ACCE_R = crate::BitReader<bool>;
#[doc = "Field `rtc_day_acce` writer - RTC DAY access\n\nAfter writing the RTC DAY register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC DAY register, the DAY register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
pub type RTC_DAY_ACCE_W<'a, const O: u8> = crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, bool, O>;
#[doc = "Field `rtc_hhmmss_acce` reader - RTC Hour Minute Second access\n\nAfter writing the RTC HH-MM-SS Register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC HH-MM-SS Register, the RTC HH-MM-SS Register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
pub type RTC_HHMMSS_ACCE_R = crate::BitReader<bool>;
#[doc = "Field `rtc_hhmmss_acce` writer - RTC Hour Minute Second access\n\nAfter writing the RTC HH-MM-SS Register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC HH-MM-SS Register, the RTC HH-MM-SS Register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
pub type RTC_HHMMSS_ACCE_W<'a, const O: u8> = crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, bool, O>;
#[doc = "Field `losc_auto_swt_32k_sel_en` reader - LOSC auto switch 32K clk source select enable"]
pub type LOSC_AUTO_SWT_32K_SEL_EN_R = crate::BitReader<LOSC_AUTO_SWT_32K_SEL_EN_A>;
#[doc = "LOSC auto switch 32K clk source select enable\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LOSC_AUTO_SWT_32K_SEL_EN_A {
    #[doc = "0: Disable. When the losc losts, the 32k clk source will not change to RC"]
    DISABLE = 0,
    #[doc = "1: Enable. When the losc losts, the 32k clk source will change to RC (LOSC_SRC_SEL will be changed from 1 to 0)"]
    ENABLE = 1,
}
impl From<LOSC_AUTO_SWT_32K_SEL_EN_A> for bool {
    #[inline(always)]
    fn from(variant: LOSC_AUTO_SWT_32K_SEL_EN_A) -> Self {
        variant as u8 != 0
    }
}
impl LOSC_AUTO_SWT_32K_SEL_EN_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LOSC_AUTO_SWT_32K_SEL_EN_A {
        match self.bits {
            false => LOSC_AUTO_SWT_32K_SEL_EN_A::DISABLE,
            true => LOSC_AUTO_SWT_32K_SEL_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == LOSC_AUTO_SWT_32K_SEL_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == LOSC_AUTO_SWT_32K_SEL_EN_A::ENABLE
    }
}
#[doc = "Field `losc_auto_swt_32k_sel_en` writer - LOSC auto switch 32K clk source select enable"]
pub type LOSC_AUTO_SWT_32K_SEL_EN_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, LOSC_AUTO_SWT_32K_SEL_EN_A, O>;
impl<'a, const O: u8> LOSC_AUTO_SWT_32K_SEL_EN_W<'a, O> {
    #[doc = "Disable. When the losc losts, the 32k clk source will not change to RC"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(LOSC_AUTO_SWT_32K_SEL_EN_A::DISABLE)
    }
    #[doc = "Enable. When the losc losts, the 32k clk source will change to RC (LOSC_SRC_SEL will be changed from 1 to 0)"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(LOSC_AUTO_SWT_32K_SEL_EN_A::ENABLE)
    }
}
#[doc = "Field `losc_auto_swt_function` reader - LOSC auto switch function disable"]
pub type LOSC_AUTO_SWT_FUNCTION_R = crate::BitReader<LOSC_AUTO_SWT_FUNCTION_A>;
#[doc = "LOSC auto switch function disable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LOSC_AUTO_SWT_FUNCTION_A {
    #[doc = "0: Enable"]
    ENABLE = 0,
    #[doc = "1: Disable"]
    DISABLE = 1,
}
impl From<LOSC_AUTO_SWT_FUNCTION_A> for bool {
    #[inline(always)]
    fn from(variant: LOSC_AUTO_SWT_FUNCTION_A) -> Self {
        variant as u8 != 0
    }
}
impl LOSC_AUTO_SWT_FUNCTION_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LOSC_AUTO_SWT_FUNCTION_A {
        match self.bits {
            false => LOSC_AUTO_SWT_FUNCTION_A::ENABLE,
            true => LOSC_AUTO_SWT_FUNCTION_A::DISABLE,
        }
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == LOSC_AUTO_SWT_FUNCTION_A::ENABLE
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == LOSC_AUTO_SWT_FUNCTION_A::DISABLE
    }
}
#[doc = "Field `losc_auto_swt_function` writer - LOSC auto switch function disable"]
pub type LOSC_AUTO_SWT_FUNCTION_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, LOSC_CTRL_SPEC, LOSC_AUTO_SWT_FUNCTION_A, O>;
impl<'a, const O: u8> LOSC_AUTO_SWT_FUNCTION_W<'a, O> {
    #[doc = "Enable"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(LOSC_AUTO_SWT_FUNCTION_A::ENABLE)
    }
    #[doc = "Disable"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(LOSC_AUTO_SWT_FUNCTION_A::DISABLE)
    }
}
#[doc = "Field `key_field` writer - Key Field\n\nThis field should be filled with 0x16AA, and then the bit0 and bit1 can be written with the new value."]
pub type KEY_FIELD_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, LOSC_CTRL_SPEC, u16, u16, 16, O>;
impl R {
    #[doc = "Bit 0 - LOSC Clock Source Select"]
    #[inline(always)]
    pub fn losc_src_sel(&self) -> LOSC_SRC_SEL_R {
        LOSC_SRC_SEL_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - RTC_TIMER Clock Source Select"]
    #[inline(always)]
    pub fn rtc_src_sel(&self) -> RTC_SRC_SEL_R {
        RTC_SRC_SEL_R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 2:3 - External 32.768 kHz Crystal GSM\n\nWhen GSM is changed, the 32K oscillation circuit will arise transient instability. If the autoswitch function (bit 15) is enabled, 32K changes to RC16M with certain probability. The GSM can influence the time of 32K starting oscillation, the more the GSM, the shorter the time of starting oscillation. So modifying GSM is not recommended.\n\nIf you need to modify the GSM, firstly disable the auto switch function (bit 15), with a delay of 50 us, then change the GSM, the 32K clock source is changed to external clock."]
    #[inline(always)]
    pub fn ext_losc_gsm(&self) -> EXT_LOSC_GSM_R {
        EXT_LOSC_GSM_R::new(((self.bits >> 2) & 3) as u8)
    }
    #[doc = "Bit 4 - External 32.768 kHz Crystal Enable"]
    #[inline(always)]
    pub fn ext_losc_en(&self) -> EXT_LOSC_EN_R {
        EXT_LOSC_EN_R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 7 - RTC DAY access\n\nAfter writing the RTC DAY register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC DAY register, the DAY register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
    #[inline(always)]
    pub fn rtc_day_acce(&self) -> RTC_DAY_ACCE_R {
        RTC_DAY_ACCE_R::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bit 8 - RTC Hour Minute Second access\n\nAfter writing the RTC HH-MM-SS Register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC HH-MM-SS Register, the RTC HH-MM-SS Register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
    #[inline(always)]
    pub fn rtc_hhmmss_acce(&self) -> RTC_HHMMSS_ACCE_R {
        RTC_HHMMSS_ACCE_R::new(((self.bits >> 8) & 1) != 0)
    }
    #[doc = "Bit 14 - LOSC auto switch 32K clk source select enable"]
    #[inline(always)]
    pub fn losc_auto_swt_32k_sel_en(&self) -> LOSC_AUTO_SWT_32K_SEL_EN_R {
        LOSC_AUTO_SWT_32K_SEL_EN_R::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bit 15 - LOSC auto switch function disable"]
    #[inline(always)]
    pub fn losc_auto_swt_function(&self) -> LOSC_AUTO_SWT_FUNCTION_R {
        LOSC_AUTO_SWT_FUNCTION_R::new(((self.bits >> 15) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - LOSC Clock Source Select"]
    #[inline(always)]
    #[must_use]
    pub fn losc_src_sel(&mut self) -> LOSC_SRC_SEL_W<0> {
        LOSC_SRC_SEL_W::new(self)
    }
    #[doc = "Bit 1 - RTC_TIMER Clock Source Select"]
    #[inline(always)]
    #[must_use]
    pub fn rtc_src_sel(&mut self) -> RTC_SRC_SEL_W<1> {
        RTC_SRC_SEL_W::new(self)
    }
    #[doc = "Bits 2:3 - External 32.768 kHz Crystal GSM\n\nWhen GSM is changed, the 32K oscillation circuit will arise transient instability. If the autoswitch function (bit 15) is enabled, 32K changes to RC16M with certain probability. The GSM can influence the time of 32K starting oscillation, the more the GSM, the shorter the time of starting oscillation. So modifying GSM is not recommended.\n\nIf you need to modify the GSM, firstly disable the auto switch function (bit 15), with a delay of 50 us, then change the GSM, the 32K clock source is changed to external clock."]
    #[inline(always)]
    #[must_use]
    pub fn ext_losc_gsm(&mut self) -> EXT_LOSC_GSM_W<2> {
        EXT_LOSC_GSM_W::new(self)
    }
    #[doc = "Bit 4 - External 32.768 kHz Crystal Enable"]
    #[inline(always)]
    #[must_use]
    pub fn ext_losc_en(&mut self) -> EXT_LOSC_EN_W<4> {
        EXT_LOSC_EN_W::new(self)
    }
    #[doc = "Bit 7 - RTC DAY access\n\nAfter writing the RTC DAY register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC DAY register, the DAY register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
    #[inline(always)]
    #[must_use]
    pub fn rtc_day_acce(&mut self) -> RTC_DAY_ACCE_W<7> {
        RTC_DAY_ACCE_W::new(self)
    }
    #[doc = "Bit 8 - RTC Hour Minute Second access\n\nAfter writing the RTC HH-MM-SS Register, this bit is set and it will be cleared until the real writing operation is finished. After writing the RTC HH-MM-SS Register, the RTC HH-MM-SS Register will be refreshed for at most one second.\n\nNote: Make sure that the bit is 0 for time configuration."]
    #[inline(always)]
    #[must_use]
    pub fn rtc_hhmmss_acce(&mut self) -> RTC_HHMMSS_ACCE_W<8> {
        RTC_HHMMSS_ACCE_W::new(self)
    }
    #[doc = "Bit 14 - LOSC auto switch 32K clk source select enable"]
    #[inline(always)]
    #[must_use]
    pub fn losc_auto_swt_32k_sel_en(&mut self) -> LOSC_AUTO_SWT_32K_SEL_EN_W<14> {
        LOSC_AUTO_SWT_32K_SEL_EN_W::new(self)
    }
    #[doc = "Bit 15 - LOSC auto switch function disable"]
    #[inline(always)]
    #[must_use]
    pub fn losc_auto_swt_function(&mut self) -> LOSC_AUTO_SWT_FUNCTION_W<15> {
        LOSC_AUTO_SWT_FUNCTION_W::new(self)
    }
    #[doc = "Bits 16:31 - Key Field\n\nThis field should be filled with 0x16AA, and then the bit0 and bit1 can be written with the new value."]
    #[inline(always)]
    #[must_use]
    pub fn key_field(&mut self) -> KEY_FIELD_W<16> {
        KEY_FIELD_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Low Oscillator 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 [losc_ctrl](index.html) module"]
pub struct LOSC_CTRL_SPEC;
impl crate::RegisterSpec for LOSC_CTRL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [losc_ctrl::R](R) reader structure"]
impl crate::Readable for LOSC_CTRL_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [losc_ctrl::W](W) writer structure"]
impl crate::Writable for LOSC_CTRL_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 losc_ctrl to value 0x4010"]
impl crate::Resettable for LOSC_CTRL_SPEC {
    const RESET_VALUE: Self::Ux = 0x4010;
}