lpc845_pac/syscon/
syspllclkuen.rs

1#[doc = "Register `SYSPLLCLKUEN` reader"]
2pub struct R(crate::R<SYSPLLCLKUEN_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SYSPLLCLKUEN_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SYSPLLCLKUEN_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SYSPLLCLKUEN_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SYSPLLCLKUEN` writer"]
17pub struct W(crate::W<SYSPLLCLKUEN_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SYSPLLCLKUEN_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<SYSPLLCLKUEN_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SYSPLLCLKUEN_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Enable system PLL clock source update\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum ENA_A {
40    #[doc = "0: no change"]
41    NO_CHANGE = 0,
42    #[doc = "1: update clock source"]
43    UPDATED = 1,
44}
45impl From<ENA_A> for bool {
46    #[inline(always)]
47    fn from(variant: ENA_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `ENA` reader - Enable system PLL clock source update"]
52pub struct ENA_R(crate::FieldReader<bool, ENA_A>);
53impl ENA_R {
54    pub(crate) fn new(bits: bool) -> Self {
55        ENA_R(crate::FieldReader::new(bits))
56    }
57    #[doc = r"Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> ENA_A {
60        match self.bits {
61            false => ENA_A::NO_CHANGE,
62            true => ENA_A::UPDATED,
63        }
64    }
65    #[doc = "Checks if the value of the field is `NO_CHANGE`"]
66    #[inline(always)]
67    pub fn is_no_change(&self) -> bool {
68        **self == ENA_A::NO_CHANGE
69    }
70    #[doc = "Checks if the value of the field is `UPDATED`"]
71    #[inline(always)]
72    pub fn is_updated(&self) -> bool {
73        **self == ENA_A::UPDATED
74    }
75}
76impl core::ops::Deref for ENA_R {
77    type Target = crate::FieldReader<bool, ENA_A>;
78    #[inline(always)]
79    fn deref(&self) -> &Self::Target {
80        &self.0
81    }
82}
83#[doc = "Field `ENA` writer - Enable system PLL clock source update"]
84pub struct ENA_W<'a> {
85    w: &'a mut W,
86}
87impl<'a> ENA_W<'a> {
88    #[doc = r"Writes `variant` to the field"]
89    #[inline(always)]
90    pub fn variant(self, variant: ENA_A) -> &'a mut W {
91        self.bit(variant.into())
92    }
93    #[doc = "no change"]
94    #[inline(always)]
95    pub fn no_change(self) -> &'a mut W {
96        self.variant(ENA_A::NO_CHANGE)
97    }
98    #[doc = "update clock source"]
99    #[inline(always)]
100    pub fn updated(self) -> &'a mut W {
101        self.variant(ENA_A::UPDATED)
102    }
103    #[doc = r"Sets the field bit"]
104    #[inline(always)]
105    pub fn set_bit(self) -> &'a mut W {
106        self.bit(true)
107    }
108    #[doc = r"Clears the field bit"]
109    #[inline(always)]
110    pub fn clear_bit(self) -> &'a mut W {
111        self.bit(false)
112    }
113    #[doc = r"Writes raw bits to the field"]
114    #[inline(always)]
115    pub fn bit(self, value: bool) -> &'a mut W {
116        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
117        self.w
118    }
119}
120impl R {
121    #[doc = "Bit 0 - Enable system PLL clock source update"]
122    #[inline(always)]
123    pub fn ena(&self) -> ENA_R {
124        ENA_R::new((self.bits & 0x01) != 0)
125    }
126}
127impl W {
128    #[doc = "Bit 0 - Enable system PLL clock source update"]
129    #[inline(always)]
130    pub fn ena(&mut self) -> ENA_W {
131        ENA_W { w: self }
132    }
133    #[doc = "Writes raw bits to the register."]
134    #[inline(always)]
135    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
136        self.0.bits(bits);
137        self
138    }
139}
140#[doc = "System PLL clock source update enable register\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 [syspllclkuen](index.html) module"]
141pub struct SYSPLLCLKUEN_SPEC;
142impl crate::RegisterSpec for SYSPLLCLKUEN_SPEC {
143    type Ux = u32;
144}
145#[doc = "`read()` method returns [syspllclkuen::R](R) reader structure"]
146impl crate::Readable for SYSPLLCLKUEN_SPEC {
147    type Reader = R;
148}
149#[doc = "`write(|w| ..)` method takes [syspllclkuen::W](W) writer structure"]
150impl crate::Writable for SYSPLLCLKUEN_SPEC {
151    type Writer = W;
152}
153#[doc = "`reset()` method sets SYSPLLCLKUEN to value 0"]
154impl crate::Resettable for SYSPLLCLKUEN_SPEC {
155    #[inline(always)]
156    fn reset_value() -> Self::Ux {
157        0
158    }
159}