1pub type R = crate::R<CTRLrs>;
3pub type W = crate::W<CTRLrs>;
5pub type EnableR = crate::BitReader;
7pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
9pub type DebugrunR = crate::BitReader;
11pub type DebugrunW<'a, REG> = crate::BitWriter<'a, REG>;
13pub type Preccv0topR = crate::BitReader;
15pub type Preccv0topW<'a, REG> = crate::BitWriter<'a, REG>;
17pub type Ccv1topR = crate::BitReader;
19pub type Ccv1topW<'a, REG> = crate::BitWriter<'a, REG>;
21#[cfg_attr(feature = "defmt", derive(defmt::Format))]
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
26#[repr(u8)]
27pub enum CNTPRESC {
28 Div1 = 0,
30 Div2 = 1,
32 Div4 = 2,
34 Div8 = 3,
36 Div16 = 4,
38 Div32 = 5,
40 Div64 = 6,
42 Div128 = 7,
44 Div256 = 8,
46 Div512 = 9,
48 Div1024 = 10,
50 Div2048 = 11,
52 Div4096 = 12,
54 Div8192 = 13,
56 Div16384 = 14,
58 Div32768 = 15,
60}
61impl From<CNTPRESC> for u8 {
62 #[inline(always)]
63 fn from(variant: CNTPRESC) -> Self {
64 variant as _
65 }
66}
67impl crate::FieldSpec for CNTPRESC {
68 type Ux = u8;
69}
70impl crate::IsEnum for CNTPRESC {}
71pub type CntprescR = crate::FieldReader<CNTPRESC>;
73impl CntprescR {
74 #[inline(always)]
76 pub const fn variant(&self) -> CNTPRESC {
77 match self.bits {
78 0 => CNTPRESC::Div1,
79 1 => CNTPRESC::Div2,
80 2 => CNTPRESC::Div4,
81 3 => CNTPRESC::Div8,
82 4 => CNTPRESC::Div16,
83 5 => CNTPRESC::Div32,
84 6 => CNTPRESC::Div64,
85 7 => CNTPRESC::Div128,
86 8 => CNTPRESC::Div256,
87 9 => CNTPRESC::Div512,
88 10 => CNTPRESC::Div1024,
89 11 => CNTPRESC::Div2048,
90 12 => CNTPRESC::Div4096,
91 13 => CNTPRESC::Div8192,
92 14 => CNTPRESC::Div16384,
93 15 => CNTPRESC::Div32768,
94 _ => unreachable!(),
95 }
96 }
97 #[inline(always)]
99 pub fn is_div1(&self) -> bool {
100 *self == CNTPRESC::Div1
101 }
102 #[inline(always)]
104 pub fn is_div2(&self) -> bool {
105 *self == CNTPRESC::Div2
106 }
107 #[inline(always)]
109 pub fn is_div4(&self) -> bool {
110 *self == CNTPRESC::Div4
111 }
112 #[inline(always)]
114 pub fn is_div8(&self) -> bool {
115 *self == CNTPRESC::Div8
116 }
117 #[inline(always)]
119 pub fn is_div16(&self) -> bool {
120 *self == CNTPRESC::Div16
121 }
122 #[inline(always)]
124 pub fn is_div32(&self) -> bool {
125 *self == CNTPRESC::Div32
126 }
127 #[inline(always)]
129 pub fn is_div64(&self) -> bool {
130 *self == CNTPRESC::Div64
131 }
132 #[inline(always)]
134 pub fn is_div128(&self) -> bool {
135 *self == CNTPRESC::Div128
136 }
137 #[inline(always)]
139 pub fn is_div256(&self) -> bool {
140 *self == CNTPRESC::Div256
141 }
142 #[inline(always)]
144 pub fn is_div512(&self) -> bool {
145 *self == CNTPRESC::Div512
146 }
147 #[inline(always)]
149 pub fn is_div1024(&self) -> bool {
150 *self == CNTPRESC::Div1024
151 }
152 #[inline(always)]
154 pub fn is_div2048(&self) -> bool {
155 *self == CNTPRESC::Div2048
156 }
157 #[inline(always)]
159 pub fn is_div4096(&self) -> bool {
160 *self == CNTPRESC::Div4096
161 }
162 #[inline(always)]
164 pub fn is_div8192(&self) -> bool {
165 *self == CNTPRESC::Div8192
166 }
167 #[inline(always)]
169 pub fn is_div16384(&self) -> bool {
170 *self == CNTPRESC::Div16384
171 }
172 #[inline(always)]
174 pub fn is_div32768(&self) -> bool {
175 *self == CNTPRESC::Div32768
176 }
177}
178pub type CntprescW<'a, REG> = crate::FieldWriter<'a, REG, 4, CNTPRESC, crate::Safe>;
180impl<'a, REG> CntprescW<'a, REG>
181where
182 REG: crate::Writable + crate::RegisterSpec,
183 REG::Ux: From<u8>,
184{
185 #[inline(always)]
187 pub fn div1(self) -> &'a mut crate::W<REG> {
188 self.variant(CNTPRESC::Div1)
189 }
190 #[inline(always)]
192 pub fn div2(self) -> &'a mut crate::W<REG> {
193 self.variant(CNTPRESC::Div2)
194 }
195 #[inline(always)]
197 pub fn div4(self) -> &'a mut crate::W<REG> {
198 self.variant(CNTPRESC::Div4)
199 }
200 #[inline(always)]
202 pub fn div8(self) -> &'a mut crate::W<REG> {
203 self.variant(CNTPRESC::Div8)
204 }
205 #[inline(always)]
207 pub fn div16(self) -> &'a mut crate::W<REG> {
208 self.variant(CNTPRESC::Div16)
209 }
210 #[inline(always)]
212 pub fn div32(self) -> &'a mut crate::W<REG> {
213 self.variant(CNTPRESC::Div32)
214 }
215 #[inline(always)]
217 pub fn div64(self) -> &'a mut crate::W<REG> {
218 self.variant(CNTPRESC::Div64)
219 }
220 #[inline(always)]
222 pub fn div128(self) -> &'a mut crate::W<REG> {
223 self.variant(CNTPRESC::Div128)
224 }
225 #[inline(always)]
227 pub fn div256(self) -> &'a mut crate::W<REG> {
228 self.variant(CNTPRESC::Div256)
229 }
230 #[inline(always)]
232 pub fn div512(self) -> &'a mut crate::W<REG> {
233 self.variant(CNTPRESC::Div512)
234 }
235 #[inline(always)]
237 pub fn div1024(self) -> &'a mut crate::W<REG> {
238 self.variant(CNTPRESC::Div1024)
239 }
240 #[inline(always)]
242 pub fn div2048(self) -> &'a mut crate::W<REG> {
243 self.variant(CNTPRESC::Div2048)
244 }
245 #[inline(always)]
247 pub fn div4096(self) -> &'a mut crate::W<REG> {
248 self.variant(CNTPRESC::Div4096)
249 }
250 #[inline(always)]
252 pub fn div8192(self) -> &'a mut crate::W<REG> {
253 self.variant(CNTPRESC::Div8192)
254 }
255 #[inline(always)]
257 pub fn div16384(self) -> &'a mut crate::W<REG> {
258 self.variant(CNTPRESC::Div16384)
259 }
260 #[inline(always)]
262 pub fn div32768(self) -> &'a mut crate::W<REG> {
263 self.variant(CNTPRESC::Div32768)
264 }
265}
266pub type CnttickR = crate::BitReader;
268pub type CnttickW<'a, REG> = crate::BitWriter<'a, REG>;
270pub type OscfdetenR = crate::BitReader;
272pub type OscfdetenW<'a, REG> = crate::BitWriter<'a, REG>;
274pub type CntmodeR = crate::BitReader;
276pub type CntmodeW<'a, REG> = crate::BitWriter<'a, REG>;
278pub type LyearcorrdisR = crate::BitReader;
280pub type LyearcorrdisW<'a, REG> = crate::BitWriter<'a, REG>;
282impl R {
283 #[inline(always)]
285 pub fn enable(&self) -> EnableR {
286 EnableR::new((self.bits & 1) != 0)
287 }
288 #[inline(always)]
290 pub fn debugrun(&self) -> DebugrunR {
291 DebugrunR::new(((self.bits >> 2) & 1) != 0)
292 }
293 #[inline(always)]
295 pub fn preccv0top(&self) -> Preccv0topR {
296 Preccv0topR::new(((self.bits >> 4) & 1) != 0)
297 }
298 #[inline(always)]
300 pub fn ccv1top(&self) -> Ccv1topR {
301 Ccv1topR::new(((self.bits >> 5) & 1) != 0)
302 }
303 #[inline(always)]
305 pub fn cntpresc(&self) -> CntprescR {
306 CntprescR::new(((self.bits >> 8) & 0x0f) as u8)
307 }
308 #[inline(always)]
310 pub fn cnttick(&self) -> CnttickR {
311 CnttickR::new(((self.bits >> 12) & 1) != 0)
312 }
313 #[inline(always)]
315 pub fn oscfdeten(&self) -> OscfdetenR {
316 OscfdetenR::new(((self.bits >> 15) & 1) != 0)
317 }
318 #[inline(always)]
320 pub fn cntmode(&self) -> CntmodeR {
321 CntmodeR::new(((self.bits >> 16) & 1) != 0)
322 }
323 #[inline(always)]
325 pub fn lyearcorrdis(&self) -> LyearcorrdisR {
326 LyearcorrdisR::new(((self.bits >> 17) & 1) != 0)
327 }
328}
329impl core::fmt::Debug for R {
330 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
331 f.debug_struct("CTRL")
332 .field("enable", &self.enable())
333 .field("debugrun", &self.debugrun())
334 .field("preccv0top", &self.preccv0top())
335 .field("ccv1top", &self.ccv1top())
336 .field("cntpresc", &self.cntpresc())
337 .field("cnttick", &self.cnttick())
338 .field("oscfdeten", &self.oscfdeten())
339 .field("cntmode", &self.cntmode())
340 .field("lyearcorrdis", &self.lyearcorrdis())
341 .finish()
342 }
343}
344impl W {
345 #[inline(always)]
347 pub fn enable(&mut self) -> EnableW<'_, CTRLrs> {
348 EnableW::new(self, 0)
349 }
350 #[inline(always)]
352 pub fn debugrun(&mut self) -> DebugrunW<'_, CTRLrs> {
353 DebugrunW::new(self, 2)
354 }
355 #[inline(always)]
357 pub fn preccv0top(&mut self) -> Preccv0topW<'_, CTRLrs> {
358 Preccv0topW::new(self, 4)
359 }
360 #[inline(always)]
362 pub fn ccv1top(&mut self) -> Ccv1topW<'_, CTRLrs> {
363 Ccv1topW::new(self, 5)
364 }
365 #[inline(always)]
367 pub fn cntpresc(&mut self) -> CntprescW<'_, CTRLrs> {
368 CntprescW::new(self, 8)
369 }
370 #[inline(always)]
372 pub fn cnttick(&mut self) -> CnttickW<'_, CTRLrs> {
373 CnttickW::new(self, 12)
374 }
375 #[inline(always)]
377 pub fn oscfdeten(&mut self) -> OscfdetenW<'_, CTRLrs> {
378 OscfdetenW::new(self, 15)
379 }
380 #[inline(always)]
382 pub fn cntmode(&mut self) -> CntmodeW<'_, CTRLrs> {
383 CntmodeW::new(self, 16)
384 }
385 #[inline(always)]
387 pub fn lyearcorrdis(&mut self) -> LyearcorrdisW<'_, CTRLrs> {
388 LyearcorrdisW::new(self, 17)
389 }
390}
391pub struct CTRLrs;
395impl crate::RegisterSpec for CTRLrs {
396 type Ux = u32;
397}
398impl crate::Readable for CTRLrs {}
400impl crate::Writable for CTRLrs {
402 type Safety = crate::Unsafe;
403}
404impl crate::Resettable for CTRLrs {}