atsamd11c/sysctrl/
dpllctrlb.rs

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
#[doc = "Register `DPLLCTRLB` reader"]
pub type R = crate::R<DpllctrlbSpec>;
#[doc = "Register `DPLLCTRLB` writer"]
pub type W = crate::W<DpllctrlbSpec>;
#[doc = "Proportional Integral Filter Selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Filterselect {
    #[doc = "0: Default filter mode"]
    Default = 0,
    #[doc = "1: Low bandwidth filter"]
    Lbfilt = 1,
    #[doc = "2: High bandwidth filter"]
    Hbfilt = 2,
    #[doc = "3: High damping filter"]
    Hdfilt = 3,
}
impl From<Filterselect> for u8 {
    #[inline(always)]
    fn from(variant: Filterselect) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Filterselect {
    type Ux = u8;
}
impl crate::IsEnum for Filterselect {}
#[doc = "Field `FILTER` reader - Proportional Integral Filter Selection"]
pub type FilterR = crate::FieldReader<Filterselect>;
impl FilterR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Filterselect {
        match self.bits {
            0 => Filterselect::Default,
            1 => Filterselect::Lbfilt,
            2 => Filterselect::Hbfilt,
            3 => Filterselect::Hdfilt,
            _ => unreachable!(),
        }
    }
    #[doc = "Default filter mode"]
    #[inline(always)]
    pub fn is_default(&self) -> bool {
        *self == Filterselect::Default
    }
    #[doc = "Low bandwidth filter"]
    #[inline(always)]
    pub fn is_lbfilt(&self) -> bool {
        *self == Filterselect::Lbfilt
    }
    #[doc = "High bandwidth filter"]
    #[inline(always)]
    pub fn is_hbfilt(&self) -> bool {
        *self == Filterselect::Hbfilt
    }
    #[doc = "High damping filter"]
    #[inline(always)]
    pub fn is_hdfilt(&self) -> bool {
        *self == Filterselect::Hdfilt
    }
}
#[doc = "Field `FILTER` writer - Proportional Integral Filter Selection"]
pub type FilterW<'a, REG> = crate::FieldWriter<'a, REG, 2, Filterselect, crate::Safe>;
impl<'a, REG> FilterW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Default filter mode"]
    #[inline(always)]
    pub fn default(self) -> &'a mut crate::W<REG> {
        self.variant(Filterselect::Default)
    }
    #[doc = "Low bandwidth filter"]
    #[inline(always)]
    pub fn lbfilt(self) -> &'a mut crate::W<REG> {
        self.variant(Filterselect::Lbfilt)
    }
    #[doc = "High bandwidth filter"]
    #[inline(always)]
    pub fn hbfilt(self) -> &'a mut crate::W<REG> {
        self.variant(Filterselect::Hbfilt)
    }
    #[doc = "High damping filter"]
    #[inline(always)]
    pub fn hdfilt(self) -> &'a mut crate::W<REG> {
        self.variant(Filterselect::Hdfilt)
    }
}
#[doc = "Field `LPEN` reader - Low-Power Enable"]
pub type LpenR = crate::BitReader;
#[doc = "Field `LPEN` writer - Low-Power Enable"]
pub type LpenW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `WUF` reader - Wake Up Fast"]
pub type WufR = crate::BitReader;
#[doc = "Field `WUF` writer - Wake Up Fast"]
pub type WufW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Reference Clock Selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Refclkselect {
    #[doc = "0: CLK_DPLL_REF0 clock reference"]
    Ref0 = 0,
    #[doc = "1: CLK_DPLL_REF1 clock reference"]
    Ref1 = 1,
    #[doc = "2: GCLK_DPLL clock reference"]
    Gclk = 2,
}
impl From<Refclkselect> for u8 {
    #[inline(always)]
    fn from(variant: Refclkselect) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Refclkselect {
    type Ux = u8;
}
impl crate::IsEnum for Refclkselect {}
#[doc = "Field `REFCLK` reader - Reference Clock Selection"]
pub type RefclkR = crate::FieldReader<Refclkselect>;
impl RefclkR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Refclkselect> {
        match self.bits {
            0 => Some(Refclkselect::Ref0),
            1 => Some(Refclkselect::Ref1),
            2 => Some(Refclkselect::Gclk),
            _ => None,
        }
    }
    #[doc = "CLK_DPLL_REF0 clock reference"]
    #[inline(always)]
    pub fn is_ref0(&self) -> bool {
        *self == Refclkselect::Ref0
    }
    #[doc = "CLK_DPLL_REF1 clock reference"]
    #[inline(always)]
    pub fn is_ref1(&self) -> bool {
        *self == Refclkselect::Ref1
    }
    #[doc = "GCLK_DPLL clock reference"]
    #[inline(always)]
    pub fn is_gclk(&self) -> bool {
        *self == Refclkselect::Gclk
    }
}
#[doc = "Field `REFCLK` writer - Reference Clock Selection"]
pub type RefclkW<'a, REG> = crate::FieldWriter<'a, REG, 2, Refclkselect>;
impl<'a, REG> RefclkW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "CLK_DPLL_REF0 clock reference"]
    #[inline(always)]
    pub fn ref0(self) -> &'a mut crate::W<REG> {
        self.variant(Refclkselect::Ref0)
    }
    #[doc = "CLK_DPLL_REF1 clock reference"]
    #[inline(always)]
    pub fn ref1(self) -> &'a mut crate::W<REG> {
        self.variant(Refclkselect::Ref1)
    }
    #[doc = "GCLK_DPLL clock reference"]
    #[inline(always)]
    pub fn gclk(self) -> &'a mut crate::W<REG> {
        self.variant(Refclkselect::Gclk)
    }
}
#[doc = "Lock Time\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Ltimeselect {
    #[doc = "0: Default No time-out"]
    None = 0,
    #[doc = "4: 8MS Time-out if no lock within 8 ms"]
    _8ms = 4,
    #[doc = "5: 9MS Time-out if no lock within 9 ms"]
    _9ms = 5,
    #[doc = "6: 10MS Time-out if no lock within 10 ms"]
    _10ms = 6,
    #[doc = "7: 11MS Time-out if no lock within 11 ms"]
    _11ms = 7,
}
impl From<Ltimeselect> for u8 {
    #[inline(always)]
    fn from(variant: Ltimeselect) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Ltimeselect {
    type Ux = u8;
}
impl crate::IsEnum for Ltimeselect {}
#[doc = "Field `LTIME` reader - Lock Time"]
pub type LtimeR = crate::FieldReader<Ltimeselect>;
impl LtimeR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Ltimeselect> {
        match self.bits {
            0 => Some(Ltimeselect::None),
            4 => Some(Ltimeselect::_8ms),
            5 => Some(Ltimeselect::_9ms),
            6 => Some(Ltimeselect::_10ms),
            7 => Some(Ltimeselect::_11ms),
            _ => None,
        }
    }
    #[doc = "Default No time-out"]
    #[inline(always)]
    pub fn is_none(&self) -> bool {
        *self == Ltimeselect::None
    }
    #[doc = "8MS Time-out if no lock within 8 ms"]
    #[inline(always)]
    pub fn is_8ms(&self) -> bool {
        *self == Ltimeselect::_8ms
    }
    #[doc = "9MS Time-out if no lock within 9 ms"]
    #[inline(always)]
    pub fn is_9ms(&self) -> bool {
        *self == Ltimeselect::_9ms
    }
    #[doc = "10MS Time-out if no lock within 10 ms"]
    #[inline(always)]
    pub fn is_10ms(&self) -> bool {
        *self == Ltimeselect::_10ms
    }
    #[doc = "11MS Time-out if no lock within 11 ms"]
    #[inline(always)]
    pub fn is_11ms(&self) -> bool {
        *self == Ltimeselect::_11ms
    }
}
#[doc = "Field `LTIME` writer - Lock Time"]
pub type LtimeW<'a, REG> = crate::FieldWriter<'a, REG, 3, Ltimeselect>;
impl<'a, REG> LtimeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Default No time-out"]
    #[inline(always)]
    pub fn none(self) -> &'a mut crate::W<REG> {
        self.variant(Ltimeselect::None)
    }
    #[doc = "8MS Time-out if no lock within 8 ms"]
    #[inline(always)]
    pub fn _8ms(self) -> &'a mut crate::W<REG> {
        self.variant(Ltimeselect::_8ms)
    }
    #[doc = "9MS Time-out if no lock within 9 ms"]
    #[inline(always)]
    pub fn _9ms(self) -> &'a mut crate::W<REG> {
        self.variant(Ltimeselect::_9ms)
    }
    #[doc = "10MS Time-out if no lock within 10 ms"]
    #[inline(always)]
    pub fn _10ms(self) -> &'a mut crate::W<REG> {
        self.variant(Ltimeselect::_10ms)
    }
    #[doc = "11MS Time-out if no lock within 11 ms"]
    #[inline(always)]
    pub fn _11ms(self) -> &'a mut crate::W<REG> {
        self.variant(Ltimeselect::_11ms)
    }
}
#[doc = "Field `LBYPASS` reader - Lock Bypass"]
pub type LbypassR = crate::BitReader;
#[doc = "Field `LBYPASS` writer - Lock Bypass"]
pub type LbypassW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `DIV` reader - Clock Divider"]
pub type DivR = crate::FieldReader<u16>;
#[doc = "Field `DIV` writer - Clock Divider"]
pub type DivW<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
impl R {
    #[doc = "Bits 0:1 - Proportional Integral Filter Selection"]
    #[inline(always)]
    pub fn filter(&self) -> FilterR {
        FilterR::new((self.bits & 3) as u8)
    }
    #[doc = "Bit 2 - Low-Power Enable"]
    #[inline(always)]
    pub fn lpen(&self) -> LpenR {
        LpenR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Wake Up Fast"]
    #[inline(always)]
    pub fn wuf(&self) -> WufR {
        WufR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bits 4:5 - Reference Clock Selection"]
    #[inline(always)]
    pub fn refclk(&self) -> RefclkR {
        RefclkR::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bits 8:10 - Lock Time"]
    #[inline(always)]
    pub fn ltime(&self) -> LtimeR {
        LtimeR::new(((self.bits >> 8) & 7) as u8)
    }
    #[doc = "Bit 12 - Lock Bypass"]
    #[inline(always)]
    pub fn lbypass(&self) -> LbypassR {
        LbypassR::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bits 16:26 - Clock Divider"]
    #[inline(always)]
    pub fn div(&self) -> DivR {
        DivR::new(((self.bits >> 16) & 0x07ff) as u16)
    }
}
impl W {
    #[doc = "Bits 0:1 - Proportional Integral Filter Selection"]
    #[inline(always)]
    #[must_use]
    pub fn filter(&mut self) -> FilterW<DpllctrlbSpec> {
        FilterW::new(self, 0)
    }
    #[doc = "Bit 2 - Low-Power Enable"]
    #[inline(always)]
    #[must_use]
    pub fn lpen(&mut self) -> LpenW<DpllctrlbSpec> {
        LpenW::new(self, 2)
    }
    #[doc = "Bit 3 - Wake Up Fast"]
    #[inline(always)]
    #[must_use]
    pub fn wuf(&mut self) -> WufW<DpllctrlbSpec> {
        WufW::new(self, 3)
    }
    #[doc = "Bits 4:5 - Reference Clock Selection"]
    #[inline(always)]
    #[must_use]
    pub fn refclk(&mut self) -> RefclkW<DpllctrlbSpec> {
        RefclkW::new(self, 4)
    }
    #[doc = "Bits 8:10 - Lock Time"]
    #[inline(always)]
    #[must_use]
    pub fn ltime(&mut self) -> LtimeW<DpllctrlbSpec> {
        LtimeW::new(self, 8)
    }
    #[doc = "Bit 12 - Lock Bypass"]
    #[inline(always)]
    #[must_use]
    pub fn lbypass(&mut self) -> LbypassW<DpllctrlbSpec> {
        LbypassW::new(self, 12)
    }
    #[doc = "Bits 16:26 - Clock Divider"]
    #[inline(always)]
    #[must_use]
    pub fn div(&mut self) -> DivW<DpllctrlbSpec> {
        DivW::new(self, 16)
    }
}
#[doc = "DPLL Control B\n\nYou can [`read`](crate::Reg::read) this register and get [`dpllctrlb::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`dpllctrlb::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct DpllctrlbSpec;
impl crate::RegisterSpec for DpllctrlbSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`dpllctrlb::R`](R) reader structure"]
impl crate::Readable for DpllctrlbSpec {}
#[doc = "`write(|w| ..)` method takes [`dpllctrlb::W`](W) writer structure"]
impl crate::Writable for DpllctrlbSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets DPLLCTRLB to value 0"]
impl crate::Resettable for DpllctrlbSpec {
    const RESET_VALUE: u32 = 0;
}