at32f4xx_pac/at32f405/ertc/
date.rs1#[doc = "Register `DATE` reader"]
2pub type R = crate::R<DATE_SPEC>;
3#[doc = "Register `DATE` writer"]
4pub type W = crate::W<DATE_SPEC>;
5#[doc = "Field `DU` reader - Date units"]
6pub type DU_R = crate::FieldReader;
7#[doc = "Field `DU` writer - Date units"]
8pub type DU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
9#[doc = "Field `DT` reader - Date tens"]
10pub type DT_R = crate::FieldReader;
11#[doc = "Field `DT` writer - Date tens"]
12pub type DT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, u8, crate::Safe>;
13#[doc = "Field `MU` reader - Month units"]
14pub type MU_R = crate::FieldReader;
15#[doc = "Field `MU` writer - Month units"]
16pub type MU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
17#[doc = "Field `MT` reader - Month tens"]
18pub type MT_R = crate::BitReader;
19#[doc = "Field `MT` writer - Month tens"]
20pub type MT_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Week\n\nValue on reset: 1"]
22#[derive(Clone, Copy, Debug, PartialEq, Eq)]
23#[repr(u8)]
24pub enum WK_A {
25 #[doc = "1: Monday"]
26 Monday = 1,
27 #[doc = "2: Tuesday"]
28 Tuesday = 2,
29 #[doc = "3: Wednesday"]
30 Wednesday = 3,
31 #[doc = "4: Thursday"]
32 Thursday = 4,
33 #[doc = "5: Friday"]
34 Friday = 5,
35 #[doc = "6: Saturday"]
36 Saturday = 6,
37 #[doc = "7: Sunday"]
38 Sunday = 7,
39}
40impl From<WK_A> for u8 {
41 #[inline(always)]
42 fn from(variant: WK_A) -> Self {
43 variant as _
44 }
45}
46impl crate::FieldSpec for WK_A {
47 type Ux = u8;
48}
49impl crate::IsEnum for WK_A {}
50#[doc = "Field `WK` reader - Week"]
51pub type WK_R = crate::FieldReader<WK_A>;
52impl WK_R {
53 #[doc = "Get enumerated values variant"]
54 #[inline(always)]
55 pub const fn variant(&self) -> Option<WK_A> {
56 match self.bits {
57 1 => Some(WK_A::Monday),
58 2 => Some(WK_A::Tuesday),
59 3 => Some(WK_A::Wednesday),
60 4 => Some(WK_A::Thursday),
61 5 => Some(WK_A::Friday),
62 6 => Some(WK_A::Saturday),
63 7 => Some(WK_A::Sunday),
64 _ => None,
65 }
66 }
67 #[doc = "Monday"]
68 #[inline(always)]
69 pub fn is_monday(&self) -> bool {
70 *self == WK_A::Monday
71 }
72 #[doc = "Tuesday"]
73 #[inline(always)]
74 pub fn is_tuesday(&self) -> bool {
75 *self == WK_A::Tuesday
76 }
77 #[doc = "Wednesday"]
78 #[inline(always)]
79 pub fn is_wednesday(&self) -> bool {
80 *self == WK_A::Wednesday
81 }
82 #[doc = "Thursday"]
83 #[inline(always)]
84 pub fn is_thursday(&self) -> bool {
85 *self == WK_A::Thursday
86 }
87 #[doc = "Friday"]
88 #[inline(always)]
89 pub fn is_friday(&self) -> bool {
90 *self == WK_A::Friday
91 }
92 #[doc = "Saturday"]
93 #[inline(always)]
94 pub fn is_saturday(&self) -> bool {
95 *self == WK_A::Saturday
96 }
97 #[doc = "Sunday"]
98 #[inline(always)]
99 pub fn is_sunday(&self) -> bool {
100 *self == WK_A::Sunday
101 }
102}
103#[doc = "Field `WK` writer - Week"]
104pub type WK_W<'a, REG> = crate::FieldWriter<'a, REG, 3, WK_A>;
105impl<'a, REG> WK_W<'a, REG>
106where
107 REG: crate::Writable + crate::RegisterSpec,
108 REG::Ux: From<u8>,
109{
110 #[doc = "Monday"]
111 #[inline(always)]
112 pub fn monday(self) -> &'a mut crate::W<REG> {
113 self.variant(WK_A::Monday)
114 }
115 #[doc = "Tuesday"]
116 #[inline(always)]
117 pub fn tuesday(self) -> &'a mut crate::W<REG> {
118 self.variant(WK_A::Tuesday)
119 }
120 #[doc = "Wednesday"]
121 #[inline(always)]
122 pub fn wednesday(self) -> &'a mut crate::W<REG> {
123 self.variant(WK_A::Wednesday)
124 }
125 #[doc = "Thursday"]
126 #[inline(always)]
127 pub fn thursday(self) -> &'a mut crate::W<REG> {
128 self.variant(WK_A::Thursday)
129 }
130 #[doc = "Friday"]
131 #[inline(always)]
132 pub fn friday(self) -> &'a mut crate::W<REG> {
133 self.variant(WK_A::Friday)
134 }
135 #[doc = "Saturday"]
136 #[inline(always)]
137 pub fn saturday(self) -> &'a mut crate::W<REG> {
138 self.variant(WK_A::Saturday)
139 }
140 #[doc = "Sunday"]
141 #[inline(always)]
142 pub fn sunday(self) -> &'a mut crate::W<REG> {
143 self.variant(WK_A::Sunday)
144 }
145}
146#[doc = "Field `YU` reader - Year units"]
147pub type YU_R = crate::FieldReader;
148#[doc = "Field `YU` writer - Year units"]
149pub type YU_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
150#[doc = "Field `YT` reader - Year tens"]
151pub type YT_R = crate::FieldReader;
152#[doc = "Field `YT` writer - Year tens"]
153pub type YT_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
154impl R {
155 #[doc = "Bits 0:3 - Date units"]
156 #[inline(always)]
157 pub fn du(&self) -> DU_R {
158 DU_R::new((self.bits & 0x0f) as u8)
159 }
160 #[doc = "Bits 4:5 - Date tens"]
161 #[inline(always)]
162 pub fn dt(&self) -> DT_R {
163 DT_R::new(((self.bits >> 4) & 3) as u8)
164 }
165 #[doc = "Bits 8:11 - Month units"]
166 #[inline(always)]
167 pub fn mu(&self) -> MU_R {
168 MU_R::new(((self.bits >> 8) & 0x0f) as u8)
169 }
170 #[doc = "Bit 12 - Month tens"]
171 #[inline(always)]
172 pub fn mt(&self) -> MT_R {
173 MT_R::new(((self.bits >> 12) & 1) != 0)
174 }
175 #[doc = "Bits 13:15 - Week"]
176 #[inline(always)]
177 pub fn wk(&self) -> WK_R {
178 WK_R::new(((self.bits >> 13) & 7) as u8)
179 }
180 #[doc = "Bits 16:19 - Year units"]
181 #[inline(always)]
182 pub fn yu(&self) -> YU_R {
183 YU_R::new(((self.bits >> 16) & 0x0f) as u8)
184 }
185 #[doc = "Bits 20:23 - Year tens"]
186 #[inline(always)]
187 pub fn yt(&self) -> YT_R {
188 YT_R::new(((self.bits >> 20) & 0x0f) as u8)
189 }
190}
191impl core::fmt::Debug for R {
192 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
193 f.debug_struct("DATE")
194 .field("yt", &self.yt())
195 .field("yu", &self.yu())
196 .field("wk", &self.wk())
197 .field("mt", &self.mt())
198 .field("mu", &self.mu())
199 .field("dt", &self.dt())
200 .field("du", &self.du())
201 .finish()
202 }
203}
204impl W {
205 #[doc = "Bits 0:3 - Date units"]
206 #[inline(always)]
207 pub fn du(&mut self) -> DU_W<'_, DATE_SPEC> {
208 DU_W::new(self, 0)
209 }
210 #[doc = "Bits 4:5 - Date tens"]
211 #[inline(always)]
212 pub fn dt(&mut self) -> DT_W<'_, DATE_SPEC> {
213 DT_W::new(self, 4)
214 }
215 #[doc = "Bits 8:11 - Month units"]
216 #[inline(always)]
217 pub fn mu(&mut self) -> MU_W<'_, DATE_SPEC> {
218 MU_W::new(self, 8)
219 }
220 #[doc = "Bit 12 - Month tens"]
221 #[inline(always)]
222 pub fn mt(&mut self) -> MT_W<'_, DATE_SPEC> {
223 MT_W::new(self, 12)
224 }
225 #[doc = "Bits 13:15 - Week"]
226 #[inline(always)]
227 pub fn wk(&mut self) -> WK_W<'_, DATE_SPEC> {
228 WK_W::new(self, 13)
229 }
230 #[doc = "Bits 16:19 - Year units"]
231 #[inline(always)]
232 pub fn yu(&mut self) -> YU_W<'_, DATE_SPEC> {
233 YU_W::new(self, 16)
234 }
235 #[doc = "Bits 20:23 - Year tens"]
236 #[inline(always)]
237 pub fn yt(&mut self) -> YT_W<'_, DATE_SPEC> {
238 YT_W::new(self, 20)
239 }
240}
241#[doc = "date register\n\nYou can [`read`](crate::Reg::read) this register and get [`date::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`date::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
242pub struct DATE_SPEC;
243impl crate::RegisterSpec for DATE_SPEC {
244 type Ux = u32;
245}
246#[doc = "`read()` method returns [`date::R`](R) reader structure"]
247impl crate::Readable for DATE_SPEC {}
248#[doc = "`write(|w| ..)` method takes [`date::W`](W) writer structure"]
249impl crate::Writable for DATE_SPEC {
250 type Safety = crate::Unsafe;
251}
252#[doc = "`reset()` method sets DATE to value 0x2101"]
253impl crate::Resettable for DATE_SPEC {
254 const RESET_VALUE: u32 = 0x2101;
255}