stm32wb_pac/wwdg/
cfr.rs

1#[doc = "Reader of register CFR"]
2pub type R = crate::R<u32, super::CFR>;
3#[doc = "Writer for register CFR"]
4pub type W = crate::W<u32, super::CFR>;
5#[doc = "Register CFR `reset()`'s with value 0x7f"]
6impl crate::ResetValue for super::CFR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x7f
11    }
12}
13#[doc = "Reader of field `WDGTB`"]
14pub type WDGTB_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `WDGTB`"]
16pub struct WDGTB_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> WDGTB_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x07 << 11)) | (((value as u32) & 0x07) << 11);
24        self.w
25    }
26}
27#[doc = "Reader of field `EWI`"]
28pub type EWI_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `EWI`"]
30pub struct EWI_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> EWI_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
48        self.w
49    }
50}
51#[doc = "Reader of field `W`"]
52pub type W_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `W`"]
54pub struct W_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> W_W<'a> {
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub unsafe fn bits(self, value: u8) -> &'a mut W {
61        self.w.bits = (self.w.bits & !0x7f) | ((value as u32) & 0x7f);
62        self.w
63    }
64}
65impl R {
66    #[doc = "Bits 11:13 - Timer base"]
67    #[inline(always)]
68    pub fn wdgtb(&self) -> WDGTB_R {
69        WDGTB_R::new(((self.bits >> 11) & 0x07) as u8)
70    }
71    #[doc = "Bit 9 - Early wakeup interrupt"]
72    #[inline(always)]
73    pub fn ewi(&self) -> EWI_R {
74        EWI_R::new(((self.bits >> 9) & 0x01) != 0)
75    }
76    #[doc = "Bits 0:6 - 7-bit window value"]
77    #[inline(always)]
78    pub fn w(&self) -> W_R {
79        W_R::new((self.bits & 0x7f) as u8)
80    }
81}
82impl W {
83    #[doc = "Bits 11:13 - Timer base"]
84    #[inline(always)]
85    pub fn wdgtb(&mut self) -> WDGTB_W {
86        WDGTB_W { w: self }
87    }
88    #[doc = "Bit 9 - Early wakeup interrupt"]
89    #[inline(always)]
90    pub fn ewi(&mut self) -> EWI_W {
91        EWI_W { w: self }
92    }
93    #[doc = "Bits 0:6 - 7-bit window value"]
94    #[inline(always)]
95    pub fn w(&mut self) -> W_W {
96        W_W { w: self }
97    }
98}