atsam4sd32c_pac/rtc/
cr.rs1#[doc = "Register `CR` reader"]
2pub struct R(crate::R<CR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CR` writer"]
17pub struct W(crate::W<CR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR_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<CR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `UPDTIM` reader - Update Request Time Register"]
38pub type UPDTIM_R = crate::BitReader<bool>;
39#[doc = "Field `UPDTIM` writer - Update Request Time Register"]
40pub type UPDTIM_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
41#[doc = "Field `UPDCAL` reader - Update Request Calendar Register"]
42pub type UPDCAL_R = crate::BitReader<bool>;
43#[doc = "Field `UPDCAL` writer - Update Request Calendar Register"]
44pub type UPDCAL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
45#[doc = "Field `TIMEVSEL` reader - Time Event Selection"]
46pub type TIMEVSEL_R = crate::FieldReader<u8, TIMEVSEL_A>;
47#[doc = "Time Event Selection\n\nValue on reset: 0"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49#[repr(u8)]
50pub enum TIMEVSEL_A {
51 #[doc = "0: Minute change"]
52 MINUTE = 0,
53 #[doc = "1: Hour change"]
54 HOUR = 1,
55 #[doc = "2: Every day at midnight"]
56 MIDNIGHT = 2,
57 #[doc = "3: Every day at noon"]
58 NOON = 3,
59}
60impl From<TIMEVSEL_A> for u8 {
61 #[inline(always)]
62 fn from(variant: TIMEVSEL_A) -> Self {
63 variant as _
64 }
65}
66impl TIMEVSEL_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> TIMEVSEL_A {
70 match self.bits {
71 0 => TIMEVSEL_A::MINUTE,
72 1 => TIMEVSEL_A::HOUR,
73 2 => TIMEVSEL_A::MIDNIGHT,
74 3 => TIMEVSEL_A::NOON,
75 _ => unreachable!(),
76 }
77 }
78 #[doc = "Checks if the value of the field is `MINUTE`"]
79 #[inline(always)]
80 pub fn is_minute(&self) -> bool {
81 *self == TIMEVSEL_A::MINUTE
82 }
83 #[doc = "Checks if the value of the field is `HOUR`"]
84 #[inline(always)]
85 pub fn is_hour(&self) -> bool {
86 *self == TIMEVSEL_A::HOUR
87 }
88 #[doc = "Checks if the value of the field is `MIDNIGHT`"]
89 #[inline(always)]
90 pub fn is_midnight(&self) -> bool {
91 *self == TIMEVSEL_A::MIDNIGHT
92 }
93 #[doc = "Checks if the value of the field is `NOON`"]
94 #[inline(always)]
95 pub fn is_noon(&self) -> bool {
96 *self == TIMEVSEL_A::NOON
97 }
98}
99#[doc = "Field `TIMEVSEL` writer - Time Event Selection"]
100pub type TIMEVSEL_W<'a, const O: u8> =
101 crate::FieldWriterSafe<'a, u32, CR_SPEC, u8, TIMEVSEL_A, 2, O>;
102impl<'a, const O: u8> TIMEVSEL_W<'a, O> {
103 #[doc = "Minute change"]
104 #[inline(always)]
105 pub fn minute(self) -> &'a mut W {
106 self.variant(TIMEVSEL_A::MINUTE)
107 }
108 #[doc = "Hour change"]
109 #[inline(always)]
110 pub fn hour(self) -> &'a mut W {
111 self.variant(TIMEVSEL_A::HOUR)
112 }
113 #[doc = "Every day at midnight"]
114 #[inline(always)]
115 pub fn midnight(self) -> &'a mut W {
116 self.variant(TIMEVSEL_A::MIDNIGHT)
117 }
118 #[doc = "Every day at noon"]
119 #[inline(always)]
120 pub fn noon(self) -> &'a mut W {
121 self.variant(TIMEVSEL_A::NOON)
122 }
123}
124#[doc = "Field `CALEVSEL` reader - Calendar Event Selection"]
125pub type CALEVSEL_R = crate::FieldReader<u8, CALEVSEL_A>;
126#[doc = "Calendar Event Selection\n\nValue on reset: 0"]
127#[derive(Clone, Copy, Debug, PartialEq, Eq)]
128#[repr(u8)]
129pub enum CALEVSEL_A {
130 #[doc = "0: Week change (every Monday at time 00:00:00)"]
131 WEEK = 0,
132 #[doc = "1: Month change (every 01 of each month at time 00:00:00)"]
133 MONTH = 1,
134 #[doc = "2: Year change (every January 1 at time 00:00:00)"]
135 YEAR = 2,
136}
137impl From<CALEVSEL_A> for u8 {
138 #[inline(always)]
139 fn from(variant: CALEVSEL_A) -> Self {
140 variant as _
141 }
142}
143impl CALEVSEL_R {
144 #[doc = "Get enumerated values variant"]
145 #[inline(always)]
146 pub fn variant(&self) -> Option<CALEVSEL_A> {
147 match self.bits {
148 0 => Some(CALEVSEL_A::WEEK),
149 1 => Some(CALEVSEL_A::MONTH),
150 2 => Some(CALEVSEL_A::YEAR),
151 _ => None,
152 }
153 }
154 #[doc = "Checks if the value of the field is `WEEK`"]
155 #[inline(always)]
156 pub fn is_week(&self) -> bool {
157 *self == CALEVSEL_A::WEEK
158 }
159 #[doc = "Checks if the value of the field is `MONTH`"]
160 #[inline(always)]
161 pub fn is_month(&self) -> bool {
162 *self == CALEVSEL_A::MONTH
163 }
164 #[doc = "Checks if the value of the field is `YEAR`"]
165 #[inline(always)]
166 pub fn is_year(&self) -> bool {
167 *self == CALEVSEL_A::YEAR
168 }
169}
170#[doc = "Field `CALEVSEL` writer - Calendar Event Selection"]
171pub type CALEVSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, CALEVSEL_A, 2, O>;
172impl<'a, const O: u8> CALEVSEL_W<'a, O> {
173 #[doc = "Week change (every Monday at time 00:00:00)"]
174 #[inline(always)]
175 pub fn week(self) -> &'a mut W {
176 self.variant(CALEVSEL_A::WEEK)
177 }
178 #[doc = "Month change (every 01 of each month at time 00:00:00)"]
179 #[inline(always)]
180 pub fn month(self) -> &'a mut W {
181 self.variant(CALEVSEL_A::MONTH)
182 }
183 #[doc = "Year change (every January 1 at time 00:00:00)"]
184 #[inline(always)]
185 pub fn year(self) -> &'a mut W {
186 self.variant(CALEVSEL_A::YEAR)
187 }
188}
189impl R {
190 #[doc = "Bit 0 - Update Request Time Register"]
191 #[inline(always)]
192 pub fn updtim(&self) -> UPDTIM_R {
193 UPDTIM_R::new((self.bits & 1) != 0)
194 }
195 #[doc = "Bit 1 - Update Request Calendar Register"]
196 #[inline(always)]
197 pub fn updcal(&self) -> UPDCAL_R {
198 UPDCAL_R::new(((self.bits >> 1) & 1) != 0)
199 }
200 #[doc = "Bits 8:9 - Time Event Selection"]
201 #[inline(always)]
202 pub fn timevsel(&self) -> TIMEVSEL_R {
203 TIMEVSEL_R::new(((self.bits >> 8) & 3) as u8)
204 }
205 #[doc = "Bits 16:17 - Calendar Event Selection"]
206 #[inline(always)]
207 pub fn calevsel(&self) -> CALEVSEL_R {
208 CALEVSEL_R::new(((self.bits >> 16) & 3) as u8)
209 }
210}
211impl W {
212 #[doc = "Bit 0 - Update Request Time Register"]
213 #[inline(always)]
214 #[must_use]
215 pub fn updtim(&mut self) -> UPDTIM_W<0> {
216 UPDTIM_W::new(self)
217 }
218 #[doc = "Bit 1 - Update Request Calendar Register"]
219 #[inline(always)]
220 #[must_use]
221 pub fn updcal(&mut self) -> UPDCAL_W<1> {
222 UPDCAL_W::new(self)
223 }
224 #[doc = "Bits 8:9 - Time Event Selection"]
225 #[inline(always)]
226 #[must_use]
227 pub fn timevsel(&mut self) -> TIMEVSEL_W<8> {
228 TIMEVSEL_W::new(self)
229 }
230 #[doc = "Bits 16:17 - Calendar Event Selection"]
231 #[inline(always)]
232 #[must_use]
233 pub fn calevsel(&mut self) -> CALEVSEL_W<16> {
234 CALEVSEL_W::new(self)
235 }
236 #[doc = "Writes raw bits to the register."]
237 #[inline(always)]
238 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
239 self.0.bits(bits);
240 self
241 }
242}
243#[doc = "Control 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 [cr](index.html) module"]
244pub struct CR_SPEC;
245impl crate::RegisterSpec for CR_SPEC {
246 type Ux = u32;
247}
248#[doc = "`read()` method returns [cr::R](R) reader structure"]
249impl crate::Readable for CR_SPEC {
250 type Reader = R;
251}
252#[doc = "`write(|w| ..)` method takes [cr::W](W) writer structure"]
253impl crate::Writable for CR_SPEC {
254 type Writer = W;
255 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
256 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
257}
258#[doc = "`reset()` method sets CR to value 0"]
259impl crate::Resettable for CR_SPEC {
260 const RESET_VALUE: Self::Ux = 0;
261}