atsame54p20a/oscctrl/dpll/
dpllratio.rs

1#[doc = "Reader of register DPLLRATIO"]
2pub type R = crate::R<u32, super::DPLLRATIO>;
3#[doc = "Writer for register DPLLRATIO"]
4pub type W = crate::W<u32, super::DPLLRATIO>;
5#[doc = "Register DPLLRATIO `reset()`'s with value 0"]
6impl crate::ResetValue for super::DPLLRATIO {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `LDR`"]
14pub type LDR_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `LDR`"]
16pub struct LDR_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> LDR_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 & !0x1fff) | ((value as u32) & 0x1fff);
24        self.w
25    }
26}
27#[doc = "Reader of field `LDRFRAC`"]
28pub type LDRFRAC_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `LDRFRAC`"]
30pub struct LDRFRAC_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> LDRFRAC_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 & !(0x1f << 16)) | (((value as u32) & 0x1f) << 16);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 0:12 - Loop Divider Ratio"]
43    #[inline(always)]
44    pub fn ldr(&self) -> LDR_R {
45        LDR_R::new((self.bits & 0x1fff) as u16)
46    }
47    #[doc = "Bits 16:20 - Loop Divider Ratio Fractional Part"]
48    #[inline(always)]
49    pub fn ldrfrac(&self) -> LDRFRAC_R {
50        LDRFRAC_R::new(((self.bits >> 16) & 0x1f) as u8)
51    }
52}
53impl W {
54    #[doc = "Bits 0:12 - Loop Divider Ratio"]
55    #[inline(always)]
56    pub fn ldr(&mut self) -> LDR_W {
57        LDR_W { w: self }
58    }
59    #[doc = "Bits 16:20 - Loop Divider Ratio Fractional Part"]
60    #[inline(always)]
61    pub fn ldrfrac(&mut self) -> LDRFRAC_W {
62        LDRFRAC_W { w: self }
63    }
64}