stm32f1_staging/stm32f103/rcc/
apb2enr.rs1pub type R = crate::R<APB2ENRrs>;
3pub type W = crate::W<APB2ENRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum AFIOEN {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<AFIOEN> for bool {
17 #[inline(always)]
18 fn from(variant: AFIOEN) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type AFIOEN_R = crate::BitReader<AFIOEN>;
24impl AFIOEN_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> AFIOEN {
28 match self.bits {
29 false => AFIOEN::Disabled,
30 true => AFIOEN::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == AFIOEN::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == AFIOEN::Enabled
42 }
43}
44pub type AFIOEN_W<'a, REG> = crate::BitWriter<'a, REG, AFIOEN>;
46impl<'a, REG> AFIOEN_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn disabled(self) -> &'a mut crate::W<REG> {
53 self.variant(AFIOEN::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(AFIOEN::Enabled)
59 }
60}
61pub use AFIOEN_R as IOPAEN_R;
63pub use AFIOEN_R as IOPBEN_R;
65pub use AFIOEN_R as IOPCEN_R;
67pub use AFIOEN_R as IOPDEN_R;
69pub use AFIOEN_R as IOPEEN_R;
71pub use AFIOEN_R as IOPFEN_R;
73pub use AFIOEN_R as IOPGEN_R;
75pub use AFIOEN_R as ADC1EN_R;
77pub use AFIOEN_R as ADC2EN_R;
79pub use AFIOEN_R as TIM1EN_R;
81pub use AFIOEN_R as SPI1EN_R;
83pub use AFIOEN_R as TIM8EN_R;
85pub use AFIOEN_R as USART1EN_R;
87pub use AFIOEN_R as ADC3EN_R;
89pub use AFIOEN_R as TIM9EN_R;
91pub use AFIOEN_R as TIM10EN_R;
93pub use AFIOEN_R as TIM11EN_R;
95pub use AFIOEN_W as IOPAEN_W;
97pub use AFIOEN_W as IOPBEN_W;
99pub use AFIOEN_W as IOPCEN_W;
101pub use AFIOEN_W as IOPDEN_W;
103pub use AFIOEN_W as IOPEEN_W;
105pub use AFIOEN_W as IOPFEN_W;
107pub use AFIOEN_W as IOPGEN_W;
109pub use AFIOEN_W as ADC1EN_W;
111pub use AFIOEN_W as ADC2EN_W;
113pub use AFIOEN_W as TIM1EN_W;
115pub use AFIOEN_W as SPI1EN_W;
117pub use AFIOEN_W as TIM8EN_W;
119pub use AFIOEN_W as USART1EN_W;
121pub use AFIOEN_W as ADC3EN_W;
123pub use AFIOEN_W as TIM9EN_W;
125pub use AFIOEN_W as TIM10EN_W;
127pub use AFIOEN_W as TIM11EN_W;
129impl R {
130 #[inline(always)]
132 pub fn afioen(&self) -> AFIOEN_R {
133 AFIOEN_R::new((self.bits & 1) != 0)
134 }
135 #[inline(always)]
137 pub fn iopaen(&self) -> IOPAEN_R {
138 IOPAEN_R::new(((self.bits >> 2) & 1) != 0)
139 }
140 #[inline(always)]
142 pub fn iopben(&self) -> IOPBEN_R {
143 IOPBEN_R::new(((self.bits >> 3) & 1) != 0)
144 }
145 #[inline(always)]
147 pub fn iopcen(&self) -> IOPCEN_R {
148 IOPCEN_R::new(((self.bits >> 4) & 1) != 0)
149 }
150 #[inline(always)]
152 pub fn iopden(&self) -> IOPDEN_R {
153 IOPDEN_R::new(((self.bits >> 5) & 1) != 0)
154 }
155 #[inline(always)]
157 pub fn iopeen(&self) -> IOPEEN_R {
158 IOPEEN_R::new(((self.bits >> 6) & 1) != 0)
159 }
160 #[inline(always)]
162 pub fn iopfen(&self) -> IOPFEN_R {
163 IOPFEN_R::new(((self.bits >> 7) & 1) != 0)
164 }
165 #[inline(always)]
167 pub fn iopgen(&self) -> IOPGEN_R {
168 IOPGEN_R::new(((self.bits >> 8) & 1) != 0)
169 }
170 #[inline(always)]
172 pub fn adc1en(&self) -> ADC1EN_R {
173 ADC1EN_R::new(((self.bits >> 9) & 1) != 0)
174 }
175 #[inline(always)]
177 pub fn adc2en(&self) -> ADC2EN_R {
178 ADC2EN_R::new(((self.bits >> 10) & 1) != 0)
179 }
180 #[inline(always)]
182 pub fn tim1en(&self) -> TIM1EN_R {
183 TIM1EN_R::new(((self.bits >> 11) & 1) != 0)
184 }
185 #[inline(always)]
187 pub fn spi1en(&self) -> SPI1EN_R {
188 SPI1EN_R::new(((self.bits >> 12) & 1) != 0)
189 }
190 #[inline(always)]
192 pub fn tim8en(&self) -> TIM8EN_R {
193 TIM8EN_R::new(((self.bits >> 13) & 1) != 0)
194 }
195 #[inline(always)]
197 pub fn usart1en(&self) -> USART1EN_R {
198 USART1EN_R::new(((self.bits >> 14) & 1) != 0)
199 }
200 #[inline(always)]
202 pub fn adc3en(&self) -> ADC3EN_R {
203 ADC3EN_R::new(((self.bits >> 15) & 1) != 0)
204 }
205 #[inline(always)]
207 pub fn tim9en(&self) -> TIM9EN_R {
208 TIM9EN_R::new(((self.bits >> 19) & 1) != 0)
209 }
210 #[inline(always)]
212 pub fn tim10en(&self) -> TIM10EN_R {
213 TIM10EN_R::new(((self.bits >> 20) & 1) != 0)
214 }
215 #[inline(always)]
217 pub fn tim11en(&self) -> TIM11EN_R {
218 TIM11EN_R::new(((self.bits >> 21) & 1) != 0)
219 }
220}
221impl core::fmt::Debug for R {
222 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
223 f.debug_struct("APB2ENR")
224 .field("afioen", &self.afioen())
225 .field("iopaen", &self.iopaen())
226 .field("iopben", &self.iopben())
227 .field("iopcen", &self.iopcen())
228 .field("iopden", &self.iopden())
229 .field("iopeen", &self.iopeen())
230 .field("iopfen", &self.iopfen())
231 .field("iopgen", &self.iopgen())
232 .field("adc1en", &self.adc1en())
233 .field("adc2en", &self.adc2en())
234 .field("tim1en", &self.tim1en())
235 .field("spi1en", &self.spi1en())
236 .field("tim8en", &self.tim8en())
237 .field("usart1en", &self.usart1en())
238 .field("adc3en", &self.adc3en())
239 .field("tim9en", &self.tim9en())
240 .field("tim10en", &self.tim10en())
241 .field("tim11en", &self.tim11en())
242 .finish()
243 }
244}
245impl W {
246 #[inline(always)]
248 pub fn afioen(&mut self) -> AFIOEN_W<APB2ENRrs> {
249 AFIOEN_W::new(self, 0)
250 }
251 #[inline(always)]
253 pub fn iopaen(&mut self) -> IOPAEN_W<APB2ENRrs> {
254 IOPAEN_W::new(self, 2)
255 }
256 #[inline(always)]
258 pub fn iopben(&mut self) -> IOPBEN_W<APB2ENRrs> {
259 IOPBEN_W::new(self, 3)
260 }
261 #[inline(always)]
263 pub fn iopcen(&mut self) -> IOPCEN_W<APB2ENRrs> {
264 IOPCEN_W::new(self, 4)
265 }
266 #[inline(always)]
268 pub fn iopden(&mut self) -> IOPDEN_W<APB2ENRrs> {
269 IOPDEN_W::new(self, 5)
270 }
271 #[inline(always)]
273 pub fn iopeen(&mut self) -> IOPEEN_W<APB2ENRrs> {
274 IOPEEN_W::new(self, 6)
275 }
276 #[inline(always)]
278 pub fn iopfen(&mut self) -> IOPFEN_W<APB2ENRrs> {
279 IOPFEN_W::new(self, 7)
280 }
281 #[inline(always)]
283 pub fn iopgen(&mut self) -> IOPGEN_W<APB2ENRrs> {
284 IOPGEN_W::new(self, 8)
285 }
286 #[inline(always)]
288 pub fn adc1en(&mut self) -> ADC1EN_W<APB2ENRrs> {
289 ADC1EN_W::new(self, 9)
290 }
291 #[inline(always)]
293 pub fn adc2en(&mut self) -> ADC2EN_W<APB2ENRrs> {
294 ADC2EN_W::new(self, 10)
295 }
296 #[inline(always)]
298 pub fn tim1en(&mut self) -> TIM1EN_W<APB2ENRrs> {
299 TIM1EN_W::new(self, 11)
300 }
301 #[inline(always)]
303 pub fn spi1en(&mut self) -> SPI1EN_W<APB2ENRrs> {
304 SPI1EN_W::new(self, 12)
305 }
306 #[inline(always)]
308 pub fn tim8en(&mut self) -> TIM8EN_W<APB2ENRrs> {
309 TIM8EN_W::new(self, 13)
310 }
311 #[inline(always)]
313 pub fn usart1en(&mut self) -> USART1EN_W<APB2ENRrs> {
314 USART1EN_W::new(self, 14)
315 }
316 #[inline(always)]
318 pub fn adc3en(&mut self) -> ADC3EN_W<APB2ENRrs> {
319 ADC3EN_W::new(self, 15)
320 }
321 #[inline(always)]
323 pub fn tim9en(&mut self) -> TIM9EN_W<APB2ENRrs> {
324 TIM9EN_W::new(self, 19)
325 }
326 #[inline(always)]
328 pub fn tim10en(&mut self) -> TIM10EN_W<APB2ENRrs> {
329 TIM10EN_W::new(self, 20)
330 }
331 #[inline(always)]
333 pub fn tim11en(&mut self) -> TIM11EN_W<APB2ENRrs> {
334 TIM11EN_W::new(self, 21)
335 }
336}
337pub struct APB2ENRrs;
343impl crate::RegisterSpec for APB2ENRrs {
344 type Ux = u32;
345}
346impl crate::Readable for APB2ENRrs {}
348impl crate::Writable for APB2ENRrs {
350 type Safety = crate::Unsafe;
351}
352impl crate::Resettable for APB2ENRrs {}