stm32wb_pac/rtc/
alrmbr.rs

1#[doc = "Reader of register ALRMBR"]
2pub type R = crate::R<u32, super::ALRMBR>;
3#[doc = "Writer for register ALRMBR"]
4pub type W = crate::W<u32, super::ALRMBR>;
5#[doc = "Register ALRMBR `reset()`'s with value 0"]
6impl crate::ResetValue for super::ALRMBR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `MSK4`"]
14pub type MSK4_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `MSK4`"]
16pub struct MSK4_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> MSK4_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 << 31)) | (((value as u32) & 0x01) << 31);
34        self.w
35    }
36}
37#[doc = "Reader of field `WDSEL`"]
38pub type WDSEL_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `WDSEL`"]
40pub struct WDSEL_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> WDSEL_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 << 30)) | (((value as u32) & 0x01) << 30);
58        self.w
59    }
60}
61#[doc = "Reader of field `DT`"]
62pub type DT_R = crate::R<u8, u8>;
63#[doc = "Write proxy for field `DT`"]
64pub struct DT_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> DT_W<'a> {
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub unsafe fn bits(self, value: u8) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x03 << 28)) | (((value as u32) & 0x03) << 28);
72        self.w
73    }
74}
75#[doc = "Reader of field `DU`"]
76pub type DU_R = crate::R<u8, u8>;
77#[doc = "Write proxy for field `DU`"]
78pub struct DU_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> DU_W<'a> {
82    #[doc = r"Writes raw bits to the field"]
83    #[inline(always)]
84    pub unsafe fn bits(self, value: u8) -> &'a mut W {
85        self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24);
86        self.w
87    }
88}
89#[doc = "Reader of field `MSK3`"]
90pub type MSK3_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `MSK3`"]
92pub struct MSK3_W<'a> {
93    w: &'a mut W,
94}
95impl<'a> MSK3_W<'a> {
96    #[doc = r"Sets the field bit"]
97    #[inline(always)]
98    pub fn set_bit(self) -> &'a mut W {
99        self.bit(true)
100    }
101    #[doc = r"Clears the field bit"]
102    #[inline(always)]
103    pub fn clear_bit(self) -> &'a mut W {
104        self.bit(false)
105    }
106    #[doc = r"Writes raw bits to the field"]
107    #[inline(always)]
108    pub fn bit(self, value: bool) -> &'a mut W {
109        self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23);
110        self.w
111    }
112}
113#[doc = "Reader of field `PM`"]
114pub type PM_R = crate::R<bool, bool>;
115#[doc = "Write proxy for field `PM`"]
116pub struct PM_W<'a> {
117    w: &'a mut W,
118}
119impl<'a> PM_W<'a> {
120    #[doc = r"Sets the field bit"]
121    #[inline(always)]
122    pub fn set_bit(self) -> &'a mut W {
123        self.bit(true)
124    }
125    #[doc = r"Clears the field bit"]
126    #[inline(always)]
127    pub fn clear_bit(self) -> &'a mut W {
128        self.bit(false)
129    }
130    #[doc = r"Writes raw bits to the field"]
131    #[inline(always)]
132    pub fn bit(self, value: bool) -> &'a mut W {
133        self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22);
134        self.w
135    }
136}
137#[doc = "Reader of field `HT`"]
138pub type HT_R = crate::R<u8, u8>;
139#[doc = "Write proxy for field `HT`"]
140pub struct HT_W<'a> {
141    w: &'a mut W,
142}
143impl<'a> HT_W<'a> {
144    #[doc = r"Writes raw bits to the field"]
145    #[inline(always)]
146    pub unsafe fn bits(self, value: u8) -> &'a mut W {
147        self.w.bits = (self.w.bits & !(0x03 << 20)) | (((value as u32) & 0x03) << 20);
148        self.w
149    }
150}
151#[doc = "Reader of field `HU`"]
152pub type HU_R = crate::R<u8, u8>;
153#[doc = "Write proxy for field `HU`"]
154pub struct HU_W<'a> {
155    w: &'a mut W,
156}
157impl<'a> HU_W<'a> {
158    #[doc = r"Writes raw bits to the field"]
159    #[inline(always)]
160    pub unsafe fn bits(self, value: u8) -> &'a mut W {
161        self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
162        self.w
163    }
164}
165#[doc = "Reader of field `MSK2`"]
166pub type MSK2_R = crate::R<bool, bool>;
167#[doc = "Write proxy for field `MSK2`"]
168pub struct MSK2_W<'a> {
169    w: &'a mut W,
170}
171impl<'a> MSK2_W<'a> {
172    #[doc = r"Sets the field bit"]
173    #[inline(always)]
174    pub fn set_bit(self) -> &'a mut W {
175        self.bit(true)
176    }
177    #[doc = r"Clears the field bit"]
178    #[inline(always)]
179    pub fn clear_bit(self) -> &'a mut W {
180        self.bit(false)
181    }
182    #[doc = r"Writes raw bits to the field"]
183    #[inline(always)]
184    pub fn bit(self, value: bool) -> &'a mut W {
185        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
186        self.w
187    }
188}
189#[doc = "Reader of field `MNT`"]
190pub type MNT_R = crate::R<u8, u8>;
191#[doc = "Write proxy for field `MNT`"]
192pub struct MNT_W<'a> {
193    w: &'a mut W,
194}
195impl<'a> MNT_W<'a> {
196    #[doc = r"Writes raw bits to the field"]
197    #[inline(always)]
198    pub unsafe fn bits(self, value: u8) -> &'a mut W {
199        self.w.bits = (self.w.bits & !(0x07 << 12)) | (((value as u32) & 0x07) << 12);
200        self.w
201    }
202}
203#[doc = "Reader of field `MNU`"]
204pub type MNU_R = crate::R<u8, u8>;
205#[doc = "Write proxy for field `MNU`"]
206pub struct MNU_W<'a> {
207    w: &'a mut W,
208}
209impl<'a> MNU_W<'a> {
210    #[doc = r"Writes raw bits to the field"]
211    #[inline(always)]
212    pub unsafe fn bits(self, value: u8) -> &'a mut W {
213        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
214        self.w
215    }
216}
217#[doc = "Reader of field `MSK1`"]
218pub type MSK1_R = crate::R<bool, bool>;
219#[doc = "Write proxy for field `MSK1`"]
220pub struct MSK1_W<'a> {
221    w: &'a mut W,
222}
223impl<'a> MSK1_W<'a> {
224    #[doc = r"Sets the field bit"]
225    #[inline(always)]
226    pub fn set_bit(self) -> &'a mut W {
227        self.bit(true)
228    }
229    #[doc = r"Clears the field bit"]
230    #[inline(always)]
231    pub fn clear_bit(self) -> &'a mut W {
232        self.bit(false)
233    }
234    #[doc = r"Writes raw bits to the field"]
235    #[inline(always)]
236    pub fn bit(self, value: bool) -> &'a mut W {
237        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
238        self.w
239    }
240}
241#[doc = "Reader of field `ST`"]
242pub type ST_R = crate::R<u8, u8>;
243#[doc = "Write proxy for field `ST`"]
244pub struct ST_W<'a> {
245    w: &'a mut W,
246}
247impl<'a> ST_W<'a> {
248    #[doc = r"Writes raw bits to the field"]
249    #[inline(always)]
250    pub unsafe fn bits(self, value: u8) -> &'a mut W {
251        self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
252        self.w
253    }
254}
255#[doc = "Reader of field `SU`"]
256pub type SU_R = crate::R<u8, u8>;
257#[doc = "Write proxy for field `SU`"]
258pub struct SU_W<'a> {
259    w: &'a mut W,
260}
261impl<'a> SU_W<'a> {
262    #[doc = r"Writes raw bits to the field"]
263    #[inline(always)]
264    pub unsafe fn bits(self, value: u8) -> &'a mut W {
265        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
266        self.w
267    }
268}
269impl R {
270    #[doc = "Bit 31 - Alarm B date mask"]
271    #[inline(always)]
272    pub fn msk4(&self) -> MSK4_R {
273        MSK4_R::new(((self.bits >> 31) & 0x01) != 0)
274    }
275    #[doc = "Bit 30 - Week day selection"]
276    #[inline(always)]
277    pub fn wdsel(&self) -> WDSEL_R {
278        WDSEL_R::new(((self.bits >> 30) & 0x01) != 0)
279    }
280    #[doc = "Bits 28:29 - Date tens in BCD format"]
281    #[inline(always)]
282    pub fn dt(&self) -> DT_R {
283        DT_R::new(((self.bits >> 28) & 0x03) as u8)
284    }
285    #[doc = "Bits 24:27 - Date units or day in BCD format"]
286    #[inline(always)]
287    pub fn du(&self) -> DU_R {
288        DU_R::new(((self.bits >> 24) & 0x0f) as u8)
289    }
290    #[doc = "Bit 23 - Alarm B hours mask"]
291    #[inline(always)]
292    pub fn msk3(&self) -> MSK3_R {
293        MSK3_R::new(((self.bits >> 23) & 0x01) != 0)
294    }
295    #[doc = "Bit 22 - AM/PM notation"]
296    #[inline(always)]
297    pub fn pm(&self) -> PM_R {
298        PM_R::new(((self.bits >> 22) & 0x01) != 0)
299    }
300    #[doc = "Bits 20:21 - Hour tens in BCD format"]
301    #[inline(always)]
302    pub fn ht(&self) -> HT_R {
303        HT_R::new(((self.bits >> 20) & 0x03) as u8)
304    }
305    #[doc = "Bits 16:19 - Hour units in BCD format"]
306    #[inline(always)]
307    pub fn hu(&self) -> HU_R {
308        HU_R::new(((self.bits >> 16) & 0x0f) as u8)
309    }
310    #[doc = "Bit 15 - Alarm B minutes mask"]
311    #[inline(always)]
312    pub fn msk2(&self) -> MSK2_R {
313        MSK2_R::new(((self.bits >> 15) & 0x01) != 0)
314    }
315    #[doc = "Bits 12:14 - Minute tens in BCD format"]
316    #[inline(always)]
317    pub fn mnt(&self) -> MNT_R {
318        MNT_R::new(((self.bits >> 12) & 0x07) as u8)
319    }
320    #[doc = "Bits 8:11 - Minute units in BCD format"]
321    #[inline(always)]
322    pub fn mnu(&self) -> MNU_R {
323        MNU_R::new(((self.bits >> 8) & 0x0f) as u8)
324    }
325    #[doc = "Bit 7 - Alarm B seconds mask"]
326    #[inline(always)]
327    pub fn msk1(&self) -> MSK1_R {
328        MSK1_R::new(((self.bits >> 7) & 0x01) != 0)
329    }
330    #[doc = "Bits 4:6 - Second tens in BCD format"]
331    #[inline(always)]
332    pub fn st(&self) -> ST_R {
333        ST_R::new(((self.bits >> 4) & 0x07) as u8)
334    }
335    #[doc = "Bits 0:3 - Second units in BCD format"]
336    #[inline(always)]
337    pub fn su(&self) -> SU_R {
338        SU_R::new((self.bits & 0x0f) as u8)
339    }
340}
341impl W {
342    #[doc = "Bit 31 - Alarm B date mask"]
343    #[inline(always)]
344    pub fn msk4(&mut self) -> MSK4_W {
345        MSK4_W { w: self }
346    }
347    #[doc = "Bit 30 - Week day selection"]
348    #[inline(always)]
349    pub fn wdsel(&mut self) -> WDSEL_W {
350        WDSEL_W { w: self }
351    }
352    #[doc = "Bits 28:29 - Date tens in BCD format"]
353    #[inline(always)]
354    pub fn dt(&mut self) -> DT_W {
355        DT_W { w: self }
356    }
357    #[doc = "Bits 24:27 - Date units or day in BCD format"]
358    #[inline(always)]
359    pub fn du(&mut self) -> DU_W {
360        DU_W { w: self }
361    }
362    #[doc = "Bit 23 - Alarm B hours mask"]
363    #[inline(always)]
364    pub fn msk3(&mut self) -> MSK3_W {
365        MSK3_W { w: self }
366    }
367    #[doc = "Bit 22 - AM/PM notation"]
368    #[inline(always)]
369    pub fn pm(&mut self) -> PM_W {
370        PM_W { w: self }
371    }
372    #[doc = "Bits 20:21 - Hour tens in BCD format"]
373    #[inline(always)]
374    pub fn ht(&mut self) -> HT_W {
375        HT_W { w: self }
376    }
377    #[doc = "Bits 16:19 - Hour units in BCD format"]
378    #[inline(always)]
379    pub fn hu(&mut self) -> HU_W {
380        HU_W { w: self }
381    }
382    #[doc = "Bit 15 - Alarm B minutes mask"]
383    #[inline(always)]
384    pub fn msk2(&mut self) -> MSK2_W {
385        MSK2_W { w: self }
386    }
387    #[doc = "Bits 12:14 - Minute tens in BCD format"]
388    #[inline(always)]
389    pub fn mnt(&mut self) -> MNT_W {
390        MNT_W { w: self }
391    }
392    #[doc = "Bits 8:11 - Minute units in BCD format"]
393    #[inline(always)]
394    pub fn mnu(&mut self) -> MNU_W {
395        MNU_W { w: self }
396    }
397    #[doc = "Bit 7 - Alarm B seconds mask"]
398    #[inline(always)]
399    pub fn msk1(&mut self) -> MSK1_W {
400        MSK1_W { w: self }
401    }
402    #[doc = "Bits 4:6 - Second tens in BCD format"]
403    #[inline(always)]
404    pub fn st(&mut self) -> ST_W {
405        ST_W { w: self }
406    }
407    #[doc = "Bits 0:3 - Second units in BCD format"]
408    #[inline(always)]
409    pub fn su(&mut self) -> SU_W {
410        SU_W { w: self }
411    }
412}