stm32wb_pac/rcc/
csr.rs

1#[doc = "Reader of register CSR"]
2pub type R = crate::R<u32, super::CSR>;
3#[doc = "Writer for register CSR"]
4pub type W = crate::W<u32, super::CSR>;
5#[doc = "Register CSR `reset()`'s with value 0x0c00_0000"]
6impl crate::ResetValue for super::CSR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0c00_0000
11    }
12}
13#[doc = "Reader of field `LPWRRSTF`"]
14pub type LPWRRSTF_R = crate::R<bool, bool>;
15#[doc = "Reader of field `WWDGRSTF`"]
16pub type WWDGRSTF_R = crate::R<bool, bool>;
17#[doc = "Reader of field `IWDGRSTF`"]
18pub type IWDGRSTF_R = crate::R<bool, bool>;
19#[doc = "Reader of field `SFTRSTF`"]
20pub type SFTRSTF_R = crate::R<bool, bool>;
21#[doc = "Reader of field `BORRSTF`"]
22pub type BORRSTF_R = crate::R<bool, bool>;
23#[doc = "Reader of field `PINRSTF`"]
24pub type PINRSTF_R = crate::R<bool, bool>;
25#[doc = "Reader of field `OBLRSTF`"]
26pub type OBLRSTF_R = crate::R<bool, bool>;
27#[doc = "Reader of field `RMVF`"]
28pub type RMVF_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `RMVF`"]
30pub struct RMVF_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> RMVF_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 << 23)) | (((value as u32) & 0x01) << 23);
48        self.w
49    }
50}
51#[doc = "Reader of field `RFWKPSEL`"]
52pub type RFWKPSEL_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `RFWKPSEL`"]
54pub struct RFWKPSEL_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> RFWKPSEL_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 & !(0x03 << 14)) | (((value as u32) & 0x03) << 14);
62        self.w
63    }
64}
65#[doc = "Reader of field `LSI2BW`"]
66pub type LSI2BW_R = crate::R<u8, u8>;
67#[doc = "Write proxy for field `LSI2BW`"]
68pub struct LSI2BW_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> LSI2BW_W<'a> {
72    #[doc = r"Writes raw bits to the field"]
73    #[inline(always)]
74    pub unsafe fn bits(self, value: u8) -> &'a mut W {
75        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
76        self.w
77    }
78}
79#[doc = "Reader of field `LSI2TRIMOK`"]
80pub type LSI2TRIMOK_R = crate::R<bool, bool>;
81#[doc = "Reader of field `LSI2TRIMEN`"]
82pub type LSI2TRIMEN_R = crate::R<bool, bool>;
83#[doc = "Write proxy for field `LSI2TRIMEN`"]
84pub struct LSI2TRIMEN_W<'a> {
85    w: &'a mut W,
86}
87impl<'a> LSI2TRIMEN_W<'a> {
88    #[doc = r"Sets the field bit"]
89    #[inline(always)]
90    pub fn set_bit(self) -> &'a mut W {
91        self.bit(true)
92    }
93    #[doc = r"Clears the field bit"]
94    #[inline(always)]
95    pub fn clear_bit(self) -> &'a mut W {
96        self.bit(false)
97    }
98    #[doc = r"Writes raw bits to the field"]
99    #[inline(always)]
100    pub fn bit(self, value: bool) -> &'a mut W {
101        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
102        self.w
103    }
104}
105#[doc = "Reader of field `LSI2RDY`"]
106pub type LSI2RDY_R = crate::R<bool, bool>;
107#[doc = "Reader of field `LSI2ON`"]
108pub type LSI2ON_R = crate::R<bool, bool>;
109#[doc = "Write proxy for field `LSI2ON`"]
110pub struct LSI2ON_W<'a> {
111    w: &'a mut W,
112}
113impl<'a> LSI2ON_W<'a> {
114    #[doc = r"Sets the field bit"]
115    #[inline(always)]
116    pub fn set_bit(self) -> &'a mut W {
117        self.bit(true)
118    }
119    #[doc = r"Clears the field bit"]
120    #[inline(always)]
121    pub fn clear_bit(self) -> &'a mut W {
122        self.bit(false)
123    }
124    #[doc = r"Writes raw bits to the field"]
125    #[inline(always)]
126    pub fn bit(self, value: bool) -> &'a mut W {
127        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
128        self.w
129    }
130}
131#[doc = "Reader of field `LSI1RDY`"]
132pub type LSI1RDY_R = crate::R<bool, bool>;
133#[doc = "Reader of field `LSI1ON`"]
134pub type LSI1ON_R = crate::R<bool, bool>;
135#[doc = "Write proxy for field `LSI1ON`"]
136pub struct LSI1ON_W<'a> {
137    w: &'a mut W,
138}
139impl<'a> LSI1ON_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) | ((value as u32) & 0x01);
154        self.w
155    }
156}
157#[doc = "Reader of field `RFRSTS`"]
158pub type RFRSTS_R = crate::R<bool, bool>;
159impl R {
160    #[doc = "Bit 31 - Low-power reset flag"]
161    #[inline(always)]
162    pub fn lpwrrstf(&self) -> LPWRRSTF_R {
163        LPWRRSTF_R::new(((self.bits >> 31) & 0x01) != 0)
164    }
165    #[doc = "Bit 30 - Window watchdog reset flag"]
166    #[inline(always)]
167    pub fn wwdgrstf(&self) -> WWDGRSTF_R {
168        WWDGRSTF_R::new(((self.bits >> 30) & 0x01) != 0)
169    }
170    #[doc = "Bit 29 - Independent window watchdog reset flag"]
171    #[inline(always)]
172    pub fn iwdgrstf(&self) -> IWDGRSTF_R {
173        IWDGRSTF_R::new(((self.bits >> 29) & 0x01) != 0)
174    }
175    #[doc = "Bit 28 - Software reset flag"]
176    #[inline(always)]
177    pub fn sftrstf(&self) -> SFTRSTF_R {
178        SFTRSTF_R::new(((self.bits >> 28) & 0x01) != 0)
179    }
180    #[doc = "Bit 27 - BOR flag"]
181    #[inline(always)]
182    pub fn borrstf(&self) -> BORRSTF_R {
183        BORRSTF_R::new(((self.bits >> 27) & 0x01) != 0)
184    }
185    #[doc = "Bit 26 - Pin reset flag"]
186    #[inline(always)]
187    pub fn pinrstf(&self) -> PINRSTF_R {
188        PINRSTF_R::new(((self.bits >> 26) & 0x01) != 0)
189    }
190    #[doc = "Bit 25 - Option byte loader reset flag"]
191    #[inline(always)]
192    pub fn oblrstf(&self) -> OBLRSTF_R {
193        OBLRSTF_R::new(((self.bits >> 25) & 0x01) != 0)
194    }
195    #[doc = "Bit 23 - Remove reset flag"]
196    #[inline(always)]
197    pub fn rmvf(&self) -> RMVF_R {
198        RMVF_R::new(((self.bits >> 23) & 0x01) != 0)
199    }
200    #[doc = "Bits 14:15 - RF system wakeup clock source selection"]
201    #[inline(always)]
202    pub fn rfwkpsel(&self) -> RFWKPSEL_R {
203        RFWKPSEL_R::new(((self.bits >> 14) & 0x03) as u8)
204    }
205    #[doc = "Bits 8:11 - LSI2 oscillator bias configuration"]
206    #[inline(always)]
207    pub fn lsi2bw(&self) -> LSI2BW_R {
208        LSI2BW_R::new(((self.bits >> 8) & 0x0f) as u8)
209    }
210    #[doc = "Bit 5 - LSI2 oscillator trim OK"]
211    #[inline(always)]
212    pub fn lsi2trimok(&self) -> LSI2TRIMOK_R {
213        LSI2TRIMOK_R::new(((self.bits >> 5) & 0x01) != 0)
214    }
215    #[doc = "Bit 4 - LSI2 oscillator trimming enable"]
216    #[inline(always)]
217    pub fn lsi2trimen(&self) -> LSI2TRIMEN_R {
218        LSI2TRIMEN_R::new(((self.bits >> 4) & 0x01) != 0)
219    }
220    #[doc = "Bit 3 - LSI2 oscillator ready"]
221    #[inline(always)]
222    pub fn lsi2rdy(&self) -> LSI2RDY_R {
223        LSI2RDY_R::new(((self.bits >> 3) & 0x01) != 0)
224    }
225    #[doc = "Bit 2 - LSI2 oscillator enabled"]
226    #[inline(always)]
227    pub fn lsi2on(&self) -> LSI2ON_R {
228        LSI2ON_R::new(((self.bits >> 2) & 0x01) != 0)
229    }
230    #[doc = "Bit 1 - LSI1 oscillator ready"]
231    #[inline(always)]
232    pub fn lsi1rdy(&self) -> LSI1RDY_R {
233        LSI1RDY_R::new(((self.bits >> 1) & 0x01) != 0)
234    }
235    #[doc = "Bit 0 - LSI1 oscillator enabled"]
236    #[inline(always)]
237    pub fn lsi1on(&self) -> LSI1ON_R {
238        LSI1ON_R::new((self.bits & 0x01) != 0)
239    }
240    #[doc = "Bit 16 - Radio system BLE and 802.15.4 reset status"]
241    #[inline(always)]
242    pub fn rfrsts(&self) -> RFRSTS_R {
243        RFRSTS_R::new(((self.bits >> 16) & 0x01) != 0)
244    }
245}
246impl W {
247    #[doc = "Bit 23 - Remove reset flag"]
248    #[inline(always)]
249    pub fn rmvf(&mut self) -> RMVF_W {
250        RMVF_W { w: self }
251    }
252    #[doc = "Bits 14:15 - RF system wakeup clock source selection"]
253    #[inline(always)]
254    pub fn rfwkpsel(&mut self) -> RFWKPSEL_W {
255        RFWKPSEL_W { w: self }
256    }
257    #[doc = "Bits 8:11 - LSI2 oscillator bias configuration"]
258    #[inline(always)]
259    pub fn lsi2bw(&mut self) -> LSI2BW_W {
260        LSI2BW_W { w: self }
261    }
262    #[doc = "Bit 4 - LSI2 oscillator trimming enable"]
263    #[inline(always)]
264    pub fn lsi2trimen(&mut self) -> LSI2TRIMEN_W {
265        LSI2TRIMEN_W { w: self }
266    }
267    #[doc = "Bit 2 - LSI2 oscillator enabled"]
268    #[inline(always)]
269    pub fn lsi2on(&mut self) -> LSI2ON_W {
270        LSI2ON_W { w: self }
271    }
272    #[doc = "Bit 0 - LSI1 oscillator enabled"]
273    #[inline(always)]
274    pub fn lsi1on(&mut self) -> LSI1ON_W {
275        LSI1ON_W { w: self }
276    }
277}