stm32g0_staging/stm32g0b0/rtc/
alrmr.rs1pub type R = crate::R<ALRMRrs>;
3pub type W = crate::W<ALRMRrs>;
5pub type SU_R = crate::FieldReader;
7pub type SU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
9pub type ST_R = crate::FieldReader;
11pub type ST_W<'a, REG> = crate::FieldWriter<'a, REG, 3, u8, crate::Safe>;
13#[cfg_attr(feature = "defmt", derive(defmt::Format))]
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18pub enum MSK1 {
19 Mask = 0,
21 NotMask = 1,
23}
24impl From<MSK1> for bool {
25 #[inline(always)]
26 fn from(variant: MSK1) -> Self {
27 variant as u8 != 0
28 }
29}
30pub type MSK1_R = crate::BitReader<MSK1>;
32impl MSK1_R {
33 #[inline(always)]
35 pub const fn variant(&self) -> MSK1 {
36 match self.bits {
37 false => MSK1::Mask,
38 true => MSK1::NotMask,
39 }
40 }
41 #[inline(always)]
43 pub fn is_mask(&self) -> bool {
44 *self == MSK1::Mask
45 }
46 #[inline(always)]
48 pub fn is_not_mask(&self) -> bool {
49 *self == MSK1::NotMask
50 }
51}
52pub type MSK1_W<'a, REG> = crate::BitWriter<'a, REG, MSK1>;
54impl<'a, REG> MSK1_W<'a, REG>
55where
56 REG: crate::Writable + crate::RegisterSpec,
57{
58 #[inline(always)]
60 pub fn mask(self) -> &'a mut crate::W<REG> {
61 self.variant(MSK1::Mask)
62 }
63 #[inline(always)]
65 pub fn not_mask(self) -> &'a mut crate::W<REG> {
66 self.variant(MSK1::NotMask)
67 }
68}
69pub type MNU_R = crate::FieldReader;
71pub type MNU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
73pub type MNT_R = crate::FieldReader;
75pub type MNT_W<'a, REG> = crate::FieldWriter<'a, REG, 3, u8, crate::Safe>;
77pub use MSK1_R as MSK2_R;
79pub use MSK1_W as MSK2_W;
81pub type HU_R = crate::FieldReader;
83pub type HU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
85pub type HT_R = crate::FieldReader;
87pub type HT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, u8, crate::Safe>;
89#[cfg_attr(feature = "defmt", derive(defmt::Format))]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94pub enum PM {
95 Am = 0,
97 Pm = 1,
99}
100impl From<PM> for bool {
101 #[inline(always)]
102 fn from(variant: PM) -> Self {
103 variant as u8 != 0
104 }
105}
106pub type PM_R = crate::BitReader<PM>;
108impl PM_R {
109 #[inline(always)]
111 pub const fn variant(&self) -> PM {
112 match self.bits {
113 false => PM::Am,
114 true => PM::Pm,
115 }
116 }
117 #[inline(always)]
119 pub fn is_am(&self) -> bool {
120 *self == PM::Am
121 }
122 #[inline(always)]
124 pub fn is_pm(&self) -> bool {
125 *self == PM::Pm
126 }
127}
128pub type PM_W<'a, REG> = crate::BitWriter<'a, REG, PM>;
130impl<'a, REG> PM_W<'a, REG>
131where
132 REG: crate::Writable + crate::RegisterSpec,
133{
134 #[inline(always)]
136 pub fn am(self) -> &'a mut crate::W<REG> {
137 self.variant(PM::Am)
138 }
139 #[inline(always)]
141 pub fn pm(self) -> &'a mut crate::W<REG> {
142 self.variant(PM::Pm)
143 }
144}
145pub use MSK1_R as MSK3_R;
147pub use MSK1_W as MSK3_W;
149pub type DU_R = crate::FieldReader;
151pub type DU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
153pub type DT_R = crate::FieldReader;
155pub type DT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, u8, crate::Safe>;
157#[cfg_attr(feature = "defmt", derive(defmt::Format))]
161#[derive(Clone, Copy, Debug, PartialEq, Eq)]
162pub enum WDSEL {
163 DateUnits = 0,
166 WeekDay = 1,
170}
171impl From<WDSEL> for bool {
172 #[inline(always)]
173 fn from(variant: WDSEL) -> Self {
174 variant as u8 != 0
175 }
176}
177pub type WDSEL_R = crate::BitReader<WDSEL>;
179impl WDSEL_R {
180 #[inline(always)]
182 pub const fn variant(&self) -> WDSEL {
183 match self.bits {
184 false => WDSEL::DateUnits,
185 true => WDSEL::WeekDay,
186 }
187 }
188 #[inline(always)]
191 pub fn is_date_units(&self) -> bool {
192 *self == WDSEL::DateUnits
193 }
194 #[inline(always)]
198 pub fn is_week_day(&self) -> bool {
199 *self == WDSEL::WeekDay
200 }
201}
202pub type WDSEL_W<'a, REG> = crate::BitWriter<'a, REG, WDSEL>;
204impl<'a, REG> WDSEL_W<'a, REG>
205where
206 REG: crate::Writable + crate::RegisterSpec,
207{
208 #[inline(always)]
211 pub fn date_units(self) -> &'a mut crate::W<REG> {
212 self.variant(WDSEL::DateUnits)
213 }
214 #[inline(always)]
218 pub fn week_day(self) -> &'a mut crate::W<REG> {
219 self.variant(WDSEL::WeekDay)
220 }
221}
222pub use MSK1_R as MSK4_R;
224pub use MSK1_W as MSK4_W;
226impl R {
227 #[inline(always)]
229 pub fn su(&self) -> SU_R {
230 SU_R::new((self.bits & 0x0f) as u8)
231 }
232 #[inline(always)]
234 pub fn st(&self) -> ST_R {
235 ST_R::new(((self.bits >> 4) & 7) as u8)
236 }
237 #[inline(always)]
239 pub fn msk1(&self) -> MSK1_R {
240 MSK1_R::new(((self.bits >> 7) & 1) != 0)
241 }
242 #[inline(always)]
244 pub fn mnu(&self) -> MNU_R {
245 MNU_R::new(((self.bits >> 8) & 0x0f) as u8)
246 }
247 #[inline(always)]
249 pub fn mnt(&self) -> MNT_R {
250 MNT_R::new(((self.bits >> 12) & 7) as u8)
251 }
252 #[inline(always)]
254 pub fn msk2(&self) -> MSK2_R {
255 MSK2_R::new(((self.bits >> 15) & 1) != 0)
256 }
257 #[inline(always)]
259 pub fn hu(&self) -> HU_R {
260 HU_R::new(((self.bits >> 16) & 0x0f) as u8)
261 }
262 #[inline(always)]
264 pub fn ht(&self) -> HT_R {
265 HT_R::new(((self.bits >> 20) & 3) as u8)
266 }
267 #[inline(always)]
269 pub fn pm(&self) -> PM_R {
270 PM_R::new(((self.bits >> 22) & 1) != 0)
271 }
272 #[inline(always)]
274 pub fn msk3(&self) -> MSK3_R {
275 MSK3_R::new(((self.bits >> 23) & 1) != 0)
276 }
277 #[inline(always)]
279 pub fn du(&self) -> DU_R {
280 DU_R::new(((self.bits >> 24) & 0x0f) as u8)
281 }
282 #[inline(always)]
284 pub fn dt(&self) -> DT_R {
285 DT_R::new(((self.bits >> 28) & 3) as u8)
286 }
287 #[inline(always)]
289 pub fn wdsel(&self) -> WDSEL_R {
290 WDSEL_R::new(((self.bits >> 30) & 1) != 0)
291 }
292 #[inline(always)]
294 pub fn msk4(&self) -> MSK4_R {
295 MSK4_R::new(((self.bits >> 31) & 1) != 0)
296 }
297}
298impl core::fmt::Debug for R {
299 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
300 f.debug_struct("ALRMR")
301 .field("su", &self.su())
302 .field("st", &self.st())
303 .field("msk1", &self.msk1())
304 .field("mnu", &self.mnu())
305 .field("mnt", &self.mnt())
306 .field("msk2", &self.msk2())
307 .field("hu", &self.hu())
308 .field("ht", &self.ht())
309 .field("pm", &self.pm())
310 .field("msk3", &self.msk3())
311 .field("du", &self.du())
312 .field("dt", &self.dt())
313 .field("wdsel", &self.wdsel())
314 .field("msk4", &self.msk4())
315 .finish()
316 }
317}
318impl W {
319 #[inline(always)]
321 pub fn su(&mut self) -> SU_W<ALRMRrs> {
322 SU_W::new(self, 0)
323 }
324 #[inline(always)]
326 pub fn st(&mut self) -> ST_W<ALRMRrs> {
327 ST_W::new(self, 4)
328 }
329 #[inline(always)]
331 pub fn msk1(&mut self) -> MSK1_W<ALRMRrs> {
332 MSK1_W::new(self, 7)
333 }
334 #[inline(always)]
336 pub fn mnu(&mut self) -> MNU_W<ALRMRrs> {
337 MNU_W::new(self, 8)
338 }
339 #[inline(always)]
341 pub fn mnt(&mut self) -> MNT_W<ALRMRrs> {
342 MNT_W::new(self, 12)
343 }
344 #[inline(always)]
346 pub fn msk2(&mut self) -> MSK2_W<ALRMRrs> {
347 MSK2_W::new(self, 15)
348 }
349 #[inline(always)]
351 pub fn hu(&mut self) -> HU_W<ALRMRrs> {
352 HU_W::new(self, 16)
353 }
354 #[inline(always)]
356 pub fn ht(&mut self) -> HT_W<ALRMRrs> {
357 HT_W::new(self, 20)
358 }
359 #[inline(always)]
361 pub fn pm(&mut self) -> PM_W<ALRMRrs> {
362 PM_W::new(self, 22)
363 }
364 #[inline(always)]
366 pub fn msk3(&mut self) -> MSK3_W<ALRMRrs> {
367 MSK3_W::new(self, 23)
368 }
369 #[inline(always)]
371 pub fn du(&mut self) -> DU_W<ALRMRrs> {
372 DU_W::new(self, 24)
373 }
374 #[inline(always)]
376 pub fn dt(&mut self) -> DT_W<ALRMRrs> {
377 DT_W::new(self, 28)
378 }
379 #[inline(always)]
381 pub fn wdsel(&mut self) -> WDSEL_W<ALRMRrs> {
382 WDSEL_W::new(self, 30)
383 }
384 #[inline(always)]
386 pub fn msk4(&mut self) -> MSK4_W<ALRMRrs> {
387 MSK4_W::new(self, 31)
388 }
389}
390pub struct ALRMRrs;
396impl crate::RegisterSpec for ALRMRrs {
397 type Ux = u32;
398}
399impl crate::Readable for ALRMRrs {}
401impl crate::Writable for ALRMRrs {
403 type Safety = crate::Unsafe;
404 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
405 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
406}
407impl crate::Resettable for ALRMRrs {
409 const RESET_VALUE: u32 = 0;
410}