atsamd21j18a/sysctrl/
dfllmul.rs

1#[doc = "Reader of register DFLLMUL"]
2pub type R = crate::R<u32, super::DFLLMUL>;
3#[doc = "Writer for register DFLLMUL"]
4pub type W = crate::W<u32, super::DFLLMUL>;
5#[doc = "Register DFLLMUL `reset()`'s with value 0"]
6impl crate::ResetValue for super::DFLLMUL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `MUL`"]
14pub type MUL_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `MUL`"]
16pub struct MUL_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> MUL_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0xffff) | ((value as u32) & 0xffff);
24        self.w
25    }
26}
27#[doc = "Reader of field `FSTEP`"]
28pub type FSTEP_R = crate::R<u16, u16>;
29#[doc = "Write proxy for field `FSTEP`"]
30pub struct FSTEP_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> FSTEP_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u16) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x03ff << 16)) | (((value as u32) & 0x03ff) << 16);
38        self.w
39    }
40}
41#[doc = "Reader of field `CSTEP`"]
42pub type CSTEP_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `CSTEP`"]
44pub struct CSTEP_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> CSTEP_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x3f << 26)) | (((value as u32) & 0x3f) << 26);
52        self.w
53    }
54}
55impl R {
56    #[doc = "Bits 0:15 - DFLL Multiply Factor"]
57    #[inline(always)]
58    pub fn mul(&self) -> MUL_R {
59        MUL_R::new((self.bits & 0xffff) as u16)
60    }
61    #[doc = "Bits 16:25 - Fine Maximum Step"]
62    #[inline(always)]
63    pub fn fstep(&self) -> FSTEP_R {
64        FSTEP_R::new(((self.bits >> 16) & 0x03ff) as u16)
65    }
66    #[doc = "Bits 26:31 - Coarse Maximum Step"]
67    #[inline(always)]
68    pub fn cstep(&self) -> CSTEP_R {
69        CSTEP_R::new(((self.bits >> 26) & 0x3f) as u8)
70    }
71}
72impl W {
73    #[doc = "Bits 0:15 - DFLL Multiply Factor"]
74    #[inline(always)]
75    pub fn mul(&mut self) -> MUL_W {
76        MUL_W { w: self }
77    }
78    #[doc = "Bits 16:25 - Fine Maximum Step"]
79    #[inline(always)]
80    pub fn fstep(&mut self) -> FSTEP_W {
81        FSTEP_W { w: self }
82    }
83    #[doc = "Bits 26:31 - Coarse Maximum Step"]
84    #[inline(always)]
85    pub fn cstep(&mut self) -> CSTEP_W {
86        CSTEP_W { w: self }
87    }
88}