stm32f1_staging/stm32f107/rcc/
cr.rs1pub type R = crate::R<CRrs>;
3pub type W = crate::W<CRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum HSION {
11 Off = 0,
13 On = 1,
15}
16impl From<HSION> for bool {
17 #[inline(always)]
18 fn from(variant: HSION) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type HSION_R = crate::BitReader<HSION>;
24impl HSION_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> HSION {
28 match self.bits {
29 false => HSION::Off,
30 true => HSION::On,
31 }
32 }
33 #[inline(always)]
35 pub fn is_off(&self) -> bool {
36 *self == HSION::Off
37 }
38 #[inline(always)]
40 pub fn is_on(&self) -> bool {
41 *self == HSION::On
42 }
43}
44pub type HSION_W<'a, REG> = crate::BitWriter<'a, REG, HSION>;
46impl<'a, REG> HSION_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn off(self) -> &'a mut crate::W<REG> {
53 self.variant(HSION::Off)
54 }
55 #[inline(always)]
57 pub fn on(self) -> &'a mut crate::W<REG> {
58 self.variant(HSION::On)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum HSIRDYR {
67 NotReady = 0,
69 Ready = 1,
71}
72impl From<HSIRDYR> for bool {
73 #[inline(always)]
74 fn from(variant: HSIRDYR) -> Self {
75 variant as u8 != 0
76 }
77}
78pub type HSIRDY_R = crate::BitReader<HSIRDYR>;
80impl HSIRDY_R {
81 #[inline(always)]
83 pub const fn variant(&self) -> HSIRDYR {
84 match self.bits {
85 false => HSIRDYR::NotReady,
86 true => HSIRDYR::Ready,
87 }
88 }
89 #[inline(always)]
91 pub fn is_not_ready(&self) -> bool {
92 *self == HSIRDYR::NotReady
93 }
94 #[inline(always)]
96 pub fn is_ready(&self) -> bool {
97 *self == HSIRDYR::Ready
98 }
99}
100pub type HSITRIM_R = crate::FieldReader;
102pub type HSITRIM_W<'a, REG> = crate::FieldWriter<'a, REG, 5, u8, crate::Safe>;
104pub type HSICAL_R = crate::FieldReader;
106pub use HSION_R as HSEON_R;
108pub use HSION_W as HSEON_W;
110pub use HSIRDY_R as HSERDY_R;
112#[cfg_attr(feature = "defmt", derive(defmt::Format))]
116#[derive(Clone, Copy, Debug, PartialEq, Eq)]
117pub enum HSEBYP {
118 NotBypassed = 0,
120 Bypassed = 1,
122}
123impl From<HSEBYP> for bool {
124 #[inline(always)]
125 fn from(variant: HSEBYP) -> Self {
126 variant as u8 != 0
127 }
128}
129pub type HSEBYP_R = crate::BitReader<HSEBYP>;
131impl HSEBYP_R {
132 #[inline(always)]
134 pub const fn variant(&self) -> HSEBYP {
135 match self.bits {
136 false => HSEBYP::NotBypassed,
137 true => HSEBYP::Bypassed,
138 }
139 }
140 #[inline(always)]
142 pub fn is_not_bypassed(&self) -> bool {
143 *self == HSEBYP::NotBypassed
144 }
145 #[inline(always)]
147 pub fn is_bypassed(&self) -> bool {
148 *self == HSEBYP::Bypassed
149 }
150}
151pub type HSEBYP_W<'a, REG> = crate::BitWriter<'a, REG, HSEBYP>;
153impl<'a, REG> HSEBYP_W<'a, REG>
154where
155 REG: crate::Writable + crate::RegisterSpec,
156{
157 #[inline(always)]
159 pub fn not_bypassed(self) -> &'a mut crate::W<REG> {
160 self.variant(HSEBYP::NotBypassed)
161 }
162 #[inline(always)]
164 pub fn bypassed(self) -> &'a mut crate::W<REG> {
165 self.variant(HSEBYP::Bypassed)
166 }
167}
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
172#[derive(Clone, Copy, Debug, PartialEq, Eq)]
173pub enum CSSON {
174 Off = 0,
176 On = 1,
178}
179impl From<CSSON> for bool {
180 #[inline(always)]
181 fn from(variant: CSSON) -> Self {
182 variant as u8 != 0
183 }
184}
185pub type CSSON_R = crate::BitReader<CSSON>;
187impl CSSON_R {
188 #[inline(always)]
190 pub const fn variant(&self) -> CSSON {
191 match self.bits {
192 false => CSSON::Off,
193 true => CSSON::On,
194 }
195 }
196 #[inline(always)]
198 pub fn is_off(&self) -> bool {
199 *self == CSSON::Off
200 }
201 #[inline(always)]
203 pub fn is_on(&self) -> bool {
204 *self == CSSON::On
205 }
206}
207pub type CSSON_W<'a, REG> = crate::BitWriter<'a, REG, CSSON>;
209impl<'a, REG> CSSON_W<'a, REG>
210where
211 REG: crate::Writable + crate::RegisterSpec,
212{
213 #[inline(always)]
215 pub fn off(self) -> &'a mut crate::W<REG> {
216 self.variant(CSSON::Off)
217 }
218 #[inline(always)]
220 pub fn on(self) -> &'a mut crate::W<REG> {
221 self.variant(CSSON::On)
222 }
223}
224pub use HSION_R as PLLON_R;
226pub use HSION_W as PLLON_W;
228pub use HSIRDY_R as PLLRDY_R;
230pub type PLL2ON_R = crate::BitReader;
232pub type PLL2ON_W<'a, REG> = crate::BitWriter<'a, REG>;
234pub use HSIRDY_R as PLL2RDY_R;
236pub type PLL3ON_R = crate::BitReader;
238pub type PLL3ON_W<'a, REG> = crate::BitWriter<'a, REG>;
240pub use HSIRDY_R as PLL3RDY_R;
242impl R {
243 #[inline(always)]
245 pub fn hsion(&self) -> HSION_R {
246 HSION_R::new((self.bits & 1) != 0)
247 }
248 #[inline(always)]
250 pub fn hsirdy(&self) -> HSIRDY_R {
251 HSIRDY_R::new(((self.bits >> 1) & 1) != 0)
252 }
253 #[inline(always)]
255 pub fn hsitrim(&self) -> HSITRIM_R {
256 HSITRIM_R::new(((self.bits >> 3) & 0x1f) as u8)
257 }
258 #[inline(always)]
260 pub fn hsical(&self) -> HSICAL_R {
261 HSICAL_R::new(((self.bits >> 8) & 0xff) as u8)
262 }
263 #[inline(always)]
265 pub fn hseon(&self) -> HSEON_R {
266 HSEON_R::new(((self.bits >> 16) & 1) != 0)
267 }
268 #[inline(always)]
270 pub fn hserdy(&self) -> HSERDY_R {
271 HSERDY_R::new(((self.bits >> 17) & 1) != 0)
272 }
273 #[inline(always)]
275 pub fn hsebyp(&self) -> HSEBYP_R {
276 HSEBYP_R::new(((self.bits >> 18) & 1) != 0)
277 }
278 #[inline(always)]
280 pub fn csson(&self) -> CSSON_R {
281 CSSON_R::new(((self.bits >> 19) & 1) != 0)
282 }
283 #[inline(always)]
285 pub fn pllon(&self) -> PLLON_R {
286 PLLON_R::new(((self.bits >> 24) & 1) != 0)
287 }
288 #[inline(always)]
290 pub fn pllrdy(&self) -> PLLRDY_R {
291 PLLRDY_R::new(((self.bits >> 25) & 1) != 0)
292 }
293 #[inline(always)]
295 pub fn pll2on(&self) -> PLL2ON_R {
296 PLL2ON_R::new(((self.bits >> 26) & 1) != 0)
297 }
298 #[inline(always)]
300 pub fn pll2rdy(&self) -> PLL2RDY_R {
301 PLL2RDY_R::new(((self.bits >> 27) & 1) != 0)
302 }
303 #[inline(always)]
305 pub fn pll3on(&self) -> PLL3ON_R {
306 PLL3ON_R::new(((self.bits >> 28) & 1) != 0)
307 }
308 #[inline(always)]
310 pub fn pll3rdy(&self) -> PLL3RDY_R {
311 PLL3RDY_R::new(((self.bits >> 29) & 1) != 0)
312 }
313}
314impl core::fmt::Debug for R {
315 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
316 f.debug_struct("CR")
317 .field("hsion", &self.hsion())
318 .field("hsirdy", &self.hsirdy())
319 .field("hsitrim", &self.hsitrim())
320 .field("hsical", &self.hsical())
321 .field("hseon", &self.hseon())
322 .field("hserdy", &self.hserdy())
323 .field("hsebyp", &self.hsebyp())
324 .field("csson", &self.csson())
325 .field("pllon", &self.pllon())
326 .field("pllrdy", &self.pllrdy())
327 .field("pll2on", &self.pll2on())
328 .field("pll2rdy", &self.pll2rdy())
329 .field("pll3on", &self.pll3on())
330 .field("pll3rdy", &self.pll3rdy())
331 .finish()
332 }
333}
334impl W {
335 #[inline(always)]
337 pub fn hsion(&mut self) -> HSION_W<CRrs> {
338 HSION_W::new(self, 0)
339 }
340 #[inline(always)]
342 pub fn hsitrim(&mut self) -> HSITRIM_W<CRrs> {
343 HSITRIM_W::new(self, 3)
344 }
345 #[inline(always)]
347 pub fn hseon(&mut self) -> HSEON_W<CRrs> {
348 HSEON_W::new(self, 16)
349 }
350 #[inline(always)]
352 pub fn hsebyp(&mut self) -> HSEBYP_W<CRrs> {
353 HSEBYP_W::new(self, 18)
354 }
355 #[inline(always)]
357 pub fn csson(&mut self) -> CSSON_W<CRrs> {
358 CSSON_W::new(self, 19)
359 }
360 #[inline(always)]
362 pub fn pllon(&mut self) -> PLLON_W<CRrs> {
363 PLLON_W::new(self, 24)
364 }
365 #[inline(always)]
367 pub fn pll2on(&mut self) -> PLL2ON_W<CRrs> {
368 PLL2ON_W::new(self, 26)
369 }
370 #[inline(always)]
372 pub fn pll3on(&mut self) -> PLL3ON_W<CRrs> {
373 PLL3ON_W::new(self, 28)
374 }
375}
376pub struct CRrs;
382impl crate::RegisterSpec for CRrs {
383 type Ux = u32;
384}
385impl crate::Readable for CRrs {}
387impl crate::Writable for CRrs {
389 type Safety = crate::Unsafe;
390}
391impl crate::Resettable for CRrs {
393 const RESET_VALUE: u32 = 0x83;
394}