lpc55_pac/syscon/
pll0sscg1.rs

1#[doc = "Register `PLL0SSCG1` reader"]
2pub struct R(crate::R<PLL0SSCG1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PLL0SSCG1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PLL0SSCG1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PLL0SSCG1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PLL0SSCG1` writer"]
17pub struct W(crate::W<PLL0SSCG1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PLL0SSCG1_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<PLL0SSCG1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PLL0SSCG1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `MD_MBS` reader - input word of the wrapper bit 32."]
38pub struct MD_MBS_R(crate::FieldReader<bool, bool>);
39impl MD_MBS_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        MD_MBS_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for MD_MBS_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `MD_MBS` writer - input word of the wrapper bit 32."]
53pub struct MD_MBS_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> MD_MBS_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71        self.w
72    }
73}
74#[doc = "Field `MD_REQ` reader - md change request."]
75pub struct MD_REQ_R(crate::FieldReader<bool, bool>);
76impl MD_REQ_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: bool) -> Self {
79        MD_REQ_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for MD_REQ_R {
83    type Target = crate::FieldReader<bool, bool>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `MD_REQ` writer - md change request."]
90pub struct MD_REQ_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> MD_REQ_W<'a> {
94    #[doc = r"Sets the field bit"]
95    #[inline(always)]
96    pub fn set_bit(self) -> &'a mut W {
97        self.bit(true)
98    }
99    #[doc = r"Clears the field bit"]
100    #[inline(always)]
101    pub fn clear_bit(self) -> &'a mut W {
102        self.bit(false)
103    }
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub fn bit(self, value: bool) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
108        self.w
109    }
110}
111#[doc = "Field `MF` reader - programmable modulation frequency fm = Fref/Nss mf\\[2:0\\]
112= 000 => Nss=512 (fm ~ 3."]
113pub struct MF_R(crate::FieldReader<u8, u8>);
114impl MF_R {
115    #[inline(always)]
116    pub(crate) fn new(bits: u8) -> Self {
117        MF_R(crate::FieldReader::new(bits))
118    }
119}
120impl core::ops::Deref for MF_R {
121    type Target = crate::FieldReader<u8, u8>;
122    #[inline(always)]
123    fn deref(&self) -> &Self::Target {
124        &self.0
125    }
126}
127#[doc = "Field `MF` writer - programmable modulation frequency fm = Fref/Nss mf\\[2:0\\]
128= 000 => Nss=512 (fm ~ 3."]
129pub struct MF_W<'a> {
130    w: &'a mut W,
131}
132impl<'a> MF_W<'a> {
133    #[doc = r"Writes raw bits to the field"]
134    #[inline(always)]
135    pub unsafe fn bits(self, value: u8) -> &'a mut W {
136        self.w.bits = (self.w.bits & !(0x07 << 2)) | ((value as u32 & 0x07) << 2);
137        self.w
138    }
139}
140#[doc = "Field `MR` reader - programmable frequency modulation depth Dfmodpk-pk = Fref*kss/Fcco = kss/(2*md\\[32:25\\]dec) mr\\[2:0\\]
141= 000 => kss = 0 (no spread spectrum) mr\\[2:0\\]
142= 001 => kss ~ 1 mr\\[2:0\\]
143= 010 => kss ~ 1."]
144pub struct MR_R(crate::FieldReader<u8, u8>);
145impl MR_R {
146    #[inline(always)]
147    pub(crate) fn new(bits: u8) -> Self {
148        MR_R(crate::FieldReader::new(bits))
149    }
150}
151impl core::ops::Deref for MR_R {
152    type Target = crate::FieldReader<u8, u8>;
153    #[inline(always)]
154    fn deref(&self) -> &Self::Target {
155        &self.0
156    }
157}
158#[doc = "Field `MR` writer - programmable frequency modulation depth Dfmodpk-pk = Fref*kss/Fcco = kss/(2*md\\[32:25\\]dec) mr\\[2:0\\]
159= 000 => kss = 0 (no spread spectrum) mr\\[2:0\\]
160= 001 => kss ~ 1 mr\\[2:0\\]
161= 010 => kss ~ 1."]
162pub struct MR_W<'a> {
163    w: &'a mut W,
164}
165impl<'a> MR_W<'a> {
166    #[doc = r"Writes raw bits to the field"]
167    #[inline(always)]
168    pub unsafe fn bits(self, value: u8) -> &'a mut W {
169        self.w.bits = (self.w.bits & !(0x07 << 5)) | ((value as u32 & 0x07) << 5);
170        self.w
171    }
172}
173#[doc = "Field `MC` reader - modulation waveform control Compensation for low pass filtering of the PLL to get a triangular modulation at the output of the PLL, giving a flat frequency spectrum."]
174pub struct MC_R(crate::FieldReader<u8, u8>);
175impl MC_R {
176    #[inline(always)]
177    pub(crate) fn new(bits: u8) -> Self {
178        MC_R(crate::FieldReader::new(bits))
179    }
180}
181impl core::ops::Deref for MC_R {
182    type Target = crate::FieldReader<u8, u8>;
183    #[inline(always)]
184    fn deref(&self) -> &Self::Target {
185        &self.0
186    }
187}
188#[doc = "Field `MC` writer - modulation waveform control Compensation for low pass filtering of the PLL to get a triangular modulation at the output of the PLL, giving a flat frequency spectrum."]
189pub struct MC_W<'a> {
190    w: &'a mut W,
191}
192impl<'a> MC_W<'a> {
193    #[doc = r"Writes raw bits to the field"]
194    #[inline(always)]
195    pub unsafe fn bits(self, value: u8) -> &'a mut W {
196        self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
197        self.w
198    }
199}
200#[doc = "Field `MDIV_EXT` reader - to select an external mdiv value."]
201pub struct MDIV_EXT_R(crate::FieldReader<u16, u16>);
202impl MDIV_EXT_R {
203    #[inline(always)]
204    pub(crate) fn new(bits: u16) -> Self {
205        MDIV_EXT_R(crate::FieldReader::new(bits))
206    }
207}
208impl core::ops::Deref for MDIV_EXT_R {
209    type Target = crate::FieldReader<u16, u16>;
210    #[inline(always)]
211    fn deref(&self) -> &Self::Target {
212        &self.0
213    }
214}
215#[doc = "Field `MDIV_EXT` writer - to select an external mdiv value."]
216pub struct MDIV_EXT_W<'a> {
217    w: &'a mut W,
218}
219impl<'a> MDIV_EXT_W<'a> {
220    #[doc = r"Writes raw bits to the field"]
221    #[inline(always)]
222    pub unsafe fn bits(self, value: u16) -> &'a mut W {
223        self.w.bits = (self.w.bits & !(0xffff << 10)) | ((value as u32 & 0xffff) << 10);
224        self.w
225    }
226}
227#[doc = "Field `MREQ` reader - to select an external mreq value."]
228pub struct MREQ_R(crate::FieldReader<bool, bool>);
229impl MREQ_R {
230    #[inline(always)]
231    pub(crate) fn new(bits: bool) -> Self {
232        MREQ_R(crate::FieldReader::new(bits))
233    }
234}
235impl core::ops::Deref for MREQ_R {
236    type Target = crate::FieldReader<bool, bool>;
237    #[inline(always)]
238    fn deref(&self) -> &Self::Target {
239        &self.0
240    }
241}
242#[doc = "Field `MREQ` writer - to select an external mreq value."]
243pub struct MREQ_W<'a> {
244    w: &'a mut W,
245}
246impl<'a> MREQ_W<'a> {
247    #[doc = r"Sets the field bit"]
248    #[inline(always)]
249    pub fn set_bit(self) -> &'a mut W {
250        self.bit(true)
251    }
252    #[doc = r"Clears the field bit"]
253    #[inline(always)]
254    pub fn clear_bit(self) -> &'a mut W {
255        self.bit(false)
256    }
257    #[doc = r"Writes raw bits to the field"]
258    #[inline(always)]
259    pub fn bit(self, value: bool) -> &'a mut W {
260        self.w.bits = (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26);
261        self.w
262    }
263}
264#[doc = "Field `DITHER` reader - dithering between two modulation frequencies in a random way or in a pseudo random way (white noise), in order to decrease the probability that the modulated waveform will occur with the same phase on a particular point on the screen."]
265pub struct DITHER_R(crate::FieldReader<bool, bool>);
266impl DITHER_R {
267    #[inline(always)]
268    pub(crate) fn new(bits: bool) -> Self {
269        DITHER_R(crate::FieldReader::new(bits))
270    }
271}
272impl core::ops::Deref for DITHER_R {
273    type Target = crate::FieldReader<bool, bool>;
274    #[inline(always)]
275    fn deref(&self) -> &Self::Target {
276        &self.0
277    }
278}
279#[doc = "Field `DITHER` writer - dithering between two modulation frequencies in a random way or in a pseudo random way (white noise), in order to decrease the probability that the modulated waveform will occur with the same phase on a particular point on the screen."]
280pub struct DITHER_W<'a> {
281    w: &'a mut W,
282}
283impl<'a> DITHER_W<'a> {
284    #[doc = r"Sets the field bit"]
285    #[inline(always)]
286    pub fn set_bit(self) -> &'a mut W {
287        self.bit(true)
288    }
289    #[doc = r"Clears the field bit"]
290    #[inline(always)]
291    pub fn clear_bit(self) -> &'a mut W {
292        self.bit(false)
293    }
294    #[doc = r"Writes raw bits to the field"]
295    #[inline(always)]
296    pub fn bit(self, value: bool) -> &'a mut W {
297        self.w.bits = (self.w.bits & !(0x01 << 27)) | ((value as u32 & 0x01) << 27);
298        self.w
299    }
300}
301#[doc = "Field `SEL_EXT` reader - to select mdiv_ext and mreq_ext sel_ext = 0: mdiv ~ md\\[32:0\\], mreq = 1 sel_ext = 1 : mdiv = mdiv_ext, mreq = mreq_ext."]
302pub struct SEL_EXT_R(crate::FieldReader<bool, bool>);
303impl SEL_EXT_R {
304    #[inline(always)]
305    pub(crate) fn new(bits: bool) -> Self {
306        SEL_EXT_R(crate::FieldReader::new(bits))
307    }
308}
309impl core::ops::Deref for SEL_EXT_R {
310    type Target = crate::FieldReader<bool, bool>;
311    #[inline(always)]
312    fn deref(&self) -> &Self::Target {
313        &self.0
314    }
315}
316#[doc = "Field `SEL_EXT` writer - to select mdiv_ext and mreq_ext sel_ext = 0: mdiv ~ md\\[32:0\\], mreq = 1 sel_ext = 1 : mdiv = mdiv_ext, mreq = mreq_ext."]
317pub struct SEL_EXT_W<'a> {
318    w: &'a mut W,
319}
320impl<'a> SEL_EXT_W<'a> {
321    #[doc = r"Sets the field bit"]
322    #[inline(always)]
323    pub fn set_bit(self) -> &'a mut W {
324        self.bit(true)
325    }
326    #[doc = r"Clears the field bit"]
327    #[inline(always)]
328    pub fn clear_bit(self) -> &'a mut W {
329        self.bit(false)
330    }
331    #[doc = r"Writes raw bits to the field"]
332    #[inline(always)]
333    pub fn bit(self, value: bool) -> &'a mut W {
334        self.w.bits = (self.w.bits & !(0x01 << 28)) | ((value as u32 & 0x01) << 28);
335        self.w
336    }
337}
338impl R {
339    #[doc = "Bit 0 - input word of the wrapper bit 32."]
340    #[inline(always)]
341    pub fn md_mbs(&self) -> MD_MBS_R {
342        MD_MBS_R::new((self.bits & 0x01) != 0)
343    }
344    #[doc = "Bit 1 - md change request."]
345    #[inline(always)]
346    pub fn md_req(&self) -> MD_REQ_R {
347        MD_REQ_R::new(((self.bits >> 1) & 0x01) != 0)
348    }
349    #[doc = "Bits 2:4 - programmable modulation frequency fm = Fref/Nss mf\\[2:0\\]
350= 000 => Nss=512 (fm ~ 3."]
351    #[inline(always)]
352    pub fn mf(&self) -> MF_R {
353        MF_R::new(((self.bits >> 2) & 0x07) as u8)
354    }
355    #[doc = "Bits 5:7 - programmable frequency modulation depth Dfmodpk-pk = Fref*kss/Fcco = kss/(2*md\\[32:25\\]dec) mr\\[2:0\\]
356= 000 => kss = 0 (no spread spectrum) mr\\[2:0\\]
357= 001 => kss ~ 1 mr\\[2:0\\]
358= 010 => kss ~ 1."]
359    #[inline(always)]
360    pub fn mr(&self) -> MR_R {
361        MR_R::new(((self.bits >> 5) & 0x07) as u8)
362    }
363    #[doc = "Bits 8:9 - modulation waveform control Compensation for low pass filtering of the PLL to get a triangular modulation at the output of the PLL, giving a flat frequency spectrum."]
364    #[inline(always)]
365    pub fn mc(&self) -> MC_R {
366        MC_R::new(((self.bits >> 8) & 0x03) as u8)
367    }
368    #[doc = "Bits 10:25 - to select an external mdiv value."]
369    #[inline(always)]
370    pub fn mdiv_ext(&self) -> MDIV_EXT_R {
371        MDIV_EXT_R::new(((self.bits >> 10) & 0xffff) as u16)
372    }
373    #[doc = "Bit 26 - to select an external mreq value."]
374    #[inline(always)]
375    pub fn mreq(&self) -> MREQ_R {
376        MREQ_R::new(((self.bits >> 26) & 0x01) != 0)
377    }
378    #[doc = "Bit 27 - dithering between two modulation frequencies in a random way or in a pseudo random way (white noise), in order to decrease the probability that the modulated waveform will occur with the same phase on a particular point on the screen."]
379    #[inline(always)]
380    pub fn dither(&self) -> DITHER_R {
381        DITHER_R::new(((self.bits >> 27) & 0x01) != 0)
382    }
383    #[doc = "Bit 28 - to select mdiv_ext and mreq_ext sel_ext = 0: mdiv ~ md\\[32:0\\], mreq = 1 sel_ext = 1 : mdiv = mdiv_ext, mreq = mreq_ext."]
384    #[inline(always)]
385    pub fn sel_ext(&self) -> SEL_EXT_R {
386        SEL_EXT_R::new(((self.bits >> 28) & 0x01) != 0)
387    }
388}
389impl W {
390    #[doc = "Bit 0 - input word of the wrapper bit 32."]
391    #[inline(always)]
392    pub fn md_mbs(&mut self) -> MD_MBS_W {
393        MD_MBS_W { w: self }
394    }
395    #[doc = "Bit 1 - md change request."]
396    #[inline(always)]
397    pub fn md_req(&mut self) -> MD_REQ_W {
398        MD_REQ_W { w: self }
399    }
400    #[doc = "Bits 2:4 - programmable modulation frequency fm = Fref/Nss mf\\[2:0\\]
401= 000 => Nss=512 (fm ~ 3."]
402    #[inline(always)]
403    pub fn mf(&mut self) -> MF_W {
404        MF_W { w: self }
405    }
406    #[doc = "Bits 5:7 - programmable frequency modulation depth Dfmodpk-pk = Fref*kss/Fcco = kss/(2*md\\[32:25\\]dec) mr\\[2:0\\]
407= 000 => kss = 0 (no spread spectrum) mr\\[2:0\\]
408= 001 => kss ~ 1 mr\\[2:0\\]
409= 010 => kss ~ 1."]
410    #[inline(always)]
411    pub fn mr(&mut self) -> MR_W {
412        MR_W { w: self }
413    }
414    #[doc = "Bits 8:9 - modulation waveform control Compensation for low pass filtering of the PLL to get a triangular modulation at the output of the PLL, giving a flat frequency spectrum."]
415    #[inline(always)]
416    pub fn mc(&mut self) -> MC_W {
417        MC_W { w: self }
418    }
419    #[doc = "Bits 10:25 - to select an external mdiv value."]
420    #[inline(always)]
421    pub fn mdiv_ext(&mut self) -> MDIV_EXT_W {
422        MDIV_EXT_W { w: self }
423    }
424    #[doc = "Bit 26 - to select an external mreq value."]
425    #[inline(always)]
426    pub fn mreq(&mut self) -> MREQ_W {
427        MREQ_W { w: self }
428    }
429    #[doc = "Bit 27 - dithering between two modulation frequencies in a random way or in a pseudo random way (white noise), in order to decrease the probability that the modulated waveform will occur with the same phase on a particular point on the screen."]
430    #[inline(always)]
431    pub fn dither(&mut self) -> DITHER_W {
432        DITHER_W { w: self }
433    }
434    #[doc = "Bit 28 - to select mdiv_ext and mreq_ext sel_ext = 0: mdiv ~ md\\[32:0\\], mreq = 1 sel_ext = 1 : mdiv = mdiv_ext, mreq = mreq_ext."]
435    #[inline(always)]
436    pub fn sel_ext(&mut self) -> SEL_EXT_W {
437        SEL_EXT_W { w: self }
438    }
439    #[doc = "Writes raw bits to the register."]
440    #[inline(always)]
441    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
442        self.0.bits(bits);
443        self
444    }
445}
446#[doc = "PLL0 Spread Spectrum Wrapper control register 1\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 [pll0sscg1](index.html) module"]
447pub struct PLL0SSCG1_SPEC;
448impl crate::RegisterSpec for PLL0SSCG1_SPEC {
449    type Ux = u32;
450}
451#[doc = "`read()` method returns [pll0sscg1::R](R) reader structure"]
452impl crate::Readable for PLL0SSCG1_SPEC {
453    type Reader = R;
454}
455#[doc = "`write(|w| ..)` method takes [pll0sscg1::W](W) writer structure"]
456impl crate::Writable for PLL0SSCG1_SPEC {
457    type Writer = W;
458}
459#[doc = "`reset()` method sets PLL0SSCG1 to value 0"]
460impl crate::Resettable for PLL0SSCG1_SPEC {
461    #[inline(always)]
462    fn reset_value() -> Self::Ux {
463        0
464    }
465}