lpc845_pac/syscon/
mainclkpllsel.rs1#[doc = "Register `MAINCLKPLLSEL` reader"]
2pub struct R(crate::R<MAINCLKPLLSEL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<MAINCLKPLLSEL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<MAINCLKPLLSEL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<MAINCLKPLLSEL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `MAINCLKPLLSEL` writer"]
17pub struct W(crate::W<MAINCLKPLLSEL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<MAINCLKPLLSEL_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<MAINCLKPLLSEL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<MAINCLKPLLSEL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "System PLL clock source\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SEL_A {
41 #[doc = "0: main_clk_pre_pll"]
42 MAIN_CLK_PRE_PLL = 0,
43 #[doc = "1: sys pll"]
44 SYS_PLL = 1,
45 #[doc = "2: none"]
46 SEL_2 = 2,
47 #[doc = "3: none"]
48 SEL_3 = 3,
49}
50impl From<SEL_A> for u8 {
51 #[inline(always)]
52 fn from(variant: SEL_A) -> Self {
53 variant as _
54 }
55}
56#[doc = "Field `SEL` reader - System PLL clock source"]
57pub struct SEL_R(crate::FieldReader<u8, SEL_A>);
58impl SEL_R {
59 pub(crate) fn new(bits: u8) -> Self {
60 SEL_R(crate::FieldReader::new(bits))
61 }
62 #[doc = r"Get enumerated values variant"]
63 #[inline(always)]
64 pub fn variant(&self) -> SEL_A {
65 match self.bits {
66 0 => SEL_A::MAIN_CLK_PRE_PLL,
67 1 => SEL_A::SYS_PLL,
68 2 => SEL_A::SEL_2,
69 3 => SEL_A::SEL_3,
70 _ => unreachable!(),
71 }
72 }
73 #[doc = "Checks if the value of the field is `MAIN_CLK_PRE_PLL`"]
74 #[inline(always)]
75 pub fn is_main_clk_pre_pll(&self) -> bool {
76 **self == SEL_A::MAIN_CLK_PRE_PLL
77 }
78 #[doc = "Checks if the value of the field is `SYS_PLL`"]
79 #[inline(always)]
80 pub fn is_sys_pll(&self) -> bool {
81 **self == SEL_A::SYS_PLL
82 }
83 #[doc = "Checks if the value of the field is `SEL_2`"]
84 #[inline(always)]
85 pub fn is_sel_2(&self) -> bool {
86 **self == SEL_A::SEL_2
87 }
88 #[doc = "Checks if the value of the field is `SEL_3`"]
89 #[inline(always)]
90 pub fn is_sel_3(&self) -> bool {
91 **self == SEL_A::SEL_3
92 }
93}
94impl core::ops::Deref for SEL_R {
95 type Target = crate::FieldReader<u8, SEL_A>;
96 #[inline(always)]
97 fn deref(&self) -> &Self::Target {
98 &self.0
99 }
100}
101#[doc = "Field `SEL` writer - System PLL clock source"]
102pub struct SEL_W<'a> {
103 w: &'a mut W,
104}
105impl<'a> SEL_W<'a> {
106 #[doc = r"Writes `variant` to the field"]
107 #[inline(always)]
108 pub fn variant(self, variant: SEL_A) -> &'a mut W {
109 self.bits(variant.into())
110 }
111 #[doc = "main_clk_pre_pll"]
112 #[inline(always)]
113 pub fn main_clk_pre_pll(self) -> &'a mut W {
114 self.variant(SEL_A::MAIN_CLK_PRE_PLL)
115 }
116 #[doc = "sys pll"]
117 #[inline(always)]
118 pub fn sys_pll(self) -> &'a mut W {
119 self.variant(SEL_A::SYS_PLL)
120 }
121 #[doc = "none"]
122 #[inline(always)]
123 pub fn sel_2(self) -> &'a mut W {
124 self.variant(SEL_A::SEL_2)
125 }
126 #[doc = "none"]
127 #[inline(always)]
128 pub fn sel_3(self) -> &'a mut W {
129 self.variant(SEL_A::SEL_3)
130 }
131 #[doc = r"Writes raw bits to the field"]
132 #[inline(always)]
133 pub fn bits(self, value: u8) -> &'a mut W {
134 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
135 self.w
136 }
137}
138impl R {
139 #[doc = "Bits 0:1 - System PLL clock source"]
140 #[inline(always)]
141 pub fn sel(&self) -> SEL_R {
142 SEL_R::new((self.bits & 0x03) as u8)
143 }
144}
145impl W {
146 #[doc = "Bits 0:1 - System PLL clock source"]
147 #[inline(always)]
148 pub fn sel(&mut self) -> SEL_W {
149 SEL_W { w: self }
150 }
151 #[doc = "Writes raw bits to the register."]
152 #[inline(always)]
153 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
154 self.0.bits(bits);
155 self
156 }
157}
158#[doc = "Main clock source select 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 [mainclkpllsel](index.html) module"]
159pub struct MAINCLKPLLSEL_SPEC;
160impl crate::RegisterSpec for MAINCLKPLLSEL_SPEC {
161 type Ux = u32;
162}
163#[doc = "`read()` method returns [mainclkpllsel::R](R) reader structure"]
164impl crate::Readable for MAINCLKPLLSEL_SPEC {
165 type Reader = R;
166}
167#[doc = "`write(|w| ..)` method takes [mainclkpllsel::W](W) writer structure"]
168impl crate::Writable for MAINCLKPLLSEL_SPEC {
169 type Writer = W;
170}
171#[doc = "`reset()` method sets MAINCLKPLLSEL to value 0"]
172impl crate::Resettable for MAINCLKPLLSEL_SPEC {
173 #[inline(always)]
174 fn reset_value() -> Self::Ux {
175 0
176 }
177}