stm32f7_staging/stm32f779/rcc/
pllcfgr.rs1pub type R = crate::R<PLLCFGRrs>;
3pub type W = crate::W<PLLCFGRrs>;
5pub type PLLM_R = crate::FieldReader;
7pub type PLLM_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
9pub type PLLN_R = crate::FieldReader<u16>;
11pub type PLLN_W<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
13#[cfg_attr(feature = "defmt", derive(defmt::Format))]
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18#[repr(u8)]
19pub enum PLLP {
20 Div2 = 0,
22 Div4 = 1,
24 Div6 = 2,
26 Div8 = 3,
28}
29impl From<PLLP> for u8 {
30 #[inline(always)]
31 fn from(variant: PLLP) -> Self {
32 variant as _
33 }
34}
35impl crate::FieldSpec for PLLP {
36 type Ux = u8;
37}
38impl crate::IsEnum for PLLP {}
39pub type PLLP_R = crate::FieldReader<PLLP>;
41impl PLLP_R {
42 #[inline(always)]
44 pub const fn variant(&self) -> PLLP {
45 match self.bits {
46 0 => PLLP::Div2,
47 1 => PLLP::Div4,
48 2 => PLLP::Div6,
49 3 => PLLP::Div8,
50 _ => unreachable!(),
51 }
52 }
53 #[inline(always)]
55 pub fn is_div2(&self) -> bool {
56 *self == PLLP::Div2
57 }
58 #[inline(always)]
60 pub fn is_div4(&self) -> bool {
61 *self == PLLP::Div4
62 }
63 #[inline(always)]
65 pub fn is_div6(&self) -> bool {
66 *self == PLLP::Div6
67 }
68 #[inline(always)]
70 pub fn is_div8(&self) -> bool {
71 *self == PLLP::Div8
72 }
73}
74pub type PLLP_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PLLP, crate::Safe>;
76impl<'a, REG> PLLP_W<'a, REG>
77where
78 REG: crate::Writable + crate::RegisterSpec,
79 REG::Ux: From<u8>,
80{
81 #[inline(always)]
83 pub fn div2(self) -> &'a mut crate::W<REG> {
84 self.variant(PLLP::Div2)
85 }
86 #[inline(always)]
88 pub fn div4(self) -> &'a mut crate::W<REG> {
89 self.variant(PLLP::Div4)
90 }
91 #[inline(always)]
93 pub fn div6(self) -> &'a mut crate::W<REG> {
94 self.variant(PLLP::Div6)
95 }
96 #[inline(always)]
98 pub fn div8(self) -> &'a mut crate::W<REG> {
99 self.variant(PLLP::Div8)
100 }
101}
102#[cfg_attr(feature = "defmt", derive(defmt::Format))]
106#[derive(Clone, Copy, Debug, PartialEq, Eq)]
107pub enum PLLSRC {
108 Hsi = 0,
110 Hse = 1,
112}
113impl From<PLLSRC> for bool {
114 #[inline(always)]
115 fn from(variant: PLLSRC) -> Self {
116 variant as u8 != 0
117 }
118}
119pub type PLLSRC_R = crate::BitReader<PLLSRC>;
121impl PLLSRC_R {
122 #[inline(always)]
124 pub const fn variant(&self) -> PLLSRC {
125 match self.bits {
126 false => PLLSRC::Hsi,
127 true => PLLSRC::Hse,
128 }
129 }
130 #[inline(always)]
132 pub fn is_hsi(&self) -> bool {
133 *self == PLLSRC::Hsi
134 }
135 #[inline(always)]
137 pub fn is_hse(&self) -> bool {
138 *self == PLLSRC::Hse
139 }
140}
141pub type PLLSRC_W<'a, REG> = crate::BitWriter<'a, REG, PLLSRC>;
143impl<'a, REG> PLLSRC_W<'a, REG>
144where
145 REG: crate::Writable + crate::RegisterSpec,
146{
147 #[inline(always)]
149 pub fn hsi(self) -> &'a mut crate::W<REG> {
150 self.variant(PLLSRC::Hsi)
151 }
152 #[inline(always)]
154 pub fn hse(self) -> &'a mut crate::W<REG> {
155 self.variant(PLLSRC::Hse)
156 }
157}
158pub type PLLQ_R = crate::FieldReader;
160pub type PLLQ_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
162pub type PLLR_R = crate::FieldReader;
164pub type PLLR_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
166impl R {
167 #[inline(always)]
169 pub fn pllm(&self) -> PLLM_R {
170 PLLM_R::new((self.bits & 0x3f) as u8)
171 }
172 #[inline(always)]
174 pub fn plln(&self) -> PLLN_R {
175 PLLN_R::new(((self.bits >> 6) & 0x01ff) as u16)
176 }
177 #[inline(always)]
179 pub fn pllp(&self) -> PLLP_R {
180 PLLP_R::new(((self.bits >> 16) & 3) as u8)
181 }
182 #[inline(always)]
184 pub fn pllsrc(&self) -> PLLSRC_R {
185 PLLSRC_R::new(((self.bits >> 22) & 1) != 0)
186 }
187 #[inline(always)]
189 pub fn pllq(&self) -> PLLQ_R {
190 PLLQ_R::new(((self.bits >> 24) & 0x0f) as u8)
191 }
192 #[inline(always)]
194 pub fn pllr(&self) -> PLLR_R {
195 PLLR_R::new(((self.bits >> 28) & 7) as u8)
196 }
197}
198impl core::fmt::Debug for R {
199 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
200 f.debug_struct("PLLCFGR")
201 .field("pllq", &self.pllq())
202 .field("pllsrc", &self.pllsrc())
203 .field("pllp", &self.pllp())
204 .field("plln", &self.plln())
205 .field("pllm", &self.pllm())
206 .field("pllr", &self.pllr())
207 .finish()
208 }
209}
210impl W {
211 #[inline(always)]
213 pub fn pllm(&mut self) -> PLLM_W<PLLCFGRrs> {
214 PLLM_W::new(self, 0)
215 }
216 #[inline(always)]
218 pub fn plln(&mut self) -> PLLN_W<PLLCFGRrs> {
219 PLLN_W::new(self, 6)
220 }
221 #[inline(always)]
223 pub fn pllp(&mut self) -> PLLP_W<PLLCFGRrs> {
224 PLLP_W::new(self, 16)
225 }
226 #[inline(always)]
228 pub fn pllsrc(&mut self) -> PLLSRC_W<PLLCFGRrs> {
229 PLLSRC_W::new(self, 22)
230 }
231 #[inline(always)]
233 pub fn pllq(&mut self) -> PLLQ_W<PLLCFGRrs> {
234 PLLQ_W::new(self, 24)
235 }
236 #[inline(always)]
238 pub fn pllr(&mut self) -> PLLR_W<PLLCFGRrs> {
239 PLLR_W::new(self, 28)
240 }
241}
242pub struct PLLCFGRrs;
248impl crate::RegisterSpec for PLLCFGRrs {
249 type Ux = u32;
250}
251impl crate::Readable for PLLCFGRrs {}
253impl crate::Writable for PLLCFGRrs {
255 type Safety = crate::Unsafe;
256 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
257 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
258}
259impl crate::Resettable for PLLCFGRrs {
261 const RESET_VALUE: u32 = 0x2400_3010;
262}