stm32wb_pac/lptim1/
cfgr.rs1#[doc = "Reader of register CFGR"]
2pub type R = crate::R<u32, super::CFGR>;
3#[doc = "Writer for register CFGR"]
4pub type W = crate::W<u32, super::CFGR>;
5#[doc = "Register CFGR `reset()`'s with value 0"]
6impl crate::ResetValue for super::CFGR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `ENC`"]
14pub type ENC_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `ENC`"]
16pub struct ENC_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> ENC_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
34 self.w
35 }
36}
37#[doc = "Reader of field `COUNTMODE`"]
38pub type COUNTMODE_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `COUNTMODE`"]
40pub struct COUNTMODE_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> COUNTMODE_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23);
58 self.w
59 }
60}
61#[doc = "Reader of field `PRELOAD`"]
62pub type PRELOAD_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `PRELOAD`"]
64pub struct PRELOAD_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> PRELOAD_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22);
82 self.w
83 }
84}
85#[doc = "Reader of field `WAVPOL`"]
86pub type WAVPOL_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `WAVPOL`"]
88pub struct WAVPOL_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> WAVPOL_W<'a> {
92 #[doc = r"Sets the field bit"]
93 #[inline(always)]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r"Clears the field bit"]
98 #[inline(always)]
99 pub fn clear_bit(self) -> &'a mut W {
100 self.bit(false)
101 }
102 #[doc = r"Writes raw bits to the field"]
103 #[inline(always)]
104 pub fn bit(self, value: bool) -> &'a mut W {
105 self.w.bits = (self.w.bits & !(0x01 << 21)) | (((value as u32) & 0x01) << 21);
106 self.w
107 }
108}
109#[doc = "Reader of field `WAVE`"]
110pub type WAVE_R = crate::R<bool, bool>;
111#[doc = "Write proxy for field `WAVE`"]
112pub struct WAVE_W<'a> {
113 w: &'a mut W,
114}
115impl<'a> WAVE_W<'a> {
116 #[doc = r"Sets the field bit"]
117 #[inline(always)]
118 pub fn set_bit(self) -> &'a mut W {
119 self.bit(true)
120 }
121 #[doc = r"Clears the field bit"]
122 #[inline(always)]
123 pub fn clear_bit(self) -> &'a mut W {
124 self.bit(false)
125 }
126 #[doc = r"Writes raw bits to the field"]
127 #[inline(always)]
128 pub fn bit(self, value: bool) -> &'a mut W {
129 self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20);
130 self.w
131 }
132}
133#[doc = "Reader of field `TIMOUT`"]
134pub type TIMOUT_R = crate::R<bool, bool>;
135#[doc = "Write proxy for field `TIMOUT`"]
136pub struct TIMOUT_W<'a> {
137 w: &'a mut W,
138}
139impl<'a> TIMOUT_W<'a> {
140 #[doc = r"Sets the field bit"]
141 #[inline(always)]
142 pub fn set_bit(self) -> &'a mut W {
143 self.bit(true)
144 }
145 #[doc = r"Clears the field bit"]
146 #[inline(always)]
147 pub fn clear_bit(self) -> &'a mut W {
148 self.bit(false)
149 }
150 #[doc = r"Writes raw bits to the field"]
151 #[inline(always)]
152 pub fn bit(self, value: bool) -> &'a mut W {
153 self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
154 self.w
155 }
156}
157#[doc = "Reader of field `TRIGEN`"]
158pub type TRIGEN_R = crate::R<u8, u8>;
159#[doc = "Write proxy for field `TRIGEN`"]
160pub struct TRIGEN_W<'a> {
161 w: &'a mut W,
162}
163impl<'a> TRIGEN_W<'a> {
164 #[doc = r"Writes raw bits to the field"]
165 #[inline(always)]
166 pub unsafe fn bits(self, value: u8) -> &'a mut W {
167 self.w.bits = (self.w.bits & !(0x03 << 17)) | (((value as u32) & 0x03) << 17);
168 self.w
169 }
170}
171#[doc = "Reader of field `TRIGSEL`"]
172pub type TRIGSEL_R = crate::R<u8, u8>;
173#[doc = "Write proxy for field `TRIGSEL`"]
174pub struct TRIGSEL_W<'a> {
175 w: &'a mut W,
176}
177impl<'a> TRIGSEL_W<'a> {
178 #[doc = r"Writes raw bits to the field"]
179 #[inline(always)]
180 pub unsafe fn bits(self, value: u8) -> &'a mut W {
181 self.w.bits = (self.w.bits & !(0x07 << 13)) | (((value as u32) & 0x07) << 13);
182 self.w
183 }
184}
185#[doc = "Reader of field `PRESC`"]
186pub type PRESC_R = crate::R<u8, u8>;
187#[doc = "Write proxy for field `PRESC`"]
188pub struct PRESC_W<'a> {
189 w: &'a mut W,
190}
191impl<'a> PRESC_W<'a> {
192 #[doc = r"Writes raw bits to the field"]
193 #[inline(always)]
194 pub unsafe fn bits(self, value: u8) -> &'a mut W {
195 self.w.bits = (self.w.bits & !(0x07 << 9)) | (((value as u32) & 0x07) << 9);
196 self.w
197 }
198}
199#[doc = "Reader of field `TRGFLT`"]
200pub type TRGFLT_R = crate::R<u8, u8>;
201#[doc = "Write proxy for field `TRGFLT`"]
202pub struct TRGFLT_W<'a> {
203 w: &'a mut W,
204}
205impl<'a> TRGFLT_W<'a> {
206 #[doc = r"Writes raw bits to the field"]
207 #[inline(always)]
208 pub unsafe fn bits(self, value: u8) -> &'a mut W {
209 self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
210 self.w
211 }
212}
213#[doc = "Reader of field `CKFLT`"]
214pub type CKFLT_R = crate::R<u8, u8>;
215#[doc = "Write proxy for field `CKFLT`"]
216pub struct CKFLT_W<'a> {
217 w: &'a mut W,
218}
219impl<'a> CKFLT_W<'a> {
220 #[doc = r"Writes raw bits to the field"]
221 #[inline(always)]
222 pub unsafe fn bits(self, value: u8) -> &'a mut W {
223 self.w.bits = (self.w.bits & !(0x03 << 3)) | (((value as u32) & 0x03) << 3);
224 self.w
225 }
226}
227#[doc = "Reader of field `CKPOL`"]
228pub type CKPOL_R = crate::R<u8, u8>;
229#[doc = "Write proxy for field `CKPOL`"]
230pub struct CKPOL_W<'a> {
231 w: &'a mut W,
232}
233impl<'a> CKPOL_W<'a> {
234 #[doc = r"Writes raw bits to the field"]
235 #[inline(always)]
236 pub unsafe fn bits(self, value: u8) -> &'a mut W {
237 self.w.bits = (self.w.bits & !(0x03 << 1)) | (((value as u32) & 0x03) << 1);
238 self.w
239 }
240}
241#[doc = "Reader of field `CKSEL`"]
242pub type CKSEL_R = crate::R<bool, bool>;
243#[doc = "Write proxy for field `CKSEL`"]
244pub struct CKSEL_W<'a> {
245 w: &'a mut W,
246}
247impl<'a> CKSEL_W<'a> {
248 #[doc = r"Sets the field bit"]
249 #[inline(always)]
250 pub fn set_bit(self) -> &'a mut W {
251 self.bit(true)
252 }
253 #[doc = r"Clears the field bit"]
254 #[inline(always)]
255 pub fn clear_bit(self) -> &'a mut W {
256 self.bit(false)
257 }
258 #[doc = r"Writes raw bits to the field"]
259 #[inline(always)]
260 pub fn bit(self, value: bool) -> &'a mut W {
261 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
262 self.w
263 }
264}
265impl R {
266 #[doc = "Bit 24 - Encoder mode enable"]
267 #[inline(always)]
268 pub fn enc(&self) -> ENC_R {
269 ENC_R::new(((self.bits >> 24) & 0x01) != 0)
270 }
271 #[doc = "Bit 23 - counter mode enabled"]
272 #[inline(always)]
273 pub fn countmode(&self) -> COUNTMODE_R {
274 COUNTMODE_R::new(((self.bits >> 23) & 0x01) != 0)
275 }
276 #[doc = "Bit 22 - Registers update mode"]
277 #[inline(always)]
278 pub fn preload(&self) -> PRELOAD_R {
279 PRELOAD_R::new(((self.bits >> 22) & 0x01) != 0)
280 }
281 #[doc = "Bit 21 - Waveform shape polarity"]
282 #[inline(always)]
283 pub fn wavpol(&self) -> WAVPOL_R {
284 WAVPOL_R::new(((self.bits >> 21) & 0x01) != 0)
285 }
286 #[doc = "Bit 20 - Waveform shape"]
287 #[inline(always)]
288 pub fn wave(&self) -> WAVE_R {
289 WAVE_R::new(((self.bits >> 20) & 0x01) != 0)
290 }
291 #[doc = "Bit 19 - Timeout enable"]
292 #[inline(always)]
293 pub fn timout(&self) -> TIMOUT_R {
294 TIMOUT_R::new(((self.bits >> 19) & 0x01) != 0)
295 }
296 #[doc = "Bits 17:18 - Trigger enable and polarity"]
297 #[inline(always)]
298 pub fn trigen(&self) -> TRIGEN_R {
299 TRIGEN_R::new(((self.bits >> 17) & 0x03) as u8)
300 }
301 #[doc = "Bits 13:15 - Trigger selector"]
302 #[inline(always)]
303 pub fn trigsel(&self) -> TRIGSEL_R {
304 TRIGSEL_R::new(((self.bits >> 13) & 0x07) as u8)
305 }
306 #[doc = "Bits 9:11 - Clock prescaler"]
307 #[inline(always)]
308 pub fn presc(&self) -> PRESC_R {
309 PRESC_R::new(((self.bits >> 9) & 0x07) as u8)
310 }
311 #[doc = "Bits 6:7 - Configurable digital filter for trigger"]
312 #[inline(always)]
313 pub fn trgflt(&self) -> TRGFLT_R {
314 TRGFLT_R::new(((self.bits >> 6) & 0x03) as u8)
315 }
316 #[doc = "Bits 3:4 - Configurable digital filter for external clock"]
317 #[inline(always)]
318 pub fn ckflt(&self) -> CKFLT_R {
319 CKFLT_R::new(((self.bits >> 3) & 0x03) as u8)
320 }
321 #[doc = "Bits 1:2 - Clock Polarity"]
322 #[inline(always)]
323 pub fn ckpol(&self) -> CKPOL_R {
324 CKPOL_R::new(((self.bits >> 1) & 0x03) as u8)
325 }
326 #[doc = "Bit 0 - Clock selector"]
327 #[inline(always)]
328 pub fn cksel(&self) -> CKSEL_R {
329 CKSEL_R::new((self.bits & 0x01) != 0)
330 }
331}
332impl W {
333 #[doc = "Bit 24 - Encoder mode enable"]
334 #[inline(always)]
335 pub fn enc(&mut self) -> ENC_W {
336 ENC_W { w: self }
337 }
338 #[doc = "Bit 23 - counter mode enabled"]
339 #[inline(always)]
340 pub fn countmode(&mut self) -> COUNTMODE_W {
341 COUNTMODE_W { w: self }
342 }
343 #[doc = "Bit 22 - Registers update mode"]
344 #[inline(always)]
345 pub fn preload(&mut self) -> PRELOAD_W {
346 PRELOAD_W { w: self }
347 }
348 #[doc = "Bit 21 - Waveform shape polarity"]
349 #[inline(always)]
350 pub fn wavpol(&mut self) -> WAVPOL_W {
351 WAVPOL_W { w: self }
352 }
353 #[doc = "Bit 20 - Waveform shape"]
354 #[inline(always)]
355 pub fn wave(&mut self) -> WAVE_W {
356 WAVE_W { w: self }
357 }
358 #[doc = "Bit 19 - Timeout enable"]
359 #[inline(always)]
360 pub fn timout(&mut self) -> TIMOUT_W {
361 TIMOUT_W { w: self }
362 }
363 #[doc = "Bits 17:18 - Trigger enable and polarity"]
364 #[inline(always)]
365 pub fn trigen(&mut self) -> TRIGEN_W {
366 TRIGEN_W { w: self }
367 }
368 #[doc = "Bits 13:15 - Trigger selector"]
369 #[inline(always)]
370 pub fn trigsel(&mut self) -> TRIGSEL_W {
371 TRIGSEL_W { w: self }
372 }
373 #[doc = "Bits 9:11 - Clock prescaler"]
374 #[inline(always)]
375 pub fn presc(&mut self) -> PRESC_W {
376 PRESC_W { w: self }
377 }
378 #[doc = "Bits 6:7 - Configurable digital filter for trigger"]
379 #[inline(always)]
380 pub fn trgflt(&mut self) -> TRGFLT_W {
381 TRGFLT_W { w: self }
382 }
383 #[doc = "Bits 3:4 - Configurable digital filter for external clock"]
384 #[inline(always)]
385 pub fn ckflt(&mut self) -> CKFLT_W {
386 CKFLT_W { w: self }
387 }
388 #[doc = "Bits 1:2 - Clock Polarity"]
389 #[inline(always)]
390 pub fn ckpol(&mut self) -> CKPOL_W {
391 CKPOL_W { w: self }
392 }
393 #[doc = "Bit 0 - Clock selector"]
394 #[inline(always)]
395 pub fn cksel(&mut self) -> CKSEL_W {
396 CKSEL_W { w: self }
397 }
398}