stm32f30x/comp/comp3_csr/
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::COMP3_CSR {
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 COMP3ENR {
47 bits: bool,
48}
49impl COMP3ENR {
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 COMP3MODER {
68 bits: u8,
69}
70impl COMP3MODER {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bits(&self) -> u8 {
74 self.bits
75 }
76}
77#[doc = r" Value of the field"]
78pub struct COMP3INSELR {
79 bits: u8,
80}
81impl COMP3INSELR {
82 #[doc = r" Value of the field as raw bits"]
83 #[inline]
84 pub fn bits(&self) -> u8 {
85 self.bits
86 }
87}
88#[doc = r" Value of the field"]
89pub struct COMP3INPSELR {
90 bits: bool,
91}
92impl COMP3INPSELR {
93 #[doc = r" Value of the field as raw bits"]
94 #[inline]
95 pub fn bit(&self) -> bool {
96 self.bits
97 }
98 #[doc = r" Returns `true` if the bit is clear (0)"]
99 #[inline]
100 pub fn bit_is_clear(&self) -> bool {
101 !self.bit()
102 }
103 #[doc = r" Returns `true` if the bit is set (1)"]
104 #[inline]
105 pub fn bit_is_set(&self) -> bool {
106 self.bit()
107 }
108}
109#[doc = r" Value of the field"]
110pub struct COMP3_OUT_SELR {
111 bits: u8,
112}
113impl COMP3_OUT_SELR {
114 #[doc = r" Value of the field as raw bits"]
115 #[inline]
116 pub fn bits(&self) -> u8 {
117 self.bits
118 }
119}
120#[doc = r" Value of the field"]
121pub struct COMP3POLR {
122 bits: bool,
123}
124impl COMP3POLR {
125 #[doc = r" Value of the field as raw bits"]
126 #[inline]
127 pub fn bit(&self) -> bool {
128 self.bits
129 }
130 #[doc = r" Returns `true` if the bit is clear (0)"]
131 #[inline]
132 pub fn bit_is_clear(&self) -> bool {
133 !self.bit()
134 }
135 #[doc = r" Returns `true` if the bit is set (1)"]
136 #[inline]
137 pub fn bit_is_set(&self) -> bool {
138 self.bit()
139 }
140}
141#[doc = r" Value of the field"]
142pub struct COMP3HYSTR {
143 bits: u8,
144}
145impl COMP3HYSTR {
146 #[doc = r" Value of the field as raw bits"]
147 #[inline]
148 pub fn bits(&self) -> u8 {
149 self.bits
150 }
151}
152#[doc = r" Value of the field"]
153pub struct COMP3_BLANKINGR {
154 bits: u8,
155}
156impl COMP3_BLANKINGR {
157 #[doc = r" Value of the field as raw bits"]
158 #[inline]
159 pub fn bits(&self) -> u8 {
160 self.bits
161 }
162}
163#[doc = r" Value of the field"]
164pub struct COMP3OUTR {
165 bits: bool,
166}
167impl COMP3OUTR {
168 #[doc = r" Value of the field as raw bits"]
169 #[inline]
170 pub fn bit(&self) -> bool {
171 self.bits
172 }
173 #[doc = r" Returns `true` if the bit is clear (0)"]
174 #[inline]
175 pub fn bit_is_clear(&self) -> bool {
176 !self.bit()
177 }
178 #[doc = r" Returns `true` if the bit is set (1)"]
179 #[inline]
180 pub fn bit_is_set(&self) -> bool {
181 self.bit()
182 }
183}
184#[doc = r" Value of the field"]
185pub struct COMP3LOCKR {
186 bits: bool,
187}
188impl COMP3LOCKR {
189 #[doc = r" Value of the field as raw bits"]
190 #[inline]
191 pub fn bit(&self) -> bool {
192 self.bits
193 }
194 #[doc = r" Returns `true` if the bit is clear (0)"]
195 #[inline]
196 pub fn bit_is_clear(&self) -> bool {
197 !self.bit()
198 }
199 #[doc = r" Returns `true` if the bit is set (1)"]
200 #[inline]
201 pub fn bit_is_set(&self) -> bool {
202 self.bit()
203 }
204}
205#[doc = r" Proxy"]
206pub struct _COMP3ENW<'a> {
207 w: &'a mut W,
208}
209impl<'a> _COMP3ENW<'a> {
210 #[doc = r" Sets the field bit"]
211 pub fn set_bit(self) -> &'a mut W {
212 self.bit(true)
213 }
214 #[doc = r" Clears the field bit"]
215 pub fn clear_bit(self) -> &'a mut W {
216 self.bit(false)
217 }
218 #[doc = r" Writes raw bits to the field"]
219 #[inline]
220 pub fn bit(self, value: bool) -> &'a mut W {
221 const MASK: bool = true;
222 const OFFSET: u8 = 0;
223 self.w.bits &= !((MASK as u32) << OFFSET);
224 self.w.bits |= ((value & MASK) as u32) << OFFSET;
225 self.w
226 }
227}
228#[doc = r" Proxy"]
229pub struct _COMP3MODEW<'a> {
230 w: &'a mut W,
231}
232impl<'a> _COMP3MODEW<'a> {
233 #[doc = r" Writes raw bits to the field"]
234 #[inline]
235 pub unsafe fn bits(self, value: u8) -> &'a mut W {
236 const MASK: u8 = 3;
237 const OFFSET: u8 = 2;
238 self.w.bits &= !((MASK as u32) << OFFSET);
239 self.w.bits |= ((value & MASK) as u32) << OFFSET;
240 self.w
241 }
242}
243#[doc = r" Proxy"]
244pub struct _COMP3INSELW<'a> {
245 w: &'a mut W,
246}
247impl<'a> _COMP3INSELW<'a> {
248 #[doc = r" Writes raw bits to the field"]
249 #[inline]
250 pub unsafe fn bits(self, value: u8) -> &'a mut W {
251 const MASK: u8 = 7;
252 const OFFSET: u8 = 4;
253 self.w.bits &= !((MASK as u32) << OFFSET);
254 self.w.bits |= ((value & MASK) as u32) << OFFSET;
255 self.w
256 }
257}
258#[doc = r" Proxy"]
259pub struct _COMP3INPSELW<'a> {
260 w: &'a mut W,
261}
262impl<'a> _COMP3INPSELW<'a> {
263 #[doc = r" Sets the field bit"]
264 pub fn set_bit(self) -> &'a mut W {
265 self.bit(true)
266 }
267 #[doc = r" Clears the field bit"]
268 pub fn clear_bit(self) -> &'a mut W {
269 self.bit(false)
270 }
271 #[doc = r" Writes raw bits to the field"]
272 #[inline]
273 pub fn bit(self, value: bool) -> &'a mut W {
274 const MASK: bool = true;
275 const OFFSET: u8 = 7;
276 self.w.bits &= !((MASK as u32) << OFFSET);
277 self.w.bits |= ((value & MASK) as u32) << OFFSET;
278 self.w
279 }
280}
281#[doc = r" Proxy"]
282pub struct _COMP3_OUT_SELW<'a> {
283 w: &'a mut W,
284}
285impl<'a> _COMP3_OUT_SELW<'a> {
286 #[doc = r" Writes raw bits to the field"]
287 #[inline]
288 pub unsafe fn bits(self, value: u8) -> &'a mut W {
289 const MASK: u8 = 15;
290 const OFFSET: u8 = 10;
291 self.w.bits &= !((MASK as u32) << OFFSET);
292 self.w.bits |= ((value & MASK) as u32) << OFFSET;
293 self.w
294 }
295}
296#[doc = r" Proxy"]
297pub struct _COMP3POLW<'a> {
298 w: &'a mut W,
299}
300impl<'a> _COMP3POLW<'a> {
301 #[doc = r" Sets the field bit"]
302 pub fn set_bit(self) -> &'a mut W {
303 self.bit(true)
304 }
305 #[doc = r" Clears the field bit"]
306 pub fn clear_bit(self) -> &'a mut W {
307 self.bit(false)
308 }
309 #[doc = r" Writes raw bits to the field"]
310 #[inline]
311 pub fn bit(self, value: bool) -> &'a mut W {
312 const MASK: bool = true;
313 const OFFSET: u8 = 15;
314 self.w.bits &= !((MASK as u32) << OFFSET);
315 self.w.bits |= ((value & MASK) as u32) << OFFSET;
316 self.w
317 }
318}
319#[doc = r" Proxy"]
320pub struct _COMP3HYSTW<'a> {
321 w: &'a mut W,
322}
323impl<'a> _COMP3HYSTW<'a> {
324 #[doc = r" Writes raw bits to the field"]
325 #[inline]
326 pub unsafe fn bits(self, value: u8) -> &'a mut W {
327 const MASK: u8 = 3;
328 const OFFSET: u8 = 16;
329 self.w.bits &= !((MASK as u32) << OFFSET);
330 self.w.bits |= ((value & MASK) as u32) << OFFSET;
331 self.w
332 }
333}
334#[doc = r" Proxy"]
335pub struct _COMP3_BLANKINGW<'a> {
336 w: &'a mut W,
337}
338impl<'a> _COMP3_BLANKINGW<'a> {
339 #[doc = r" Writes raw bits to the field"]
340 #[inline]
341 pub unsafe fn bits(self, value: u8) -> &'a mut W {
342 const MASK: u8 = 7;
343 const OFFSET: u8 = 18;
344 self.w.bits &= !((MASK as u32) << OFFSET);
345 self.w.bits |= ((value & MASK) as u32) << OFFSET;
346 self.w
347 }
348}
349#[doc = r" Proxy"]
350pub struct _COMP3LOCKW<'a> {
351 w: &'a mut W,
352}
353impl<'a> _COMP3LOCKW<'a> {
354 #[doc = r" Sets the field bit"]
355 pub fn set_bit(self) -> &'a mut W {
356 self.bit(true)
357 }
358 #[doc = r" Clears the field bit"]
359 pub fn clear_bit(self) -> &'a mut W {
360 self.bit(false)
361 }
362 #[doc = r" Writes raw bits to the field"]
363 #[inline]
364 pub fn bit(self, value: bool) -> &'a mut W {
365 const MASK: bool = true;
366 const OFFSET: u8 = 31;
367 self.w.bits &= !((MASK as u32) << OFFSET);
368 self.w.bits |= ((value & MASK) as u32) << OFFSET;
369 self.w
370 }
371}
372impl R {
373 #[doc = r" Value of the register as raw bits"]
374 #[inline]
375 pub fn bits(&self) -> u32 {
376 self.bits
377 }
378 #[doc = "Bit 0 - Comparator 3 enable"]
379 #[inline]
380 pub fn comp3en(&self) -> COMP3ENR {
381 let bits = {
382 const MASK: bool = true;
383 const OFFSET: u8 = 0;
384 ((self.bits >> OFFSET) & MASK as u32) != 0
385 };
386 COMP3ENR { bits }
387 }
388 #[doc = "Bits 2:3 - Comparator 3 mode"]
389 #[inline]
390 pub fn comp3mode(&self) -> COMP3MODER {
391 let bits = {
392 const MASK: u8 = 3;
393 const OFFSET: u8 = 2;
394 ((self.bits >> OFFSET) & MASK as u32) as u8
395 };
396 COMP3MODER { bits }
397 }
398 #[doc = "Bits 4:6 - Comparator 3 inverting input selection"]
399 #[inline]
400 pub fn comp3insel(&self) -> COMP3INSELR {
401 let bits = {
402 const MASK: u8 = 7;
403 const OFFSET: u8 = 4;
404 ((self.bits >> OFFSET) & MASK as u32) as u8
405 };
406 COMP3INSELR { bits }
407 }
408 #[doc = "Bit 7 - Comparator 3 non inverted input selection"]
409 #[inline]
410 pub fn comp3inpsel(&self) -> COMP3INPSELR {
411 let bits = {
412 const MASK: bool = true;
413 const OFFSET: u8 = 7;
414 ((self.bits >> OFFSET) & MASK as u32) != 0
415 };
416 COMP3INPSELR { bits }
417 }
418 #[doc = "Bits 10:13 - Comparator 3 output selection"]
419 #[inline]
420 pub fn comp3_out_sel(&self) -> COMP3_OUT_SELR {
421 let bits = {
422 const MASK: u8 = 15;
423 const OFFSET: u8 = 10;
424 ((self.bits >> OFFSET) & MASK as u32) as u8
425 };
426 COMP3_OUT_SELR { bits }
427 }
428 #[doc = "Bit 15 - Comparator 3 output polarity"]
429 #[inline]
430 pub fn comp3pol(&self) -> COMP3POLR {
431 let bits = {
432 const MASK: bool = true;
433 const OFFSET: u8 = 15;
434 ((self.bits >> OFFSET) & MASK as u32) != 0
435 };
436 COMP3POLR { bits }
437 }
438 #[doc = "Bits 16:17 - Comparator 3 hysteresis"]
439 #[inline]
440 pub fn comp3hyst(&self) -> COMP3HYSTR {
441 let bits = {
442 const MASK: u8 = 3;
443 const OFFSET: u8 = 16;
444 ((self.bits >> OFFSET) & MASK as u32) as u8
445 };
446 COMP3HYSTR { bits }
447 }
448 #[doc = "Bits 18:20 - Comparator 3 blanking source"]
449 #[inline]
450 pub fn comp3_blanking(&self) -> COMP3_BLANKINGR {
451 let bits = {
452 const MASK: u8 = 7;
453 const OFFSET: u8 = 18;
454 ((self.bits >> OFFSET) & MASK as u32) as u8
455 };
456 COMP3_BLANKINGR { bits }
457 }
458 #[doc = "Bit 30 - Comparator 3 output"]
459 #[inline]
460 pub fn comp3out(&self) -> COMP3OUTR {
461 let bits = {
462 const MASK: bool = true;
463 const OFFSET: u8 = 30;
464 ((self.bits >> OFFSET) & MASK as u32) != 0
465 };
466 COMP3OUTR { bits }
467 }
468 #[doc = "Bit 31 - Comparator 3 lock"]
469 #[inline]
470 pub fn comp3lock(&self) -> COMP3LOCKR {
471 let bits = {
472 const MASK: bool = true;
473 const OFFSET: u8 = 31;
474 ((self.bits >> OFFSET) & MASK as u32) != 0
475 };
476 COMP3LOCKR { bits }
477 }
478}
479impl W {
480 #[doc = r" Reset value of the register"]
481 #[inline]
482 pub fn reset_value() -> W {
483 W { bits: 0 }
484 }
485 #[doc = r" Writes raw bits to the register"]
486 #[inline]
487 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
488 self.bits = bits;
489 self
490 }
491 #[doc = "Bit 0 - Comparator 3 enable"]
492 #[inline]
493 pub fn comp3en(&mut self) -> _COMP3ENW {
494 _COMP3ENW { w: self }
495 }
496 #[doc = "Bits 2:3 - Comparator 3 mode"]
497 #[inline]
498 pub fn comp3mode(&mut self) -> _COMP3MODEW {
499 _COMP3MODEW { w: self }
500 }
501 #[doc = "Bits 4:6 - Comparator 3 inverting input selection"]
502 #[inline]
503 pub fn comp3insel(&mut self) -> _COMP3INSELW {
504 _COMP3INSELW { w: self }
505 }
506 #[doc = "Bit 7 - Comparator 3 non inverted input selection"]
507 #[inline]
508 pub fn comp3inpsel(&mut self) -> _COMP3INPSELW {
509 _COMP3INPSELW { w: self }
510 }
511 #[doc = "Bits 10:13 - Comparator 3 output selection"]
512 #[inline]
513 pub fn comp3_out_sel(&mut self) -> _COMP3_OUT_SELW {
514 _COMP3_OUT_SELW { w: self }
515 }
516 #[doc = "Bit 15 - Comparator 3 output polarity"]
517 #[inline]
518 pub fn comp3pol(&mut self) -> _COMP3POLW {
519 _COMP3POLW { w: self }
520 }
521 #[doc = "Bits 16:17 - Comparator 3 hysteresis"]
522 #[inline]
523 pub fn comp3hyst(&mut self) -> _COMP3HYSTW {
524 _COMP3HYSTW { w: self }
525 }
526 #[doc = "Bits 18:20 - Comparator 3 blanking source"]
527 #[inline]
528 pub fn comp3_blanking(&mut self) -> _COMP3_BLANKINGW {
529 _COMP3_BLANKINGW { w: self }
530 }
531 #[doc = "Bit 31 - Comparator 3 lock"]
532 #[inline]
533 pub fn comp3lock(&mut self) -> _COMP3LOCKW {
534 _COMP3LOCKW { w: self }
535 }
536}