stm32f1/stm32f103/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;
230impl R {
231 #[inline(always)]
233 pub fn hsion(&self) -> HSION_R {
234 HSION_R::new((self.bits & 1) != 0)
235 }
236 #[inline(always)]
238 pub fn hsirdy(&self) -> HSIRDY_R {
239 HSIRDY_R::new(((self.bits >> 1) & 1) != 0)
240 }
241 #[inline(always)]
243 pub fn hsitrim(&self) -> HSITRIM_R {
244 HSITRIM_R::new(((self.bits >> 3) & 0x1f) as u8)
245 }
246 #[inline(always)]
248 pub fn hsical(&self) -> HSICAL_R {
249 HSICAL_R::new(((self.bits >> 8) & 0xff) as u8)
250 }
251 #[inline(always)]
253 pub fn hseon(&self) -> HSEON_R {
254 HSEON_R::new(((self.bits >> 16) & 1) != 0)
255 }
256 #[inline(always)]
258 pub fn hserdy(&self) -> HSERDY_R {
259 HSERDY_R::new(((self.bits >> 17) & 1) != 0)
260 }
261 #[inline(always)]
263 pub fn hsebyp(&self) -> HSEBYP_R {
264 HSEBYP_R::new(((self.bits >> 18) & 1) != 0)
265 }
266 #[inline(always)]
268 pub fn csson(&self) -> CSSON_R {
269 CSSON_R::new(((self.bits >> 19) & 1) != 0)
270 }
271 #[inline(always)]
273 pub fn pllon(&self) -> PLLON_R {
274 PLLON_R::new(((self.bits >> 24) & 1) != 0)
275 }
276 #[inline(always)]
278 pub fn pllrdy(&self) -> PLLRDY_R {
279 PLLRDY_R::new(((self.bits >> 25) & 1) != 0)
280 }
281}
282impl core::fmt::Debug for R {
283 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
284 f.debug_struct("CR")
285 .field("hsion", &self.hsion())
286 .field("hsirdy", &self.hsirdy())
287 .field("hsitrim", &self.hsitrim())
288 .field("hsical", &self.hsical())
289 .field("hseon", &self.hseon())
290 .field("hserdy", &self.hserdy())
291 .field("hsebyp", &self.hsebyp())
292 .field("csson", &self.csson())
293 .field("pllon", &self.pllon())
294 .field("pllrdy", &self.pllrdy())
295 .finish()
296 }
297}
298impl W {
299 #[inline(always)]
301 pub fn hsion(&mut self) -> HSION_W<CRrs> {
302 HSION_W::new(self, 0)
303 }
304 #[inline(always)]
306 pub fn hsitrim(&mut self) -> HSITRIM_W<CRrs> {
307 HSITRIM_W::new(self, 3)
308 }
309 #[inline(always)]
311 pub fn hseon(&mut self) -> HSEON_W<CRrs> {
312 HSEON_W::new(self, 16)
313 }
314 #[inline(always)]
316 pub fn hsebyp(&mut self) -> HSEBYP_W<CRrs> {
317 HSEBYP_W::new(self, 18)
318 }
319 #[inline(always)]
321 pub fn csson(&mut self) -> CSSON_W<CRrs> {
322 CSSON_W::new(self, 19)
323 }
324 #[inline(always)]
326 pub fn pllon(&mut self) -> PLLON_W<CRrs> {
327 PLLON_W::new(self, 24)
328 }
329}
330pub struct CRrs;
336impl crate::RegisterSpec for CRrs {
337 type Ux = u32;
338}
339impl crate::Readable for CRrs {}
341impl crate::Writable for CRrs {
343 type Safety = crate::Unsafe;
344}
345impl crate::Resettable for CRrs {
347 const RESET_VALUE: u32 = 0x83;
348}