lpc55_pac/syscon/
pll0pdec.rs

1#[doc = "Register `PLL0PDEC` reader"]
2pub struct R(crate::R<PLL0PDEC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PLL0PDEC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PLL0PDEC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PLL0PDEC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PLL0PDEC` writer"]
17pub struct W(crate::W<PLL0PDEC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PLL0PDEC_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<PLL0PDEC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PLL0PDEC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PDIV` reader - post-divider divider ratio (P-divider)"]
38pub struct PDIV_R(crate::FieldReader<u8, u8>);
39impl PDIV_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        PDIV_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for PDIV_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `PDIV` writer - post-divider divider ratio (P-divider)"]
53pub struct PDIV_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> PDIV_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x1f) | (value as u32 & 0x1f);
61        self.w
62    }
63}
64#[doc = "Field `PREQ` reader - feedback ratio change request."]
65pub struct PREQ_R(crate::FieldReader<bool, bool>);
66impl PREQ_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: bool) -> Self {
69        PREQ_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for PREQ_R {
73    type Target = crate::FieldReader<bool, bool>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `PREQ` writer - feedback ratio change request."]
80pub struct PREQ_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> PREQ_W<'a> {
84    #[doc = r"Sets the field bit"]
85    #[inline(always)]
86    pub fn set_bit(self) -> &'a mut W {
87        self.bit(true)
88    }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W {
92        self.bit(false)
93    }
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub fn bit(self, value: bool) -> &'a mut W {
97        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
98        self.w
99    }
100}
101impl R {
102    #[doc = "Bits 0:4 - post-divider divider ratio (P-divider)"]
103    #[inline(always)]
104    pub fn pdiv(&self) -> PDIV_R {
105        PDIV_R::new((self.bits & 0x1f) as u8)
106    }
107    #[doc = "Bit 5 - feedback ratio change request."]
108    #[inline(always)]
109    pub fn preq(&self) -> PREQ_R {
110        PREQ_R::new(((self.bits >> 5) & 0x01) != 0)
111    }
112}
113impl W {
114    #[doc = "Bits 0:4 - post-divider divider ratio (P-divider)"]
115    #[inline(always)]
116    pub fn pdiv(&mut self) -> PDIV_W {
117        PDIV_W { w: self }
118    }
119    #[doc = "Bit 5 - feedback ratio change request."]
120    #[inline(always)]
121    pub fn preq(&mut self) -> PREQ_W {
122        PREQ_W { w: self }
123    }
124    #[doc = "Writes raw bits to the register."]
125    #[inline(always)]
126    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
127        self.0.bits(bits);
128        self
129    }
130}
131#[doc = "PLL0 550m P divider\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pll0pdec](index.html) module"]
132pub struct PLL0PDEC_SPEC;
133impl crate::RegisterSpec for PLL0PDEC_SPEC {
134    type Ux = u32;
135}
136#[doc = "`read()` method returns [pll0pdec::R](R) reader structure"]
137impl crate::Readable for PLL0PDEC_SPEC {
138    type Reader = R;
139}
140#[doc = "`write(|w| ..)` method takes [pll0pdec::W](W) writer structure"]
141impl crate::Writable for PLL0PDEC_SPEC {
142    type Writer = W;
143}
144#[doc = "`reset()` method sets PLL0PDEC to value 0"]
145impl crate::Resettable for PLL0PDEC_SPEC {
146    #[inline(always)]
147    fn reset_value() -> Self::Ux {
148        0
149    }
150}