atsamd11c14a/sysctrl/
dfllval.rs

1#[doc = "Reader of register DFLLVAL"]
2pub type R = crate::R<u32, super::DFLLVAL>;
3#[doc = "Writer for register DFLLVAL"]
4pub type W = crate::W<u32, super::DFLLVAL>;
5#[doc = "Register DFLLVAL `reset()`'s with value 0"]
6impl crate::ResetValue for super::DFLLVAL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `FINE`"]
14pub type FINE_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `FINE`"]
16pub struct FINE_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> FINE_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 & !0x03ff) | ((value as u32) & 0x03ff);
24        self.w
25    }
26}
27#[doc = "Reader of field `COARSE`"]
28pub type COARSE_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `COARSE`"]
30pub struct COARSE_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> COARSE_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x3f << 10)) | (((value as u32) & 0x3f) << 10);
38        self.w
39    }
40}
41#[doc = "Reader of field `DIFF`"]
42pub type DIFF_R = crate::R<u16, u16>;
43impl R {
44    #[doc = "Bits 0:9 - Fine Value"]
45    #[inline(always)]
46    pub fn fine(&self) -> FINE_R {
47        FINE_R::new((self.bits & 0x03ff) as u16)
48    }
49    #[doc = "Bits 10:15 - Coarse Value"]
50    #[inline(always)]
51    pub fn coarse(&self) -> COARSE_R {
52        COARSE_R::new(((self.bits >> 10) & 0x3f) as u8)
53    }
54    #[doc = "Bits 16:31 - Multiplication Ratio Difference"]
55    #[inline(always)]
56    pub fn diff(&self) -> DIFF_R {
57        DIFF_R::new(((self.bits >> 16) & 0xffff) as u16)
58    }
59}
60impl W {
61    #[doc = "Bits 0:9 - Fine Value"]
62    #[inline(always)]
63    pub fn fine(&mut self) -> FINE_W {
64        FINE_W { w: self }
65    }
66    #[doc = "Bits 10:15 - Coarse Value"]
67    #[inline(always)]
68    pub fn coarse(&mut self) -> COARSE_W {
69        COARSE_W { w: self }
70    }
71}