stm32f0/stm32f0x0/rcc/
apb1enr.rs1pub type R = crate::R<APB1ENRrs>;
3pub type W = crate::W<APB1ENRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum TIM3EN {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<TIM3EN> for bool {
17 #[inline(always)]
18 fn from(variant: TIM3EN) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type TIM3EN_R = crate::BitReader<TIM3EN>;
24impl TIM3EN_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> TIM3EN {
28 match self.bits {
29 false => TIM3EN::Disabled,
30 true => TIM3EN::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == TIM3EN::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == TIM3EN::Enabled
42 }
43}
44pub type TIM3EN_W<'a, REG> = crate::BitWriter<'a, REG, TIM3EN>;
46impl<'a, REG> TIM3EN_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(TIM3EN::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(TIM3EN::Enabled)
59 }
60}
61pub use TIM3EN_R as TIM6EN_R;
63pub use TIM3EN_R as TIM7EN_R;
65pub use TIM3EN_R as TIM14EN_R;
67pub use TIM3EN_R as WWDGEN_R;
69pub use TIM3EN_R as SPI2EN_R;
71pub use TIM3EN_R as USART2EN_R;
73pub use TIM3EN_R as USART3EN_R;
75pub use TIM3EN_R as USART4EN_R;
77pub use TIM3EN_R as USART5EN_R;
79pub use TIM3EN_R as I2C1EN_R;
81pub use TIM3EN_R as I2C2EN_R;
83pub use TIM3EN_R as USBEN_R;
85pub use TIM3EN_R as PWREN_R;
87pub use TIM3EN_W as TIM6EN_W;
89pub use TIM3EN_W as TIM7EN_W;
91pub use TIM3EN_W as TIM14EN_W;
93pub use TIM3EN_W as WWDGEN_W;
95pub use TIM3EN_W as SPI2EN_W;
97pub use TIM3EN_W as USART2EN_W;
99pub use TIM3EN_W as USART3EN_W;
101pub use TIM3EN_W as USART4EN_W;
103pub use TIM3EN_W as USART5EN_W;
105pub use TIM3EN_W as I2C1EN_W;
107pub use TIM3EN_W as I2C2EN_W;
109pub use TIM3EN_W as USBEN_W;
111pub use TIM3EN_W as PWREN_W;
113impl R {
114 #[inline(always)]
116 pub fn tim3en(&self) -> TIM3EN_R {
117 TIM3EN_R::new(((self.bits >> 1) & 1) != 0)
118 }
119 #[inline(always)]
121 pub fn tim6en(&self) -> TIM6EN_R {
122 TIM6EN_R::new(((self.bits >> 4) & 1) != 0)
123 }
124 #[inline(always)]
126 pub fn tim7en(&self) -> TIM7EN_R {
127 TIM7EN_R::new(((self.bits >> 5) & 1) != 0)
128 }
129 #[inline(always)]
131 pub fn tim14en(&self) -> TIM14EN_R {
132 TIM14EN_R::new(((self.bits >> 8) & 1) != 0)
133 }
134 #[inline(always)]
136 pub fn wwdgen(&self) -> WWDGEN_R {
137 WWDGEN_R::new(((self.bits >> 11) & 1) != 0)
138 }
139 #[inline(always)]
141 pub fn spi2en(&self) -> SPI2EN_R {
142 SPI2EN_R::new(((self.bits >> 14) & 1) != 0)
143 }
144 #[inline(always)]
146 pub fn usart2en(&self) -> USART2EN_R {
147 USART2EN_R::new(((self.bits >> 17) & 1) != 0)
148 }
149 #[inline(always)]
151 pub fn usart3en(&self) -> USART3EN_R {
152 USART3EN_R::new(((self.bits >> 18) & 1) != 0)
153 }
154 #[inline(always)]
156 pub fn usart4en(&self) -> USART4EN_R {
157 USART4EN_R::new(((self.bits >> 19) & 1) != 0)
158 }
159 #[inline(always)]
161 pub fn usart5en(&self) -> USART5EN_R {
162 USART5EN_R::new(((self.bits >> 20) & 1) != 0)
163 }
164 #[inline(always)]
166 pub fn i2c1en(&self) -> I2C1EN_R {
167 I2C1EN_R::new(((self.bits >> 21) & 1) != 0)
168 }
169 #[inline(always)]
171 pub fn i2c2en(&self) -> I2C2EN_R {
172 I2C2EN_R::new(((self.bits >> 22) & 1) != 0)
173 }
174 #[inline(always)]
176 pub fn usben(&self) -> USBEN_R {
177 USBEN_R::new(((self.bits >> 23) & 1) != 0)
178 }
179 #[inline(always)]
181 pub fn pwren(&self) -> PWREN_R {
182 PWREN_R::new(((self.bits >> 28) & 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("APB1ENR")
188 .field("tim3en", &self.tim3en())
189 .field("tim6en", &self.tim6en())
190 .field("tim7en", &self.tim7en())
191 .field("tim14en", &self.tim14en())
192 .field("wwdgen", &self.wwdgen())
193 .field("spi2en", &self.spi2en())
194 .field("usart2en", &self.usart2en())
195 .field("usart3en", &self.usart3en())
196 .field("usart4en", &self.usart4en())
197 .field("usart5en", &self.usart5en())
198 .field("i2c1en", &self.i2c1en())
199 .field("i2c2en", &self.i2c2en())
200 .field("usben", &self.usben())
201 .field("pwren", &self.pwren())
202 .finish()
203 }
204}
205impl W {
206 #[inline(always)]
208 pub fn tim3en(&mut self) -> TIM3EN_W<APB1ENRrs> {
209 TIM3EN_W::new(self, 1)
210 }
211 #[inline(always)]
213 pub fn tim6en(&mut self) -> TIM6EN_W<APB1ENRrs> {
214 TIM6EN_W::new(self, 4)
215 }
216 #[inline(always)]
218 pub fn tim7en(&mut self) -> TIM7EN_W<APB1ENRrs> {
219 TIM7EN_W::new(self, 5)
220 }
221 #[inline(always)]
223 pub fn tim14en(&mut self) -> TIM14EN_W<APB1ENRrs> {
224 TIM14EN_W::new(self, 8)
225 }
226 #[inline(always)]
228 pub fn wwdgen(&mut self) -> WWDGEN_W<APB1ENRrs> {
229 WWDGEN_W::new(self, 11)
230 }
231 #[inline(always)]
233 pub fn spi2en(&mut self) -> SPI2EN_W<APB1ENRrs> {
234 SPI2EN_W::new(self, 14)
235 }
236 #[inline(always)]
238 pub fn usart2en(&mut self) -> USART2EN_W<APB1ENRrs> {
239 USART2EN_W::new(self, 17)
240 }
241 #[inline(always)]
243 pub fn usart3en(&mut self) -> USART3EN_W<APB1ENRrs> {
244 USART3EN_W::new(self, 18)
245 }
246 #[inline(always)]
248 pub fn usart4en(&mut self) -> USART4EN_W<APB1ENRrs> {
249 USART4EN_W::new(self, 19)
250 }
251 #[inline(always)]
253 pub fn usart5en(&mut self) -> USART5EN_W<APB1ENRrs> {
254 USART5EN_W::new(self, 20)
255 }
256 #[inline(always)]
258 pub fn i2c1en(&mut self) -> I2C1EN_W<APB1ENRrs> {
259 I2C1EN_W::new(self, 21)
260 }
261 #[inline(always)]
263 pub fn i2c2en(&mut self) -> I2C2EN_W<APB1ENRrs> {
264 I2C2EN_W::new(self, 22)
265 }
266 #[inline(always)]
268 pub fn usben(&mut self) -> USBEN_W<APB1ENRrs> {
269 USBEN_W::new(self, 23)
270 }
271 #[inline(always)]
273 pub fn pwren(&mut self) -> PWREN_W<APB1ENRrs> {
274 PWREN_W::new(self, 28)
275 }
276}
277pub struct APB1ENRrs;
283impl crate::RegisterSpec for APB1ENRrs {
284 type Ux = u32;
285}
286impl crate::Readable for APB1ENRrs {}
288impl crate::Writable for APB1ENRrs {
290 type Safety = crate::Unsafe;
291}
292impl crate::Resettable for APB1ENRrs {}