stm32f0/stm32f0x2/rtc/
tr.rs1pub type R = crate::R<TRrs>;
3pub type W = crate::W<TRrs>;
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>;
13pub type MNU_R = crate::FieldReader;
15pub type MNU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
17pub type MNT_R = crate::FieldReader;
19pub type MNT_W<'a, REG> = crate::FieldWriter<'a, REG, 3, u8, crate::Safe>;
21pub type HU_R = crate::FieldReader;
23pub type HU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
25pub type HT_R = crate::FieldReader;
27pub type HT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, u8, crate::Safe>;
29#[cfg_attr(feature = "defmt", derive(defmt::Format))]
33#[derive(Clone, Copy, Debug, PartialEq, Eq)]
34pub enum PM {
35 Am = 0,
37 Pm = 1,
39}
40impl From<PM> for bool {
41 #[inline(always)]
42 fn from(variant: PM) -> Self {
43 variant as u8 != 0
44 }
45}
46pub type PM_R = crate::BitReader<PM>;
48impl PM_R {
49 #[inline(always)]
51 pub const fn variant(&self) -> PM {
52 match self.bits {
53 false => PM::Am,
54 true => PM::Pm,
55 }
56 }
57 #[inline(always)]
59 pub fn is_am(&self) -> bool {
60 *self == PM::Am
61 }
62 #[inline(always)]
64 pub fn is_pm(&self) -> bool {
65 *self == PM::Pm
66 }
67}
68pub type PM_W<'a, REG> = crate::BitWriter<'a, REG, PM>;
70impl<'a, REG> PM_W<'a, REG>
71where
72 REG: crate::Writable + crate::RegisterSpec,
73{
74 #[inline(always)]
76 pub fn am(self) -> &'a mut crate::W<REG> {
77 self.variant(PM::Am)
78 }
79 #[inline(always)]
81 pub fn pm(self) -> &'a mut crate::W<REG> {
82 self.variant(PM::Pm)
83 }
84}
85impl R {
86 #[inline(always)]
88 pub fn su(&self) -> SU_R {
89 SU_R::new((self.bits & 0x0f) as u8)
90 }
91 #[inline(always)]
93 pub fn st(&self) -> ST_R {
94 ST_R::new(((self.bits >> 4) & 7) as u8)
95 }
96 #[inline(always)]
98 pub fn mnu(&self) -> MNU_R {
99 MNU_R::new(((self.bits >> 8) & 0x0f) as u8)
100 }
101 #[inline(always)]
103 pub fn mnt(&self) -> MNT_R {
104 MNT_R::new(((self.bits >> 12) & 7) as u8)
105 }
106 #[inline(always)]
108 pub fn hu(&self) -> HU_R {
109 HU_R::new(((self.bits >> 16) & 0x0f) as u8)
110 }
111 #[inline(always)]
113 pub fn ht(&self) -> HT_R {
114 HT_R::new(((self.bits >> 20) & 3) as u8)
115 }
116 #[inline(always)]
118 pub fn pm(&self) -> PM_R {
119 PM_R::new(((self.bits >> 22) & 1) != 0)
120 }
121}
122impl core::fmt::Debug for R {
123 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
124 f.debug_struct("TR")
125 .field("pm", &self.pm())
126 .field("ht", &self.ht())
127 .field("hu", &self.hu())
128 .field("mnt", &self.mnt())
129 .field("mnu", &self.mnu())
130 .field("st", &self.st())
131 .field("su", &self.su())
132 .finish()
133 }
134}
135impl W {
136 #[inline(always)]
138 pub fn su(&mut self) -> SU_W<TRrs> {
139 SU_W::new(self, 0)
140 }
141 #[inline(always)]
143 pub fn st(&mut self) -> ST_W<TRrs> {
144 ST_W::new(self, 4)
145 }
146 #[inline(always)]
148 pub fn mnu(&mut self) -> MNU_W<TRrs> {
149 MNU_W::new(self, 8)
150 }
151 #[inline(always)]
153 pub fn mnt(&mut self) -> MNT_W<TRrs> {
154 MNT_W::new(self, 12)
155 }
156 #[inline(always)]
158 pub fn hu(&mut self) -> HU_W<TRrs> {
159 HU_W::new(self, 16)
160 }
161 #[inline(always)]
163 pub fn ht(&mut self) -> HT_W<TRrs> {
164 HT_W::new(self, 20)
165 }
166 #[inline(always)]
168 pub fn pm(&mut self) -> PM_W<TRrs> {
169 PM_W::new(self, 22)
170 }
171}
172pub struct TRrs;
178impl crate::RegisterSpec for TRrs {
179 type Ux = u32;
180}
181impl crate::Readable for TRrs {}
183impl crate::Writable for TRrs {
185 type Safety = crate::Unsafe;
186}
187impl crate::Resettable for TRrs {}