atsame70q21/rtc/
rtc_timalr.rs1#[doc = "Register `RTC_TIMALR` reader"]
2pub struct R(crate::R<RTC_TIMALR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RTC_TIMALR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RTC_TIMALR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RTC_TIMALR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RTC_TIMALR` writer"]
17pub struct W(crate::W<RTC_TIMALR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RTC_TIMALR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<RTC_TIMALR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RTC_TIMALR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SEC` reader - Second Alarm"]
38pub struct SEC_R(crate::FieldReader<u8, u8>);
39impl SEC_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 SEC_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for SEC_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `SEC` writer - Second Alarm"]
53pub struct SEC_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> SEC_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x7f) | (value as u32 & 0x7f);
61 self.w
62 }
63}
64#[doc = "Field `SECEN` reader - Second Alarm Enable"]
65pub struct SECEN_R(crate::FieldReader<bool, bool>);
66impl SECEN_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: bool) -> Self {
69 SECEN_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for SECEN_R {
73 type Target = crate::FieldReader<bool, bool>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `SECEN` writer - Second Alarm Enable"]
80pub struct SECEN_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> SECEN_W<'a> {
84 #[doc = r"Sets the field bit"]
85 #[inline(always)]
86 pub fn set_bit(self) -> &'a mut W {
87 self.bit(true)
88 }
89 #[doc = r"Clears the field bit"]
90 #[inline(always)]
91 pub fn clear_bit(self) -> &'a mut W {
92 self.bit(false)
93 }
94 #[doc = r"Writes raw bits to the field"]
95 #[inline(always)]
96 pub fn bit(self, value: bool) -> &'a mut W {
97 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
98 self.w
99 }
100}
101#[doc = "Field `MIN` reader - Minute Alarm"]
102pub struct MIN_R(crate::FieldReader<u8, u8>);
103impl MIN_R {
104 #[inline(always)]
105 pub(crate) fn new(bits: u8) -> Self {
106 MIN_R(crate::FieldReader::new(bits))
107 }
108}
109impl core::ops::Deref for MIN_R {
110 type Target = crate::FieldReader<u8, u8>;
111 #[inline(always)]
112 fn deref(&self) -> &Self::Target {
113 &self.0
114 }
115}
116#[doc = "Field `MIN` writer - Minute Alarm"]
117pub struct MIN_W<'a> {
118 w: &'a mut W,
119}
120impl<'a> MIN_W<'a> {
121 #[doc = r"Writes raw bits to the field"]
122 #[inline(always)]
123 pub unsafe fn bits(self, value: u8) -> &'a mut W {
124 self.w.bits = (self.w.bits & !(0x7f << 8)) | ((value as u32 & 0x7f) << 8);
125 self.w
126 }
127}
128#[doc = "Field `MINEN` reader - Minute Alarm Enable"]
129pub struct MINEN_R(crate::FieldReader<bool, bool>);
130impl MINEN_R {
131 #[inline(always)]
132 pub(crate) fn new(bits: bool) -> Self {
133 MINEN_R(crate::FieldReader::new(bits))
134 }
135}
136impl core::ops::Deref for MINEN_R {
137 type Target = crate::FieldReader<bool, bool>;
138 #[inline(always)]
139 fn deref(&self) -> &Self::Target {
140 &self.0
141 }
142}
143#[doc = "Field `MINEN` writer - Minute Alarm Enable"]
144pub struct MINEN_W<'a> {
145 w: &'a mut W,
146}
147impl<'a> MINEN_W<'a> {
148 #[doc = r"Sets the field bit"]
149 #[inline(always)]
150 pub fn set_bit(self) -> &'a mut W {
151 self.bit(true)
152 }
153 #[doc = r"Clears the field bit"]
154 #[inline(always)]
155 pub fn clear_bit(self) -> &'a mut W {
156 self.bit(false)
157 }
158 #[doc = r"Writes raw bits to the field"]
159 #[inline(always)]
160 pub fn bit(self, value: bool) -> &'a mut W {
161 self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
162 self.w
163 }
164}
165#[doc = "Field `HOUR` reader - Hour Alarm"]
166pub struct HOUR_R(crate::FieldReader<u8, u8>);
167impl HOUR_R {
168 #[inline(always)]
169 pub(crate) fn new(bits: u8) -> Self {
170 HOUR_R(crate::FieldReader::new(bits))
171 }
172}
173impl core::ops::Deref for HOUR_R {
174 type Target = crate::FieldReader<u8, u8>;
175 #[inline(always)]
176 fn deref(&self) -> &Self::Target {
177 &self.0
178 }
179}
180#[doc = "Field `HOUR` writer - Hour Alarm"]
181pub struct HOUR_W<'a> {
182 w: &'a mut W,
183}
184impl<'a> HOUR_W<'a> {
185 #[doc = r"Writes raw bits to the field"]
186 #[inline(always)]
187 pub unsafe fn bits(self, value: u8) -> &'a mut W {
188 self.w.bits = (self.w.bits & !(0x3f << 16)) | ((value as u32 & 0x3f) << 16);
189 self.w
190 }
191}
192#[doc = "Field `AMPM` reader - AM/PM Indicator"]
193pub struct AMPM_R(crate::FieldReader<bool, bool>);
194impl AMPM_R {
195 #[inline(always)]
196 pub(crate) fn new(bits: bool) -> Self {
197 AMPM_R(crate::FieldReader::new(bits))
198 }
199}
200impl core::ops::Deref for AMPM_R {
201 type Target = crate::FieldReader<bool, bool>;
202 #[inline(always)]
203 fn deref(&self) -> &Self::Target {
204 &self.0
205 }
206}
207#[doc = "Field `AMPM` writer - AM/PM Indicator"]
208pub struct AMPM_W<'a> {
209 w: &'a mut W,
210}
211impl<'a> AMPM_W<'a> {
212 #[doc = r"Sets the field bit"]
213 #[inline(always)]
214 pub fn set_bit(self) -> &'a mut W {
215 self.bit(true)
216 }
217 #[doc = r"Clears the field bit"]
218 #[inline(always)]
219 pub fn clear_bit(self) -> &'a mut W {
220 self.bit(false)
221 }
222 #[doc = r"Writes raw bits to the field"]
223 #[inline(always)]
224 pub fn bit(self, value: bool) -> &'a mut W {
225 self.w.bits = (self.w.bits & !(0x01 << 22)) | ((value as u32 & 0x01) << 22);
226 self.w
227 }
228}
229#[doc = "Field `HOUREN` reader - Hour Alarm Enable"]
230pub struct HOUREN_R(crate::FieldReader<bool, bool>);
231impl HOUREN_R {
232 #[inline(always)]
233 pub(crate) fn new(bits: bool) -> Self {
234 HOUREN_R(crate::FieldReader::new(bits))
235 }
236}
237impl core::ops::Deref for HOUREN_R {
238 type Target = crate::FieldReader<bool, bool>;
239 #[inline(always)]
240 fn deref(&self) -> &Self::Target {
241 &self.0
242 }
243}
244#[doc = "Field `HOUREN` writer - Hour Alarm Enable"]
245pub struct HOUREN_W<'a> {
246 w: &'a mut W,
247}
248impl<'a> HOUREN_W<'a> {
249 #[doc = r"Sets the field bit"]
250 #[inline(always)]
251 pub fn set_bit(self) -> &'a mut W {
252 self.bit(true)
253 }
254 #[doc = r"Clears the field bit"]
255 #[inline(always)]
256 pub fn clear_bit(self) -> &'a mut W {
257 self.bit(false)
258 }
259 #[doc = r"Writes raw bits to the field"]
260 #[inline(always)]
261 pub fn bit(self, value: bool) -> &'a mut W {
262 self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
263 self.w
264 }
265}
266impl R {
267 #[doc = "Bits 0:6 - Second Alarm"]
268 #[inline(always)]
269 pub fn sec(&self) -> SEC_R {
270 SEC_R::new((self.bits & 0x7f) as u8)
271 }
272 #[doc = "Bit 7 - Second Alarm Enable"]
273 #[inline(always)]
274 pub fn secen(&self) -> SECEN_R {
275 SECEN_R::new(((self.bits >> 7) & 0x01) != 0)
276 }
277 #[doc = "Bits 8:14 - Minute Alarm"]
278 #[inline(always)]
279 pub fn min(&self) -> MIN_R {
280 MIN_R::new(((self.bits >> 8) & 0x7f) as u8)
281 }
282 #[doc = "Bit 15 - Minute Alarm Enable"]
283 #[inline(always)]
284 pub fn minen(&self) -> MINEN_R {
285 MINEN_R::new(((self.bits >> 15) & 0x01) != 0)
286 }
287 #[doc = "Bits 16:21 - Hour Alarm"]
288 #[inline(always)]
289 pub fn hour(&self) -> HOUR_R {
290 HOUR_R::new(((self.bits >> 16) & 0x3f) as u8)
291 }
292 #[doc = "Bit 22 - AM/PM Indicator"]
293 #[inline(always)]
294 pub fn ampm(&self) -> AMPM_R {
295 AMPM_R::new(((self.bits >> 22) & 0x01) != 0)
296 }
297 #[doc = "Bit 23 - Hour Alarm Enable"]
298 #[inline(always)]
299 pub fn houren(&self) -> HOUREN_R {
300 HOUREN_R::new(((self.bits >> 23) & 0x01) != 0)
301 }
302}
303impl W {
304 #[doc = "Bits 0:6 - Second Alarm"]
305 #[inline(always)]
306 pub fn sec(&mut self) -> SEC_W {
307 SEC_W { w: self }
308 }
309 #[doc = "Bit 7 - Second Alarm Enable"]
310 #[inline(always)]
311 pub fn secen(&mut self) -> SECEN_W {
312 SECEN_W { w: self }
313 }
314 #[doc = "Bits 8:14 - Minute Alarm"]
315 #[inline(always)]
316 pub fn min(&mut self) -> MIN_W {
317 MIN_W { w: self }
318 }
319 #[doc = "Bit 15 - Minute Alarm Enable"]
320 #[inline(always)]
321 pub fn minen(&mut self) -> MINEN_W {
322 MINEN_W { w: self }
323 }
324 #[doc = "Bits 16:21 - Hour Alarm"]
325 #[inline(always)]
326 pub fn hour(&mut self) -> HOUR_W {
327 HOUR_W { w: self }
328 }
329 #[doc = "Bit 22 - AM/PM Indicator"]
330 #[inline(always)]
331 pub fn ampm(&mut self) -> AMPM_W {
332 AMPM_W { w: self }
333 }
334 #[doc = "Bit 23 - Hour Alarm Enable"]
335 #[inline(always)]
336 pub fn houren(&mut self) -> HOUREN_W {
337 HOUREN_W { w: self }
338 }
339 #[doc = "Writes raw bits to the register."]
340 #[inline(always)]
341 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
342 self.0.bits(bits);
343 self
344 }
345}
346#[doc = "Time Alarm Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rtc_timalr](index.html) module"]
347pub struct RTC_TIMALR_SPEC;
348impl crate::RegisterSpec for RTC_TIMALR_SPEC {
349 type Ux = u32;
350}
351#[doc = "`read()` method returns [rtc_timalr::R](R) reader structure"]
352impl crate::Readable for RTC_TIMALR_SPEC {
353 type Reader = R;
354}
355#[doc = "`write(|w| ..)` method takes [rtc_timalr::W](W) writer structure"]
356impl crate::Writable for RTC_TIMALR_SPEC {
357 type Writer = W;
358}
359#[doc = "`reset()` method sets RTC_TIMALR to value 0"]
360impl crate::Resettable for RTC_TIMALR_SPEC {
361 #[inline(always)]
362 fn reset_value() -> Self::Ux {
363 0
364 }
365}