atsame70q21/rtc/
rtc_calalr.rs1#[doc = "Register `RTC_CALALR` reader"]
2pub struct R(crate::R<RTC_CALALR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RTC_CALALR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RTC_CALALR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RTC_CALALR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RTC_CALALR` writer"]
17pub struct W(crate::W<RTC_CALALR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RTC_CALALR_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_CALALR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RTC_CALALR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MONTH` reader - Month Alarm"]
38pub struct MONTH_R(crate::FieldReader<u8, u8>);
39impl MONTH_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 MONTH_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for MONTH_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 `MONTH` writer - Month Alarm"]
53pub struct MONTH_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> MONTH_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 & !(0x1f << 16)) | ((value as u32 & 0x1f) << 16);
61 self.w
62 }
63}
64#[doc = "Field `MTHEN` reader - Month Alarm Enable"]
65pub struct MTHEN_R(crate::FieldReader<bool, bool>);
66impl MTHEN_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: bool) -> Self {
69 MTHEN_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for MTHEN_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 `MTHEN` writer - Month Alarm Enable"]
80pub struct MTHEN_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> MTHEN_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 << 23)) | ((value as u32 & 0x01) << 23);
98 self.w
99 }
100}
101#[doc = "Field `DATE` reader - Date Alarm"]
102pub struct DATE_R(crate::FieldReader<u8, u8>);
103impl DATE_R {
104 #[inline(always)]
105 pub(crate) fn new(bits: u8) -> Self {
106 DATE_R(crate::FieldReader::new(bits))
107 }
108}
109impl core::ops::Deref for DATE_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 `DATE` writer - Date Alarm"]
117pub struct DATE_W<'a> {
118 w: &'a mut W,
119}
120impl<'a> DATE_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 & !(0x3f << 24)) | ((value as u32 & 0x3f) << 24);
125 self.w
126 }
127}
128#[doc = "Field `DATEEN` reader - Date Alarm Enable"]
129pub struct DATEEN_R(crate::FieldReader<bool, bool>);
130impl DATEEN_R {
131 #[inline(always)]
132 pub(crate) fn new(bits: bool) -> Self {
133 DATEEN_R(crate::FieldReader::new(bits))
134 }
135}
136impl core::ops::Deref for DATEEN_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 `DATEEN` writer - Date Alarm Enable"]
144pub struct DATEEN_W<'a> {
145 w: &'a mut W,
146}
147impl<'a> DATEEN_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 << 31)) | ((value as u32 & 0x01) << 31);
162 self.w
163 }
164}
165impl R {
166 #[doc = "Bits 16:20 - Month Alarm"]
167 #[inline(always)]
168 pub fn month(&self) -> MONTH_R {
169 MONTH_R::new(((self.bits >> 16) & 0x1f) as u8)
170 }
171 #[doc = "Bit 23 - Month Alarm Enable"]
172 #[inline(always)]
173 pub fn mthen(&self) -> MTHEN_R {
174 MTHEN_R::new(((self.bits >> 23) & 0x01) != 0)
175 }
176 #[doc = "Bits 24:29 - Date Alarm"]
177 #[inline(always)]
178 pub fn date(&self) -> DATE_R {
179 DATE_R::new(((self.bits >> 24) & 0x3f) as u8)
180 }
181 #[doc = "Bit 31 - Date Alarm Enable"]
182 #[inline(always)]
183 pub fn dateen(&self) -> DATEEN_R {
184 DATEEN_R::new(((self.bits >> 31) & 0x01) != 0)
185 }
186}
187impl W {
188 #[doc = "Bits 16:20 - Month Alarm"]
189 #[inline(always)]
190 pub fn month(&mut self) -> MONTH_W {
191 MONTH_W { w: self }
192 }
193 #[doc = "Bit 23 - Month Alarm Enable"]
194 #[inline(always)]
195 pub fn mthen(&mut self) -> MTHEN_W {
196 MTHEN_W { w: self }
197 }
198 #[doc = "Bits 24:29 - Date Alarm"]
199 #[inline(always)]
200 pub fn date(&mut self) -> DATE_W {
201 DATE_W { w: self }
202 }
203 #[doc = "Bit 31 - Date Alarm Enable"]
204 #[inline(always)]
205 pub fn dateen(&mut self) -> DATEEN_W {
206 DATEEN_W { w: self }
207 }
208 #[doc = "Writes raw bits to the register."]
209 #[inline(always)]
210 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
211 self.0.bits(bits);
212 self
213 }
214}
215#[doc = "Calendar 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_calalr](index.html) module"]
216pub struct RTC_CALALR_SPEC;
217impl crate::RegisterSpec for RTC_CALALR_SPEC {
218 type Ux = u32;
219}
220#[doc = "`read()` method returns [rtc_calalr::R](R) reader structure"]
221impl crate::Readable for RTC_CALALR_SPEC {
222 type Reader = R;
223}
224#[doc = "`write(|w| ..)` method takes [rtc_calalr::W](W) writer structure"]
225impl crate::Writable for RTC_CALALR_SPEC {
226 type Writer = W;
227}
228#[doc = "`reset()` method sets RTC_CALALR to value 0"]
229impl crate::Resettable for RTC_CALALR_SPEC {
230 #[inline(always)]
231 fn reset_value() -> Self::Ux {
232 0
233 }
234}