stm32f103xx/tim10/psc/
mod.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::PSC {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct PSCR {
47 bits: u16,
48}
49impl PSCR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u16 {
53 self.bits
54 }
55}
56#[doc = r" Proxy"]
57pub struct _PSCW<'a> {
58 w: &'a mut W,
59}
60impl<'a> _PSCW<'a> {
61 #[doc = r" Writes raw bits to the field"]
62 #[inline]
63 pub unsafe fn bits(self, value: u16) -> &'a mut W {
64 const MASK: u16 = 65535;
65 const OFFSET: u8 = 0;
66 self.w.bits &= !((MASK as u32) << OFFSET);
67 self.w.bits |= ((value & MASK) as u32) << OFFSET;
68 self.w
69 }
70}
71impl R {
72 #[doc = r" Value of the register as raw bits"]
73 #[inline]
74 pub fn bits(&self) -> u32 {
75 self.bits
76 }
77 #[doc = "Bits 0:15 - Prescaler value"]
78 #[inline]
79 pub fn psc(&self) -> PSCR {
80 let bits = {
81 const MASK: u16 = 65535;
82 const OFFSET: u8 = 0;
83 ((self.bits >> OFFSET) & MASK as u32) as u16
84 };
85 PSCR { bits }
86 }
87}
88impl W {
89 #[doc = r" Reset value of the register"]
90 #[inline]
91 pub fn reset_value() -> W {
92 W { bits: 0 }
93 }
94 #[doc = r" Writes raw bits to the register"]
95 #[inline]
96 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
97 self.bits = bits;
98 self
99 }
100 #[doc = "Bits 0:15 - Prescaler value"]
101 #[inline]
102 pub fn psc(&mut self) -> _PSCW {
103 _PSCW { w: self }
104 }
105}