stm32f1_staging/stm32f101/rcc/
apb1rstr.rs1pub type R = crate::R<APB1RSTRrs>;
3pub type W = crate::W<APB1RSTRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum TIM2RST {
11 Reset = 1,
13}
14impl From<TIM2RST> for bool {
15 #[inline(always)]
16 fn from(variant: TIM2RST) -> Self {
17 variant as u8 != 0
18 }
19}
20pub type TIM2RST_R = crate::BitReader<TIM2RST>;
22impl TIM2RST_R {
23 #[inline(always)]
25 pub const fn variant(&self) -> Option<TIM2RST> {
26 match self.bits {
27 true => Some(TIM2RST::Reset),
28 _ => None,
29 }
30 }
31 #[inline(always)]
33 pub fn is_reset(&self) -> bool {
34 *self == TIM2RST::Reset
35 }
36}
37pub type TIM2RST_W<'a, REG> = crate::BitWriter<'a, REG, TIM2RST>;
39impl<'a, REG> TIM2RST_W<'a, REG>
40where
41 REG: crate::Writable + crate::RegisterSpec,
42{
43 #[inline(always)]
45 pub fn reset(self) -> &'a mut crate::W<REG> {
46 self.variant(TIM2RST::Reset)
47 }
48}
49pub use TIM2RST_R as TIM3RST_R;
51pub use TIM2RST_R as TIM4RST_R;
53pub use TIM2RST_R as TIM5RST_R;
55pub use TIM2RST_R as TIM6RST_R;
57pub use TIM2RST_R as TIM7RST_R;
59pub use TIM2RST_R as TIM12RST_R;
61pub use TIM2RST_R as TIM13RST_R;
63pub use TIM2RST_R as TIM14RST_R;
65pub use TIM2RST_R as WWDGRST_R;
67pub use TIM2RST_R as SPI2RST_R;
69pub use TIM2RST_R as SPI3RST_R;
71pub use TIM2RST_R as USART2RST_R;
73pub use TIM2RST_R as USART3RST_R;
75pub use TIM2RST_R as UART4RST_R;
77pub use TIM2RST_R as UART5RST_R;
79pub use TIM2RST_R as I2C1RST_R;
81pub use TIM2RST_R as I2C2RST_R;
83pub use TIM2RST_R as BKPRST_R;
85pub use TIM2RST_R as PWRRST_R;
87pub use TIM2RST_R as DACRST_R;
89pub use TIM2RST_W as TIM3RST_W;
91pub use TIM2RST_W as TIM4RST_W;
93pub use TIM2RST_W as TIM5RST_W;
95pub use TIM2RST_W as TIM6RST_W;
97pub use TIM2RST_W as TIM7RST_W;
99pub use TIM2RST_W as TIM12RST_W;
101pub use TIM2RST_W as TIM13RST_W;
103pub use TIM2RST_W as TIM14RST_W;
105pub use TIM2RST_W as WWDGRST_W;
107pub use TIM2RST_W as SPI2RST_W;
109pub use TIM2RST_W as SPI3RST_W;
111pub use TIM2RST_W as USART2RST_W;
113pub use TIM2RST_W as USART3RST_W;
115pub use TIM2RST_W as UART4RST_W;
117pub use TIM2RST_W as UART5RST_W;
119pub use TIM2RST_W as I2C1RST_W;
121pub use TIM2RST_W as I2C2RST_W;
123pub use TIM2RST_W as BKPRST_W;
125pub use TIM2RST_W as PWRRST_W;
127pub use TIM2RST_W as DACRST_W;
129impl R {
130 #[inline(always)]
132 pub fn tim2rst(&self) -> TIM2RST_R {
133 TIM2RST_R::new((self.bits & 1) != 0)
134 }
135 #[inline(always)]
137 pub fn tim3rst(&self) -> TIM3RST_R {
138 TIM3RST_R::new(((self.bits >> 1) & 1) != 0)
139 }
140 #[inline(always)]
142 pub fn tim4rst(&self) -> TIM4RST_R {
143 TIM4RST_R::new(((self.bits >> 2) & 1) != 0)
144 }
145 #[inline(always)]
147 pub fn tim5rst(&self) -> TIM5RST_R {
148 TIM5RST_R::new(((self.bits >> 3) & 1) != 0)
149 }
150 #[inline(always)]
152 pub fn tim6rst(&self) -> TIM6RST_R {
153 TIM6RST_R::new(((self.bits >> 4) & 1) != 0)
154 }
155 #[inline(always)]
157 pub fn tim7rst(&self) -> TIM7RST_R {
158 TIM7RST_R::new(((self.bits >> 5) & 1) != 0)
159 }
160 #[inline(always)]
162 pub fn tim12rst(&self) -> TIM12RST_R {
163 TIM12RST_R::new(((self.bits >> 6) & 1) != 0)
164 }
165 #[inline(always)]
167 pub fn tim13rst(&self) -> TIM13RST_R {
168 TIM13RST_R::new(((self.bits >> 7) & 1) != 0)
169 }
170 #[inline(always)]
172 pub fn tim14rst(&self) -> TIM14RST_R {
173 TIM14RST_R::new(((self.bits >> 8) & 1) != 0)
174 }
175 #[inline(always)]
177 pub fn wwdgrst(&self) -> WWDGRST_R {
178 WWDGRST_R::new(((self.bits >> 11) & 1) != 0)
179 }
180 #[inline(always)]
182 pub fn spi2rst(&self) -> SPI2RST_R {
183 SPI2RST_R::new(((self.bits >> 14) & 1) != 0)
184 }
185 #[inline(always)]
187 pub fn spi3rst(&self) -> SPI3RST_R {
188 SPI3RST_R::new(((self.bits >> 15) & 1) != 0)
189 }
190 #[inline(always)]
192 pub fn usart2rst(&self) -> USART2RST_R {
193 USART2RST_R::new(((self.bits >> 17) & 1) != 0)
194 }
195 #[inline(always)]
197 pub fn usart3rst(&self) -> USART3RST_R {
198 USART3RST_R::new(((self.bits >> 18) & 1) != 0)
199 }
200 #[inline(always)]
202 pub fn uart4rst(&self) -> UART4RST_R {
203 UART4RST_R::new(((self.bits >> 19) & 1) != 0)
204 }
205 #[inline(always)]
207 pub fn uart5rst(&self) -> UART5RST_R {
208 UART5RST_R::new(((self.bits >> 20) & 1) != 0)
209 }
210 #[inline(always)]
212 pub fn i2c1rst(&self) -> I2C1RST_R {
213 I2C1RST_R::new(((self.bits >> 21) & 1) != 0)
214 }
215 #[inline(always)]
217 pub fn i2c2rst(&self) -> I2C2RST_R {
218 I2C2RST_R::new(((self.bits >> 22) & 1) != 0)
219 }
220 #[inline(always)]
222 pub fn bkprst(&self) -> BKPRST_R {
223 BKPRST_R::new(((self.bits >> 27) & 1) != 0)
224 }
225 #[inline(always)]
227 pub fn pwrrst(&self) -> PWRRST_R {
228 PWRRST_R::new(((self.bits >> 28) & 1) != 0)
229 }
230 #[inline(always)]
232 pub fn dacrst(&self) -> DACRST_R {
233 DACRST_R::new(((self.bits >> 29) & 1) != 0)
234 }
235}
236impl core::fmt::Debug for R {
237 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
238 f.debug_struct("APB1RSTR")
239 .field("tim2rst", &self.tim2rst())
240 .field("tim3rst", &self.tim3rst())
241 .field("tim4rst", &self.tim4rst())
242 .field("tim5rst", &self.tim5rst())
243 .field("tim6rst", &self.tim6rst())
244 .field("tim7rst", &self.tim7rst())
245 .field("tim12rst", &self.tim12rst())
246 .field("tim13rst", &self.tim13rst())
247 .field("tim14rst", &self.tim14rst())
248 .field("wwdgrst", &self.wwdgrst())
249 .field("spi2rst", &self.spi2rst())
250 .field("spi3rst", &self.spi3rst())
251 .field("usart2rst", &self.usart2rst())
252 .field("usart3rst", &self.usart3rst())
253 .field("uart4rst", &self.uart4rst())
254 .field("uart5rst", &self.uart5rst())
255 .field("i2c1rst", &self.i2c1rst())
256 .field("i2c2rst", &self.i2c2rst())
257 .field("bkprst", &self.bkprst())
258 .field("pwrrst", &self.pwrrst())
259 .field("dacrst", &self.dacrst())
260 .finish()
261 }
262}
263impl W {
264 #[inline(always)]
266 pub fn tim2rst(&mut self) -> TIM2RST_W<APB1RSTRrs> {
267 TIM2RST_W::new(self, 0)
268 }
269 #[inline(always)]
271 pub fn tim3rst(&mut self) -> TIM3RST_W<APB1RSTRrs> {
272 TIM3RST_W::new(self, 1)
273 }
274 #[inline(always)]
276 pub fn tim4rst(&mut self) -> TIM4RST_W<APB1RSTRrs> {
277 TIM4RST_W::new(self, 2)
278 }
279 #[inline(always)]
281 pub fn tim5rst(&mut self) -> TIM5RST_W<APB1RSTRrs> {
282 TIM5RST_W::new(self, 3)
283 }
284 #[inline(always)]
286 pub fn tim6rst(&mut self) -> TIM6RST_W<APB1RSTRrs> {
287 TIM6RST_W::new(self, 4)
288 }
289 #[inline(always)]
291 pub fn tim7rst(&mut self) -> TIM7RST_W<APB1RSTRrs> {
292 TIM7RST_W::new(self, 5)
293 }
294 #[inline(always)]
296 pub fn tim12rst(&mut self) -> TIM12RST_W<APB1RSTRrs> {
297 TIM12RST_W::new(self, 6)
298 }
299 #[inline(always)]
301 pub fn tim13rst(&mut self) -> TIM13RST_W<APB1RSTRrs> {
302 TIM13RST_W::new(self, 7)
303 }
304 #[inline(always)]
306 pub fn tim14rst(&mut self) -> TIM14RST_W<APB1RSTRrs> {
307 TIM14RST_W::new(self, 8)
308 }
309 #[inline(always)]
311 pub fn wwdgrst(&mut self) -> WWDGRST_W<APB1RSTRrs> {
312 WWDGRST_W::new(self, 11)
313 }
314 #[inline(always)]
316 pub fn spi2rst(&mut self) -> SPI2RST_W<APB1RSTRrs> {
317 SPI2RST_W::new(self, 14)
318 }
319 #[inline(always)]
321 pub fn spi3rst(&mut self) -> SPI3RST_W<APB1RSTRrs> {
322 SPI3RST_W::new(self, 15)
323 }
324 #[inline(always)]
326 pub fn usart2rst(&mut self) -> USART2RST_W<APB1RSTRrs> {
327 USART2RST_W::new(self, 17)
328 }
329 #[inline(always)]
331 pub fn usart3rst(&mut self) -> USART3RST_W<APB1RSTRrs> {
332 USART3RST_W::new(self, 18)
333 }
334 #[inline(always)]
336 pub fn uart4rst(&mut self) -> UART4RST_W<APB1RSTRrs> {
337 UART4RST_W::new(self, 19)
338 }
339 #[inline(always)]
341 pub fn uart5rst(&mut self) -> UART5RST_W<APB1RSTRrs> {
342 UART5RST_W::new(self, 20)
343 }
344 #[inline(always)]
346 pub fn i2c1rst(&mut self) -> I2C1RST_W<APB1RSTRrs> {
347 I2C1RST_W::new(self, 21)
348 }
349 #[inline(always)]
351 pub fn i2c2rst(&mut self) -> I2C2RST_W<APB1RSTRrs> {
352 I2C2RST_W::new(self, 22)
353 }
354 #[inline(always)]
356 pub fn bkprst(&mut self) -> BKPRST_W<APB1RSTRrs> {
357 BKPRST_W::new(self, 27)
358 }
359 #[inline(always)]
361 pub fn pwrrst(&mut self) -> PWRRST_W<APB1RSTRrs> {
362 PWRRST_W::new(self, 28)
363 }
364 #[inline(always)]
366 pub fn dacrst(&mut self) -> DACRST_W<APB1RSTRrs> {
367 DACRST_W::new(self, 29)
368 }
369}
370pub struct APB1RSTRrs;
376impl crate::RegisterSpec for APB1RSTRrs {
377 type Ux = u32;
378}
379impl crate::Readable for APB1RSTRrs {}
381impl crate::Writable for APB1RSTRrs {
383 type Safety = crate::Unsafe;
384}
385impl crate::Resettable for APB1RSTRrs {}