stm32f1_staging/stm32f101/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 SPI1EN_R;
79pub use AFIOEN_R as USART1EN_R;
81pub use AFIOEN_R as TIM9EN_R;
83pub use AFIOEN_R as TIM10EN_R;
85pub use AFIOEN_R as TIM11EN_R;
87pub use AFIOEN_W as IOPAEN_W;
89pub use AFIOEN_W as IOPBEN_W;
91pub use AFIOEN_W as IOPCEN_W;
93pub use AFIOEN_W as IOPDEN_W;
95pub use AFIOEN_W as IOPEEN_W;
97pub use AFIOEN_W as IOPFEN_W;
99pub use AFIOEN_W as IOPGEN_W;
101pub use AFIOEN_W as ADC1EN_W;
103pub use AFIOEN_W as SPI1EN_W;
105pub use AFIOEN_W as USART1EN_W;
107pub use AFIOEN_W as TIM9EN_W;
109pub use AFIOEN_W as TIM10EN_W;
111pub use AFIOEN_W as TIM11EN_W;
113impl R {
114 #[inline(always)]
116 pub fn afioen(&self) -> AFIOEN_R {
117 AFIOEN_R::new((self.bits & 1) != 0)
118 }
119 #[inline(always)]
121 pub fn iopaen(&self) -> IOPAEN_R {
122 IOPAEN_R::new(((self.bits >> 2) & 1) != 0)
123 }
124 #[inline(always)]
126 pub fn iopben(&self) -> IOPBEN_R {
127 IOPBEN_R::new(((self.bits >> 3) & 1) != 0)
128 }
129 #[inline(always)]
131 pub fn iopcen(&self) -> IOPCEN_R {
132 IOPCEN_R::new(((self.bits >> 4) & 1) != 0)
133 }
134 #[inline(always)]
136 pub fn iopden(&self) -> IOPDEN_R {
137 IOPDEN_R::new(((self.bits >> 5) & 1) != 0)
138 }
139 #[inline(always)]
141 pub fn iopeen(&self) -> IOPEEN_R {
142 IOPEEN_R::new(((self.bits >> 6) & 1) != 0)
143 }
144 #[inline(always)]
146 pub fn iopfen(&self) -> IOPFEN_R {
147 IOPFEN_R::new(((self.bits >> 7) & 1) != 0)
148 }
149 #[inline(always)]
151 pub fn iopgen(&self) -> IOPGEN_R {
152 IOPGEN_R::new(((self.bits >> 8) & 1) != 0)
153 }
154 #[inline(always)]
156 pub fn adc1en(&self) -> ADC1EN_R {
157 ADC1EN_R::new(((self.bits >> 9) & 1) != 0)
158 }
159 #[inline(always)]
161 pub fn spi1en(&self) -> SPI1EN_R {
162 SPI1EN_R::new(((self.bits >> 12) & 1) != 0)
163 }
164 #[inline(always)]
166 pub fn usart1en(&self) -> USART1EN_R {
167 USART1EN_R::new(((self.bits >> 14) & 1) != 0)
168 }
169 #[inline(always)]
171 pub fn tim9en(&self) -> TIM9EN_R {
172 TIM9EN_R::new(((self.bits >> 19) & 1) != 0)
173 }
174 #[inline(always)]
176 pub fn tim10en(&self) -> TIM10EN_R {
177 TIM10EN_R::new(((self.bits >> 20) & 1) != 0)
178 }
179 #[inline(always)]
181 pub fn tim11en(&self) -> TIM11EN_R {
182 TIM11EN_R::new(((self.bits >> 21) & 1) != 0)
183 }
184}
185impl core::fmt::Debug for R {
186 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187 f.debug_struct("APB2ENR")
188 .field("afioen", &self.afioen())
189 .field("iopaen", &self.iopaen())
190 .field("iopben", &self.iopben())
191 .field("iopcen", &self.iopcen())
192 .field("iopden", &self.iopden())
193 .field("iopeen", &self.iopeen())
194 .field("iopfen", &self.iopfen())
195 .field("iopgen", &self.iopgen())
196 .field("adc1en", &self.adc1en())
197 .field("spi1en", &self.spi1en())
198 .field("usart1en", &self.usart1en())
199 .field("tim9en", &self.tim9en())
200 .field("tim10en", &self.tim10en())
201 .field("tim11en", &self.tim11en())
202 .finish()
203 }
204}
205impl W {
206 #[inline(always)]
208 pub fn afioen(&mut self) -> AFIOEN_W<APB2ENRrs> {
209 AFIOEN_W::new(self, 0)
210 }
211 #[inline(always)]
213 pub fn iopaen(&mut self) -> IOPAEN_W<APB2ENRrs> {
214 IOPAEN_W::new(self, 2)
215 }
216 #[inline(always)]
218 pub fn iopben(&mut self) -> IOPBEN_W<APB2ENRrs> {
219 IOPBEN_W::new(self, 3)
220 }
221 #[inline(always)]
223 pub fn iopcen(&mut self) -> IOPCEN_W<APB2ENRrs> {
224 IOPCEN_W::new(self, 4)
225 }
226 #[inline(always)]
228 pub fn iopden(&mut self) -> IOPDEN_W<APB2ENRrs> {
229 IOPDEN_W::new(self, 5)
230 }
231 #[inline(always)]
233 pub fn iopeen(&mut self) -> IOPEEN_W<APB2ENRrs> {
234 IOPEEN_W::new(self, 6)
235 }
236 #[inline(always)]
238 pub fn iopfen(&mut self) -> IOPFEN_W<APB2ENRrs> {
239 IOPFEN_W::new(self, 7)
240 }
241 #[inline(always)]
243 pub fn iopgen(&mut self) -> IOPGEN_W<APB2ENRrs> {
244 IOPGEN_W::new(self, 8)
245 }
246 #[inline(always)]
248 pub fn adc1en(&mut self) -> ADC1EN_W<APB2ENRrs> {
249 ADC1EN_W::new(self, 9)
250 }
251 #[inline(always)]
253 pub fn spi1en(&mut self) -> SPI1EN_W<APB2ENRrs> {
254 SPI1EN_W::new(self, 12)
255 }
256 #[inline(always)]
258 pub fn usart1en(&mut self) -> USART1EN_W<APB2ENRrs> {
259 USART1EN_W::new(self, 14)
260 }
261 #[inline(always)]
263 pub fn tim9en(&mut self) -> TIM9EN_W<APB2ENRrs> {
264 TIM9EN_W::new(self, 19)
265 }
266 #[inline(always)]
268 pub fn tim10en(&mut self) -> TIM10EN_W<APB2ENRrs> {
269 TIM10EN_W::new(self, 20)
270 }
271 #[inline(always)]
273 pub fn tim11en(&mut self) -> TIM11EN_W<APB2ENRrs> {
274 TIM11EN_W::new(self, 21)
275 }
276}
277pub struct APB2ENRrs;
283impl crate::RegisterSpec for APB2ENRrs {
284 type Ux = u32;
285}
286impl crate::Readable for APB2ENRrs {}
288impl crate::Writable for APB2ENRrs {
290 type Safety = crate::Unsafe;
291}
292impl crate::Resettable for APB2ENRrs {}