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
#[doc = "Register `fout_32k_ctrl_gating` reader"]
pub struct R(crate::R<FOUT_32K_CTRL_GATING_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<FOUT_32K_CTRL_GATING_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<FOUT_32K_CTRL_GATING_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<FOUT_32K_CTRL_GATING_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `fout_32k_ctrl_gating` writer"]
pub struct W(crate::W<FOUT_32K_CTRL_GATING_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<FOUT_32K_CTRL_GATING_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<FOUT_32K_CTRL_GATING_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<FOUT_32K_CTRL_GATING_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `fanout_32k_gating` reader - LOSC out gating enable\n\nConfiguration of LOSC output, and there is no LOSC output by default."]
pub type FANOUT_32K_GATING_R = crate::BitReader<FANOUT_32K_GATING_A>;
#[doc = "LOSC out gating enable\n\nConfiguration of LOSC output, and there is no LOSC output by default.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FANOUT_32K_GATING_A {
    #[doc = "0: Mask LOSC output gating"]
    MASK = 0,
    #[doc = "1: Enable LOSC output gating"]
    ENABLE = 1,
}
impl From<FANOUT_32K_GATING_A> for bool {
    #[inline(always)]
    fn from(variant: FANOUT_32K_GATING_A) -> Self {
        variant as u8 != 0
    }
}
impl FANOUT_32K_GATING_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> FANOUT_32K_GATING_A {
        match self.bits {
            false => FANOUT_32K_GATING_A::MASK,
            true => FANOUT_32K_GATING_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `MASK`"]
    #[inline(always)]
    pub fn is_mask(&self) -> bool {
        *self == FANOUT_32K_GATING_A::MASK
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == FANOUT_32K_GATING_A::ENABLE
    }
}
#[doc = "Field `fanout_32k_gating` writer - LOSC out gating enable\n\nConfiguration of LOSC output, and there is no LOSC output by default."]
pub type FANOUT_32K_GATING_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, FOUT_32K_CTRL_GATING_SPEC, FANOUT_32K_GATING_A, O>;
impl<'a, const O: u8> FANOUT_32K_GATING_W<'a, O> {
    #[doc = "Mask LOSC output gating"]
    #[inline(always)]
    pub fn mask(self) -> &'a mut W {
        self.variant(FANOUT_32K_GATING_A::MASK)
    }
    #[doc = "Enable LOSC output gating"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(FANOUT_32K_GATING_A::ENABLE)
    }
}
#[doc = "Field `losc_out_src_sel` reader - LOSC output source select"]
pub type LOSC_OUT_SRC_SEL_R = crate::FieldReader<u8, LOSC_OUT_SRC_SEL_A>;
#[doc = "LOSC output source select\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum LOSC_OUT_SRC_SEL_A {
    #[doc = "0: RTC_32K (select by RC_CLK_SRC_SEL LOSC_SRC_SEL)"]
    RTC_32K = 0,
    #[doc = "1: LOSC"]
    LOSC = 1,
    #[doc = "2: HOSC divided 32K"]
    HOSC = 2,
}
impl From<LOSC_OUT_SRC_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: LOSC_OUT_SRC_SEL_A) -> Self {
        variant as _
    }
}
impl LOSC_OUT_SRC_SEL_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<LOSC_OUT_SRC_SEL_A> {
        match self.bits {
            0 => Some(LOSC_OUT_SRC_SEL_A::RTC_32K),
            1 => Some(LOSC_OUT_SRC_SEL_A::LOSC),
            2 => Some(LOSC_OUT_SRC_SEL_A::HOSC),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `RTC_32K`"]
    #[inline(always)]
    pub fn is_rtc_32k(&self) -> bool {
        *self == LOSC_OUT_SRC_SEL_A::RTC_32K
    }
    #[doc = "Checks if the value of the field is `LOSC`"]
    #[inline(always)]
    pub fn is_losc(&self) -> bool {
        *self == LOSC_OUT_SRC_SEL_A::LOSC
    }
    #[doc = "Checks if the value of the field is `HOSC`"]
    #[inline(always)]
    pub fn is_hosc(&self) -> bool {
        *self == LOSC_OUT_SRC_SEL_A::HOSC
    }
}
#[doc = "Field `losc_out_src_sel` writer - LOSC output source select"]
pub type LOSC_OUT_SRC_SEL_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, FOUT_32K_CTRL_GATING_SPEC, u8, LOSC_OUT_SRC_SEL_A, 2, O>;
impl<'a, const O: u8> LOSC_OUT_SRC_SEL_W<'a, O> {
    #[doc = "RTC_32K (select by RC_CLK_SRC_SEL LOSC_SRC_SEL)"]
    #[inline(always)]
    pub fn rtc_32k(self) -> &'a mut W {
        self.variant(LOSC_OUT_SRC_SEL_A::RTC_32K)
    }
    #[doc = "LOSC"]
    #[inline(always)]
    pub fn losc(self) -> &'a mut W {
        self.variant(LOSC_OUT_SRC_SEL_A::LOSC)
    }
    #[doc = "HOSC divided 32K"]
    #[inline(always)]
    pub fn hosc(self) -> &'a mut W {
        self.variant(LOSC_OUT_SRC_SEL_A::HOSC)
    }
}
#[doc = "Field `hosc_to_32k_divider_enable` reader - HOSC to 32k divider enable"]
pub type HOSC_TO_32K_DIVIDER_ENABLE_R = crate::BitReader<HOSC_TO_32K_DIVIDER_ENABLE_A>;
#[doc = "HOSC to 32k divider enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HOSC_TO_32K_DIVIDER_ENABLE_A {
    #[doc = "0: Disable the hosc 24M to 32K divider circuit"]
    DISABLE = 0,
    #[doc = "1: Enable the hosc 24M to 32K divider circuit"]
    ENABLE = 1,
}
impl From<HOSC_TO_32K_DIVIDER_ENABLE_A> for bool {
    #[inline(always)]
    fn from(variant: HOSC_TO_32K_DIVIDER_ENABLE_A) -> Self {
        variant as u8 != 0
    }
}
impl HOSC_TO_32K_DIVIDER_ENABLE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> HOSC_TO_32K_DIVIDER_ENABLE_A {
        match self.bits {
            false => HOSC_TO_32K_DIVIDER_ENABLE_A::DISABLE,
            true => HOSC_TO_32K_DIVIDER_ENABLE_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        *self == HOSC_TO_32K_DIVIDER_ENABLE_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        *self == HOSC_TO_32K_DIVIDER_ENABLE_A::ENABLE
    }
}
#[doc = "Field `hosc_to_32k_divider_enable` writer - HOSC to 32k divider enable"]
pub type HOSC_TO_32K_DIVIDER_ENABLE_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, FOUT_32K_CTRL_GATING_SPEC, HOSC_TO_32K_DIVIDER_ENABLE_A, O>;
impl<'a, const O: u8> HOSC_TO_32K_DIVIDER_ENABLE_W<'a, O> {
    #[doc = "Disable the hosc 24M to 32K divider circuit"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(HOSC_TO_32K_DIVIDER_ENABLE_A::DISABLE)
    }
    #[doc = "Enable the hosc 24M to 32K divider circuit"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(HOSC_TO_32K_DIVIDER_ENABLE_A::ENABLE)
    }
}
impl R {
    #[doc = "Bit 0 - LOSC out gating enable\n\nConfiguration of LOSC output, and there is no LOSC output by default."]
    #[inline(always)]
    pub fn fanout_32k_gating(&self) -> FANOUT_32K_GATING_R {
        FANOUT_32K_GATING_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bits 1:2 - LOSC output source select"]
    #[inline(always)]
    pub fn losc_out_src_sel(&self) -> LOSC_OUT_SRC_SEL_R {
        LOSC_OUT_SRC_SEL_R::new(((self.bits >> 1) & 3) as u8)
    }
    #[doc = "Bit 16 - HOSC to 32k divider enable"]
    #[inline(always)]
    pub fn hosc_to_32k_divider_enable(&self) -> HOSC_TO_32K_DIVIDER_ENABLE_R {
        HOSC_TO_32K_DIVIDER_ENABLE_R::new(((self.bits >> 16) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - LOSC out gating enable\n\nConfiguration of LOSC output, and there is no LOSC output by default."]
    #[inline(always)]
    #[must_use]
    pub fn fanout_32k_gating(&mut self) -> FANOUT_32K_GATING_W<0> {
        FANOUT_32K_GATING_W::new(self)
    }
    #[doc = "Bits 1:2 - LOSC output source select"]
    #[inline(always)]
    #[must_use]
    pub fn losc_out_src_sel(&mut self) -> LOSC_OUT_SRC_SEL_W<1> {
        LOSC_OUT_SRC_SEL_W::new(self)
    }
    #[doc = "Bit 16 - HOSC to 32k divider enable"]
    #[inline(always)]
    #[must_use]
    pub fn hosc_to_32k_divider_enable(&mut self) -> HOSC_TO_32K_DIVIDER_ENABLE_W<16> {
        HOSC_TO_32K_DIVIDER_ENABLE_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 = "32K Fanout Control Gating 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 [fout_32k_ctrl_gating](index.html) module"]
pub struct FOUT_32K_CTRL_GATING_SPEC;
impl crate::RegisterSpec for FOUT_32K_CTRL_GATING_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [fout_32k_ctrl_gating::R](R) reader structure"]
impl crate::Readable for FOUT_32K_CTRL_GATING_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [fout_32k_ctrl_gating::W](W) writer structure"]
impl crate::Writable for FOUT_32K_CTRL_GATING_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 fout_32k_ctrl_gating to value 0"]
impl crate::Resettable for FOUT_32K_CTRL_GATING_SPEC {
    const RESET_VALUE: Self::Ux = 0;
}