1#[doc = r"Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r"Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::CAL0 {
10 #[doc = r"Modifies the contents of the register"]
11 #[inline(always)]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 self.register.set(f(&R { bits }, &mut W { bits }).bits);
18 }
19 #[doc = r"Reads the contents of the register"]
20 #[inline(always)]
21 pub fn read(&self) -> R {
22 R {
23 bits: self.register.get(),
24 }
25 }
26 #[doc = r"Writes to the register"]
27 #[inline(always)]
28 pub fn write<F>(&self, f: F)
29 where
30 F: FnOnce(&mut W) -> &mut W,
31 {
32 self.register.set(
33 f(&mut W {
34 bits: Self::reset_value(),
35 })
36 .bits,
37 );
38 }
39 #[doc = r"Reset value of the register"]
40 #[inline(always)]
41 pub const fn reset_value() -> u32 {
42 0
43 }
44 #[doc = r"Writes the reset value to the register"]
45 #[inline(always)]
46 pub fn reset(&self) {
47 self.register.set(Self::reset_value())
48 }
49}
50#[doc = r"Value of the field"]
51pub struct HIB_CAL0_SECR {
52 bits: u8,
53}
54impl HIB_CAL0_SECR {
55 #[doc = r"Value of the field as raw bits"]
56 #[inline(always)]
57 pub fn bits(&self) -> u8 {
58 self.bits
59 }
60}
61#[doc = r"Proxy"]
62pub struct _HIB_CAL0_SECW<'a> {
63 w: &'a mut W,
64}
65impl<'a> _HIB_CAL0_SECW<'a> {
66 #[doc = r"Writes raw bits to the field"]
67 #[inline(always)]
68 pub unsafe fn bits(self, value: u8) -> &'a mut W {
69 self.w.bits &= !(63 << 0);
70 self.w.bits |= ((value as u32) & 63) << 0;
71 self.w
72 }
73}
74#[doc = r"Value of the field"]
75pub struct HIB_CAL0_MINR {
76 bits: u8,
77}
78impl HIB_CAL0_MINR {
79 #[doc = r"Value of the field as raw bits"]
80 #[inline(always)]
81 pub fn bits(&self) -> u8 {
82 self.bits
83 }
84}
85#[doc = r"Proxy"]
86pub struct _HIB_CAL0_MINW<'a> {
87 w: &'a mut W,
88}
89impl<'a> _HIB_CAL0_MINW<'a> {
90 #[doc = r"Writes raw bits to the field"]
91 #[inline(always)]
92 pub unsafe fn bits(self, value: u8) -> &'a mut W {
93 self.w.bits &= !(63 << 8);
94 self.w.bits |= ((value as u32) & 63) << 8;
95 self.w
96 }
97}
98#[doc = r"Value of the field"]
99pub struct HIB_CAL0_HRR {
100 bits: u8,
101}
102impl HIB_CAL0_HRR {
103 #[doc = r"Value of the field as raw bits"]
104 #[inline(always)]
105 pub fn bits(&self) -> u8 {
106 self.bits
107 }
108}
109#[doc = r"Proxy"]
110pub struct _HIB_CAL0_HRW<'a> {
111 w: &'a mut W,
112}
113impl<'a> _HIB_CAL0_HRW<'a> {
114 #[doc = r"Writes raw bits to the field"]
115 #[inline(always)]
116 pub unsafe fn bits(self, value: u8) -> &'a mut W {
117 self.w.bits &= !(31 << 16);
118 self.w.bits |= ((value as u32) & 31) << 16;
119 self.w
120 }
121}
122#[doc = r"Value of the field"]
123pub struct HIB_CAL0_AMPMR {
124 bits: bool,
125}
126impl HIB_CAL0_AMPMR {
127 #[doc = r"Value of the field as raw bits"]
128 #[inline(always)]
129 pub fn bit(&self) -> bool {
130 self.bits
131 }
132 #[doc = r"Returns `true` if the bit is clear (0)"]
133 #[inline(always)]
134 pub fn bit_is_clear(&self) -> bool {
135 !self.bit()
136 }
137 #[doc = r"Returns `true` if the bit is set (1)"]
138 #[inline(always)]
139 pub fn bit_is_set(&self) -> bool {
140 self.bit()
141 }
142}
143#[doc = r"Proxy"]
144pub struct _HIB_CAL0_AMPMW<'a> {
145 w: &'a mut W,
146}
147impl<'a> _HIB_CAL0_AMPMW<'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 &= !(1 << 22);
162 self.w.bits |= ((value as u32) & 1) << 22;
163 self.w
164 }
165}
166#[doc = r"Value of the field"]
167pub struct HIB_CAL0_VALIDR {
168 bits: bool,
169}
170impl HIB_CAL0_VALIDR {
171 #[doc = r"Value of the field as raw bits"]
172 #[inline(always)]
173 pub fn bit(&self) -> bool {
174 self.bits
175 }
176 #[doc = r"Returns `true` if the bit is clear (0)"]
177 #[inline(always)]
178 pub fn bit_is_clear(&self) -> bool {
179 !self.bit()
180 }
181 #[doc = r"Returns `true` if the bit is set (1)"]
182 #[inline(always)]
183 pub fn bit_is_set(&self) -> bool {
184 self.bit()
185 }
186}
187#[doc = r"Proxy"]
188pub struct _HIB_CAL0_VALIDW<'a> {
189 w: &'a mut W,
190}
191impl<'a> _HIB_CAL0_VALIDW<'a> {
192 #[doc = r"Sets the field bit"]
193 #[inline(always)]
194 pub fn set_bit(self) -> &'a mut W {
195 self.bit(true)
196 }
197 #[doc = r"Clears the field bit"]
198 #[inline(always)]
199 pub fn clear_bit(self) -> &'a mut W {
200 self.bit(false)
201 }
202 #[doc = r"Writes raw bits to the field"]
203 #[inline(always)]
204 pub fn bit(self, value: bool) -> &'a mut W {
205 self.w.bits &= !(1 << 31);
206 self.w.bits |= ((value as u32) & 1) << 31;
207 self.w
208 }
209}
210impl R {
211 #[doc = r"Value of the register as raw bits"]
212 #[inline(always)]
213 pub fn bits(&self) -> u32 {
214 self.bits
215 }
216 #[doc = "Bits 0:5 - Seconds"]
217 #[inline(always)]
218 pub fn hib_cal0_sec(&self) -> HIB_CAL0_SECR {
219 let bits = ((self.bits >> 0) & 63) as u8;
220 HIB_CAL0_SECR { bits }
221 }
222 #[doc = "Bits 8:13 - Minutes"]
223 #[inline(always)]
224 pub fn hib_cal0_min(&self) -> HIB_CAL0_MINR {
225 let bits = ((self.bits >> 8) & 63) as u8;
226 HIB_CAL0_MINR { bits }
227 }
228 #[doc = "Bits 16:20 - Hours"]
229 #[inline(always)]
230 pub fn hib_cal0_hr(&self) -> HIB_CAL0_HRR {
231 let bits = ((self.bits >> 16) & 31) as u8;
232 HIB_CAL0_HRR { bits }
233 }
234 #[doc = "Bit 22 - AM/PM Designation"]
235 #[inline(always)]
236 pub fn hib_cal0_ampm(&self) -> HIB_CAL0_AMPMR {
237 let bits = ((self.bits >> 22) & 1) != 0;
238 HIB_CAL0_AMPMR { bits }
239 }
240 #[doc = "Bit 31 - Valid Calendar Load"]
241 #[inline(always)]
242 pub fn hib_cal0_valid(&self) -> HIB_CAL0_VALIDR {
243 let bits = ((self.bits >> 31) & 1) != 0;
244 HIB_CAL0_VALIDR { bits }
245 }
246}
247impl W {
248 #[doc = r"Writes raw bits to the register"]
249 #[inline(always)]
250 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
251 self.bits = bits;
252 self
253 }
254 #[doc = "Bits 0:5 - Seconds"]
255 #[inline(always)]
256 pub fn hib_cal0_sec(&mut self) -> _HIB_CAL0_SECW {
257 _HIB_CAL0_SECW { w: self }
258 }
259 #[doc = "Bits 8:13 - Minutes"]
260 #[inline(always)]
261 pub fn hib_cal0_min(&mut self) -> _HIB_CAL0_MINW {
262 _HIB_CAL0_MINW { w: self }
263 }
264 #[doc = "Bits 16:20 - Hours"]
265 #[inline(always)]
266 pub fn hib_cal0_hr(&mut self) -> _HIB_CAL0_HRW {
267 _HIB_CAL0_HRW { w: self }
268 }
269 #[doc = "Bit 22 - AM/PM Designation"]
270 #[inline(always)]
271 pub fn hib_cal0_ampm(&mut self) -> _HIB_CAL0_AMPMW {
272 _HIB_CAL0_AMPMW { w: self }
273 }
274 #[doc = "Bit 31 - Valid Calendar Load"]
275 #[inline(always)]
276 pub fn hib_cal0_valid(&mut self) -> _HIB_CAL0_VALIDW {
277 _HIB_CAL0_VALIDW { w: self }
278 }
279}