saml10e16a/oscctrl/
dpllctrlb.rs1#[doc = "Reader of register DPLLCTRLB"]
2pub type R = crate::R<u32, super::DPLLCTRLB>;
3#[doc = "Writer for register DPLLCTRLB"]
4pub type W = crate::W<u32, super::DPLLCTRLB>;
5#[doc = "Register DPLLCTRLB `reset()`'s with value 0"]
6impl crate::ResetValue for super::DPLLCTRLB {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Possible values of the field `FILTER`"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum FILTER_A {
16 #[doc = "Default Filter Mode"]
17 DEFAULT,
18 #[doc = "Low Bandwidth Filter"]
19 LBFILT,
20 #[doc = "High Bandwidth Filter"]
21 HBFILT,
22 #[doc = "High Damping Filter"]
23 HDFILT,
24}
25impl crate::ToBits<u8> for FILTER_A {
26 #[inline(always)]
27 fn _bits(&self) -> u8 {
28 match *self {
29 FILTER_A::DEFAULT => 0,
30 FILTER_A::LBFILT => 1,
31 FILTER_A::HBFILT => 2,
32 FILTER_A::HDFILT => 3,
33 }
34 }
35}
36#[doc = "Reader of field `FILTER`"]
37pub type FILTER_R = crate::R<u8, FILTER_A>;
38impl FILTER_R {
39 #[doc = r"Get enumerated values variant"]
40 #[inline(always)]
41 pub fn variant(&self) -> FILTER_A {
42 match self.bits {
43 0 => FILTER_A::DEFAULT,
44 1 => FILTER_A::LBFILT,
45 2 => FILTER_A::HBFILT,
46 3 => FILTER_A::HDFILT,
47 _ => unreachable!(),
48 }
49 }
50 #[doc = "Checks if the value of the field is `DEFAULT`"]
51 #[inline(always)]
52 pub fn is_default(&self) -> bool {
53 *self == FILTER_A::DEFAULT
54 }
55 #[doc = "Checks if the value of the field is `LBFILT`"]
56 #[inline(always)]
57 pub fn is_lbfilt(&self) -> bool {
58 *self == FILTER_A::LBFILT
59 }
60 #[doc = "Checks if the value of the field is `HBFILT`"]
61 #[inline(always)]
62 pub fn is_hbfilt(&self) -> bool {
63 *self == FILTER_A::HBFILT
64 }
65 #[doc = "Checks if the value of the field is `HDFILT`"]
66 #[inline(always)]
67 pub fn is_hdfilt(&self) -> bool {
68 *self == FILTER_A::HDFILT
69 }
70}
71#[doc = "Write proxy for field `FILTER`"]
72pub struct FILTER_W<'a> {
73 w: &'a mut W,
74}
75impl<'a> FILTER_W<'a> {
76 #[doc = r"Writes `variant` to the field"]
77 #[inline(always)]
78 pub fn variant(self, variant: FILTER_A) -> &'a mut W {
79 use crate::ToBits;
80 {
81 self.bits(variant._bits())
82 }
83 }
84 #[doc = "Default Filter Mode"]
85 #[inline(always)]
86 pub fn default(self) -> &'a mut W {
87 self.variant(FILTER_A::DEFAULT)
88 }
89 #[doc = "Low Bandwidth Filter"]
90 #[inline(always)]
91 pub fn lbfilt(self) -> &'a mut W {
92 self.variant(FILTER_A::LBFILT)
93 }
94 #[doc = "High Bandwidth Filter"]
95 #[inline(always)]
96 pub fn hbfilt(self) -> &'a mut W {
97 self.variant(FILTER_A::HBFILT)
98 }
99 #[doc = "High Damping Filter"]
100 #[inline(always)]
101 pub fn hdfilt(self) -> &'a mut W {
102 self.variant(FILTER_A::HDFILT)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bits(self, value: u8) -> &'a mut W {
107 self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
108 self.w
109 }
110}
111#[doc = "Reader of field `LPEN`"]
112pub type LPEN_R = crate::R<bool, bool>;
113#[doc = "Write proxy for field `LPEN`"]
114pub struct LPEN_W<'a> {
115 w: &'a mut W,
116}
117impl<'a> LPEN_W<'a> {
118 #[doc = r"Sets the field bit"]
119 #[inline(always)]
120 pub fn set_bit(self) -> &'a mut W {
121 self.bit(true)
122 }
123 #[doc = r"Clears the field bit"]
124 #[inline(always)]
125 pub fn clear_bit(self) -> &'a mut W {
126 self.bit(false)
127 }
128 #[doc = r"Writes raw bits to the field"]
129 #[inline(always)]
130 pub fn bit(self, value: bool) -> &'a mut W {
131 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
132 self.w
133 }
134}
135#[doc = "Reader of field `WUF`"]
136pub type WUF_R = crate::R<bool, bool>;
137#[doc = "Write proxy for field `WUF`"]
138pub struct WUF_W<'a> {
139 w: &'a mut W,
140}
141impl<'a> WUF_W<'a> {
142 #[doc = r"Sets the field bit"]
143 #[inline(always)]
144 pub fn set_bit(self) -> &'a mut W {
145 self.bit(true)
146 }
147 #[doc = r"Clears the field bit"]
148 #[inline(always)]
149 pub fn clear_bit(self) -> &'a mut W {
150 self.bit(false)
151 }
152 #[doc = r"Writes raw bits to the field"]
153 #[inline(always)]
154 pub fn bit(self, value: bool) -> &'a mut W {
155 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
156 self.w
157 }
158}
159#[doc = "Possible values of the field `REFCLK`"]
160#[derive(Clone, Copy, Debug, PartialEq)]
161pub enum REFCLK_A {
162 #[doc = "XOSC32K Clock Reference"]
163 XOSC32K,
164 #[doc = "XOSC Clock Reference"]
165 XOSC,
166 #[doc = "GCLK Clock Reference"]
167 GCLK,
168}
169impl crate::ToBits<u8> for REFCLK_A {
170 #[inline(always)]
171 fn _bits(&self) -> u8 {
172 match *self {
173 REFCLK_A::XOSC32K => 0,
174 REFCLK_A::XOSC => 1,
175 REFCLK_A::GCLK => 2,
176 }
177 }
178}
179#[doc = "Reader of field `REFCLK`"]
180pub type REFCLK_R = crate::R<u8, REFCLK_A>;
181impl REFCLK_R {
182 #[doc = r"Get enumerated values variant"]
183 #[inline(always)]
184 pub fn variant(&self) -> crate::Variant<u8, REFCLK_A> {
185 use crate::Variant::*;
186 match self.bits {
187 0 => Val(REFCLK_A::XOSC32K),
188 1 => Val(REFCLK_A::XOSC),
189 2 => Val(REFCLK_A::GCLK),
190 i => Res(i),
191 }
192 }
193 #[doc = "Checks if the value of the field is `XOSC32K`"]
194 #[inline(always)]
195 pub fn is_xosc32k(&self) -> bool {
196 *self == REFCLK_A::XOSC32K
197 }
198 #[doc = "Checks if the value of the field is `XOSC`"]
199 #[inline(always)]
200 pub fn is_xosc(&self) -> bool {
201 *self == REFCLK_A::XOSC
202 }
203 #[doc = "Checks if the value of the field is `GCLK`"]
204 #[inline(always)]
205 pub fn is_gclk(&self) -> bool {
206 *self == REFCLK_A::GCLK
207 }
208}
209#[doc = "Write proxy for field `REFCLK`"]
210pub struct REFCLK_W<'a> {
211 w: &'a mut W,
212}
213impl<'a> REFCLK_W<'a> {
214 #[doc = r"Writes `variant` to the field"]
215 #[inline(always)]
216 pub fn variant(self, variant: REFCLK_A) -> &'a mut W {
217 use crate::ToBits;
218 unsafe { self.bits(variant._bits()) }
219 }
220 #[doc = "XOSC32K Clock Reference"]
221 #[inline(always)]
222 pub fn xosc32k(self) -> &'a mut W {
223 self.variant(REFCLK_A::XOSC32K)
224 }
225 #[doc = "XOSC Clock Reference"]
226 #[inline(always)]
227 pub fn xosc(self) -> &'a mut W {
228 self.variant(REFCLK_A::XOSC)
229 }
230 #[doc = "GCLK Clock Reference"]
231 #[inline(always)]
232 pub fn gclk(self) -> &'a mut W {
233 self.variant(REFCLK_A::GCLK)
234 }
235 #[doc = r"Writes raw bits to the field"]
236 #[inline(always)]
237 pub unsafe fn bits(self, value: u8) -> &'a mut W {
238 self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
239 self.w
240 }
241}
242#[doc = "Possible values of the field `LTIME`"]
243#[derive(Clone, Copy, Debug, PartialEq)]
244pub enum LTIME_A {
245 #[doc = "No time-out. Automatic lock"]
246 DEFAULT,
247 #[doc = "Time-out if no lock within 8 ms"]
248 _8MS,
249 #[doc = "Time-out if no lock within 9 ms"]
250 _9MS,
251 #[doc = "Time-out if no lock within 10 ms"]
252 _10MS,
253 #[doc = "Time-out if no lock within 11 ms"]
254 _11MS,
255}
256impl crate::ToBits<u8> for LTIME_A {
257 #[inline(always)]
258 fn _bits(&self) -> u8 {
259 match *self {
260 LTIME_A::DEFAULT => 0,
261 LTIME_A::_8MS => 4,
262 LTIME_A::_9MS => 5,
263 LTIME_A::_10MS => 6,
264 LTIME_A::_11MS => 7,
265 }
266 }
267}
268#[doc = "Reader of field `LTIME`"]
269pub type LTIME_R = crate::R<u8, LTIME_A>;
270impl LTIME_R {
271 #[doc = r"Get enumerated values variant"]
272 #[inline(always)]
273 pub fn variant(&self) -> crate::Variant<u8, LTIME_A> {
274 use crate::Variant::*;
275 match self.bits {
276 0 => Val(LTIME_A::DEFAULT),
277 4 => Val(LTIME_A::_8MS),
278 5 => Val(LTIME_A::_9MS),
279 6 => Val(LTIME_A::_10MS),
280 7 => Val(LTIME_A::_11MS),
281 i => Res(i),
282 }
283 }
284 #[doc = "Checks if the value of the field is `DEFAULT`"]
285 #[inline(always)]
286 pub fn is_default(&self) -> bool {
287 *self == LTIME_A::DEFAULT
288 }
289 #[doc = "Checks if the value of the field is `_8MS`"]
290 #[inline(always)]
291 pub fn is_8ms(&self) -> bool {
292 *self == LTIME_A::_8MS
293 }
294 #[doc = "Checks if the value of the field is `_9MS`"]
295 #[inline(always)]
296 pub fn is_9ms(&self) -> bool {
297 *self == LTIME_A::_9MS
298 }
299 #[doc = "Checks if the value of the field is `_10MS`"]
300 #[inline(always)]
301 pub fn is_10ms(&self) -> bool {
302 *self == LTIME_A::_10MS
303 }
304 #[doc = "Checks if the value of the field is `_11MS`"]
305 #[inline(always)]
306 pub fn is_11ms(&self) -> bool {
307 *self == LTIME_A::_11MS
308 }
309}
310#[doc = "Write proxy for field `LTIME`"]
311pub struct LTIME_W<'a> {
312 w: &'a mut W,
313}
314impl<'a> LTIME_W<'a> {
315 #[doc = r"Writes `variant` to the field"]
316 #[inline(always)]
317 pub fn variant(self, variant: LTIME_A) -> &'a mut W {
318 use crate::ToBits;
319 unsafe { self.bits(variant._bits()) }
320 }
321 #[doc = "No time-out. Automatic lock"]
322 #[inline(always)]
323 pub fn default(self) -> &'a mut W {
324 self.variant(LTIME_A::DEFAULT)
325 }
326 #[doc = "Time-out if no lock within 8 ms"]
327 #[inline(always)]
328 pub fn _8ms(self) -> &'a mut W {
329 self.variant(LTIME_A::_8MS)
330 }
331 #[doc = "Time-out if no lock within 9 ms"]
332 #[inline(always)]
333 pub fn _9ms(self) -> &'a mut W {
334 self.variant(LTIME_A::_9MS)
335 }
336 #[doc = "Time-out if no lock within 10 ms"]
337 #[inline(always)]
338 pub fn _10ms(self) -> &'a mut W {
339 self.variant(LTIME_A::_10MS)
340 }
341 #[doc = "Time-out if no lock within 11 ms"]
342 #[inline(always)]
343 pub fn _11ms(self) -> &'a mut W {
344 self.variant(LTIME_A::_11MS)
345 }
346 #[doc = r"Writes raw bits to the field"]
347 #[inline(always)]
348 pub unsafe fn bits(self, value: u8) -> &'a mut W {
349 self.w.bits = (self.w.bits & !(0x07 << 8)) | (((value as u32) & 0x07) << 8);
350 self.w
351 }
352}
353#[doc = "Reader of field `LBYPASS`"]
354pub type LBYPASS_R = crate::R<bool, bool>;
355#[doc = "Write proxy for field `LBYPASS`"]
356pub struct LBYPASS_W<'a> {
357 w: &'a mut W,
358}
359impl<'a> LBYPASS_W<'a> {
360 #[doc = r"Sets the field bit"]
361 #[inline(always)]
362 pub fn set_bit(self) -> &'a mut W {
363 self.bit(true)
364 }
365 #[doc = r"Clears the field bit"]
366 #[inline(always)]
367 pub fn clear_bit(self) -> &'a mut W {
368 self.bit(false)
369 }
370 #[doc = r"Writes raw bits to the field"]
371 #[inline(always)]
372 pub fn bit(self, value: bool) -> &'a mut W {
373 self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
374 self.w
375 }
376}
377#[doc = "Reader of field `DIV`"]
378pub type DIV_R = crate::R<u16, u16>;
379#[doc = "Write proxy for field `DIV`"]
380pub struct DIV_W<'a> {
381 w: &'a mut W,
382}
383impl<'a> DIV_W<'a> {
384 #[doc = r"Writes raw bits to the field"]
385 #[inline(always)]
386 pub unsafe fn bits(self, value: u16) -> &'a mut W {
387 self.w.bits = (self.w.bits & !(0x07ff << 16)) | (((value as u32) & 0x07ff) << 16);
388 self.w
389 }
390}
391impl R {
392 #[doc = "Bits 0:1 - Proportional Integral Filter Selection"]
393 #[inline(always)]
394 pub fn filter(&self) -> FILTER_R {
395 FILTER_R::new((self.bits & 0x03) as u8)
396 }
397 #[doc = "Bit 2 - Low-Power Enable"]
398 #[inline(always)]
399 pub fn lpen(&self) -> LPEN_R {
400 LPEN_R::new(((self.bits >> 2) & 0x01) != 0)
401 }
402 #[doc = "Bit 3 - Wake Up Fast"]
403 #[inline(always)]
404 pub fn wuf(&self) -> WUF_R {
405 WUF_R::new(((self.bits >> 3) & 0x01) != 0)
406 }
407 #[doc = "Bits 4:5 - Reference Clock Selection"]
408 #[inline(always)]
409 pub fn refclk(&self) -> REFCLK_R {
410 REFCLK_R::new(((self.bits >> 4) & 0x03) as u8)
411 }
412 #[doc = "Bits 8:10 - Lock Time"]
413 #[inline(always)]
414 pub fn ltime(&self) -> LTIME_R {
415 LTIME_R::new(((self.bits >> 8) & 0x07) as u8)
416 }
417 #[doc = "Bit 12 - Lock Bypass"]
418 #[inline(always)]
419 pub fn lbypass(&self) -> LBYPASS_R {
420 LBYPASS_R::new(((self.bits >> 12) & 0x01) != 0)
421 }
422 #[doc = "Bits 16:26 - Clock Divider"]
423 #[inline(always)]
424 pub fn div(&self) -> DIV_R {
425 DIV_R::new(((self.bits >> 16) & 0x07ff) as u16)
426 }
427}
428impl W {
429 #[doc = "Bits 0:1 - Proportional Integral Filter Selection"]
430 #[inline(always)]
431 pub fn filter(&mut self) -> FILTER_W {
432 FILTER_W { w: self }
433 }
434 #[doc = "Bit 2 - Low-Power Enable"]
435 #[inline(always)]
436 pub fn lpen(&mut self) -> LPEN_W {
437 LPEN_W { w: self }
438 }
439 #[doc = "Bit 3 - Wake Up Fast"]
440 #[inline(always)]
441 pub fn wuf(&mut self) -> WUF_W {
442 WUF_W { w: self }
443 }
444 #[doc = "Bits 4:5 - Reference Clock Selection"]
445 #[inline(always)]
446 pub fn refclk(&mut self) -> REFCLK_W {
447 REFCLK_W { w: self }
448 }
449 #[doc = "Bits 8:10 - Lock Time"]
450 #[inline(always)]
451 pub fn ltime(&mut self) -> LTIME_W {
452 LTIME_W { w: self }
453 }
454 #[doc = "Bit 12 - Lock Bypass"]
455 #[inline(always)]
456 pub fn lbypass(&mut self) -> LBYPASS_W {
457 LBYPASS_W { w: self }
458 }
459 #[doc = "Bits 16:26 - Clock Divider"]
460 #[inline(always)]
461 pub fn div(&mut self) -> DIV_W {
462 DIV_W { w: self }
463 }
464}