stm32l4x2_pac/rcc/
apb1rstr2.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::APB1RSTR2 {
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 LPTIM2RSTR {
47 bits: bool,
48}
49impl LPTIM2RSTR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct SWPMI1RSTR {
68 bits: bool,
69}
70impl SWPMI1RSTR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct LPUART1RSTR {
89 bits: bool,
90}
91impl LPUART1RSTR {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bit(&self) -> bool {
95 self.bits
96 }
97 #[doc = r" Returns `true` if the bit is clear (0)"]
98 #[inline]
99 pub fn bit_is_clear(&self) -> bool {
100 !self.bit()
101 }
102 #[doc = r" Returns `true` if the bit is set (1)"]
103 #[inline]
104 pub fn bit_is_set(&self) -> bool {
105 self.bit()
106 }
107}
108#[doc = r" Value of the field"]
109pub struct I2C4RSTR {
110 bits: bool,
111}
112impl I2C4RSTR {
113 #[doc = r" Value of the field as raw bits"]
114 #[inline]
115 pub fn bit(&self) -> bool {
116 self.bits
117 }
118 #[doc = r" Returns `true` if the bit is clear (0)"]
119 #[inline]
120 pub fn bit_is_clear(&self) -> bool {
121 !self.bit()
122 }
123 #[doc = r" Returns `true` if the bit is set (1)"]
124 #[inline]
125 pub fn bit_is_set(&self) -> bool {
126 self.bit()
127 }
128}
129#[doc = r" Proxy"]
130pub struct _LPTIM2RSTW<'a> {
131 w: &'a mut W,
132}
133impl<'a> _LPTIM2RSTW<'a> {
134 #[doc = r" Sets the field bit"]
135 pub fn set_bit(self) -> &'a mut W {
136 self.bit(true)
137 }
138 #[doc = r" Clears the field bit"]
139 pub fn clear_bit(self) -> &'a mut W {
140 self.bit(false)
141 }
142 #[doc = r" Writes raw bits to the field"]
143 #[inline]
144 pub fn bit(self, value: bool) -> &'a mut W {
145 const MASK: bool = true;
146 const OFFSET: u8 = 5;
147 self.w.bits &= !((MASK as u32) << OFFSET);
148 self.w.bits |= ((value & MASK) as u32) << OFFSET;
149 self.w
150 }
151}
152#[doc = r" Proxy"]
153pub struct _SWPMI1RSTW<'a> {
154 w: &'a mut W,
155}
156impl<'a> _SWPMI1RSTW<'a> {
157 #[doc = r" Sets the field bit"]
158 pub fn set_bit(self) -> &'a mut W {
159 self.bit(true)
160 }
161 #[doc = r" Clears the field bit"]
162 pub fn clear_bit(self) -> &'a mut W {
163 self.bit(false)
164 }
165 #[doc = r" Writes raw bits to the field"]
166 #[inline]
167 pub fn bit(self, value: bool) -> &'a mut W {
168 const MASK: bool = true;
169 const OFFSET: u8 = 2;
170 self.w.bits &= !((MASK as u32) << OFFSET);
171 self.w.bits |= ((value & MASK) as u32) << OFFSET;
172 self.w
173 }
174}
175#[doc = r" Proxy"]
176pub struct _LPUART1RSTW<'a> {
177 w: &'a mut W,
178}
179impl<'a> _LPUART1RSTW<'a> {
180 #[doc = r" Sets the field bit"]
181 pub fn set_bit(self) -> &'a mut W {
182 self.bit(true)
183 }
184 #[doc = r" Clears the field bit"]
185 pub fn clear_bit(self) -> &'a mut W {
186 self.bit(false)
187 }
188 #[doc = r" Writes raw bits to the field"]
189 #[inline]
190 pub fn bit(self, value: bool) -> &'a mut W {
191 const MASK: bool = true;
192 const OFFSET: u8 = 0;
193 self.w.bits &= !((MASK as u32) << OFFSET);
194 self.w.bits |= ((value & MASK) as u32) << OFFSET;
195 self.w
196 }
197}
198#[doc = r" Proxy"]
199pub struct _I2C4RSTW<'a> {
200 w: &'a mut W,
201}
202impl<'a> _I2C4RSTW<'a> {
203 #[doc = r" Sets the field bit"]
204 pub fn set_bit(self) -> &'a mut W {
205 self.bit(true)
206 }
207 #[doc = r" Clears the field bit"]
208 pub fn clear_bit(self) -> &'a mut W {
209 self.bit(false)
210 }
211 #[doc = r" Writes raw bits to the field"]
212 #[inline]
213 pub fn bit(self, value: bool) -> &'a mut W {
214 const MASK: bool = true;
215 const OFFSET: u8 = 1;
216 self.w.bits &= !((MASK as u32) << OFFSET);
217 self.w.bits |= ((value & MASK) as u32) << OFFSET;
218 self.w
219 }
220}
221impl R {
222 #[doc = r" Value of the register as raw bits"]
223 #[inline]
224 pub fn bits(&self) -> u32 {
225 self.bits
226 }
227 #[doc = "Bit 5 - Low-power timer 2 reset"]
228 #[inline]
229 pub fn lptim2rst(&self) -> LPTIM2RSTR {
230 let bits = {
231 const MASK: bool = true;
232 const OFFSET: u8 = 5;
233 ((self.bits >> OFFSET) & MASK as u32) != 0
234 };
235 LPTIM2RSTR { bits }
236 }
237 #[doc = "Bit 2 - Single wire protocol reset"]
238 #[inline]
239 pub fn swpmi1rst(&self) -> SWPMI1RSTR {
240 let bits = {
241 const MASK: bool = true;
242 const OFFSET: u8 = 2;
243 ((self.bits >> OFFSET) & MASK as u32) != 0
244 };
245 SWPMI1RSTR { bits }
246 }
247 #[doc = "Bit 0 - Low-power UART 1 reset"]
248 #[inline]
249 pub fn lpuart1rst(&self) -> LPUART1RSTR {
250 let bits = {
251 const MASK: bool = true;
252 const OFFSET: u8 = 0;
253 ((self.bits >> OFFSET) & MASK as u32) != 0
254 };
255 LPUART1RSTR { bits }
256 }
257 #[doc = "Bit 1 - I2C4 reset"]
258 #[inline]
259 pub fn i2c4rst(&self) -> I2C4RSTR {
260 let bits = {
261 const MASK: bool = true;
262 const OFFSET: u8 = 1;
263 ((self.bits >> OFFSET) & MASK as u32) != 0
264 };
265 I2C4RSTR { bits }
266 }
267}
268impl W {
269 #[doc = r" Reset value of the register"]
270 #[inline]
271 pub fn reset_value() -> W {
272 W { bits: 0 }
273 }
274 #[doc = r" Writes raw bits to the register"]
275 #[inline]
276 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
277 self.bits = bits;
278 self
279 }
280 #[doc = "Bit 5 - Low-power timer 2 reset"]
281 #[inline]
282 pub fn lptim2rst(&mut self) -> _LPTIM2RSTW {
283 _LPTIM2RSTW { w: self }
284 }
285 #[doc = "Bit 2 - Single wire protocol reset"]
286 #[inline]
287 pub fn swpmi1rst(&mut self) -> _SWPMI1RSTW {
288 _SWPMI1RSTW { w: self }
289 }
290 #[doc = "Bit 0 - Low-power UART 1 reset"]
291 #[inline]
292 pub fn lpuart1rst(&mut self) -> _LPUART1RSTW {
293 _LPUART1RSTW { w: self }
294 }
295 #[doc = "Bit 1 - I2C4 reset"]
296 #[inline]
297 pub fn i2c4rst(&mut self) -> _I2C4RSTW {
298 _I2C4RSTW { w: self }
299 }
300}