efm32gg_pac/efm32gg995/letimer0/
ctrl.rs1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `REPMODE` reader - Repeat Mode"]
38pub type REPMODE_R = crate::FieldReader<u8, REPMODE_A>;
39#[doc = "Repeat Mode\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum REPMODE_A {
43 #[doc = "0: When started, the LETIMER counts down until it is stopped by software."]
44 FREE = 0,
45 #[doc = "1: The counter counts REP0 times. When REP0 reaches zero, the counter stops."]
46 ONESHOT = 1,
47 #[doc = "2: The counter counts REP0 times. If REP1 has been written, it is loaded into REP0 when REP0 reaches zero. Else the counter stops"]
48 BUFFERED = 2,
49 #[doc = "3: Both REP0 and REP1 are decremented when the LETIMER wraps around. The LETIMER counts until both REP0 and REP1 are zero"]
50 DOUBLE = 3,
51}
52impl From<REPMODE_A> for u8 {
53 #[inline(always)]
54 fn from(variant: REPMODE_A) -> Self {
55 variant as _
56 }
57}
58impl REPMODE_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> REPMODE_A {
62 match self.bits {
63 0 => REPMODE_A::FREE,
64 1 => REPMODE_A::ONESHOT,
65 2 => REPMODE_A::BUFFERED,
66 3 => REPMODE_A::DOUBLE,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `FREE`"]
71 #[inline(always)]
72 pub fn is_free(&self) -> bool {
73 *self == REPMODE_A::FREE
74 }
75 #[doc = "Checks if the value of the field is `ONESHOT`"]
76 #[inline(always)]
77 pub fn is_oneshot(&self) -> bool {
78 *self == REPMODE_A::ONESHOT
79 }
80 #[doc = "Checks if the value of the field is `BUFFERED`"]
81 #[inline(always)]
82 pub fn is_buffered(&self) -> bool {
83 *self == REPMODE_A::BUFFERED
84 }
85 #[doc = "Checks if the value of the field is `DOUBLE`"]
86 #[inline(always)]
87 pub fn is_double(&self) -> bool {
88 *self == REPMODE_A::DOUBLE
89 }
90}
91#[doc = "Field `REPMODE` writer - Repeat Mode"]
92pub type REPMODE_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, REPMODE_A, 2, O>;
94impl<'a, const O: u8> REPMODE_W<'a, O> {
95 #[doc = "When started, the LETIMER counts down until it is stopped by software."]
96 #[inline(always)]
97 pub fn free(self) -> &'a mut W {
98 self.variant(REPMODE_A::FREE)
99 }
100 #[doc = "The counter counts REP0 times. When REP0 reaches zero, the counter stops."]
101 #[inline(always)]
102 pub fn oneshot(self) -> &'a mut W {
103 self.variant(REPMODE_A::ONESHOT)
104 }
105 #[doc = "The counter counts REP0 times. If REP1 has been written, it is loaded into REP0 when REP0 reaches zero. Else the counter stops"]
106 #[inline(always)]
107 pub fn buffered(self) -> &'a mut W {
108 self.variant(REPMODE_A::BUFFERED)
109 }
110 #[doc = "Both REP0 and REP1 are decremented when the LETIMER wraps around. The LETIMER counts until both REP0 and REP1 are zero"]
111 #[inline(always)]
112 pub fn double(self) -> &'a mut W {
113 self.variant(REPMODE_A::DOUBLE)
114 }
115}
116#[doc = "Field `UFOA0` reader - Underflow Output Action 0"]
117pub type UFOA0_R = crate::FieldReader<u8, UFOA0_A>;
118#[doc = "Underflow Output Action 0\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum UFOA0_A {
122 #[doc = "0: LETn_O0 is held at its idle value as defined by OPOL0."]
123 NONE = 0,
124 #[doc = "1: LETn_O0 is toggled on CNT underflow."]
125 TOGGLE = 1,
126 #[doc = "2: LETn_O0 is held active for one LFACLKLETIMER0 clock cycle on CNT underflow. The output then returns to its idle value as defined by OPOL0."]
127 PULSE = 2,
128 #[doc = "3: LETn_O0 is set idle on CNT underflow, and active on compare match with COMP1"]
129 PWM = 3,
130}
131impl From<UFOA0_A> for u8 {
132 #[inline(always)]
133 fn from(variant: UFOA0_A) -> Self {
134 variant as _
135 }
136}
137impl UFOA0_R {
138 #[doc = "Get enumerated values variant"]
139 #[inline(always)]
140 pub fn variant(&self) -> UFOA0_A {
141 match self.bits {
142 0 => UFOA0_A::NONE,
143 1 => UFOA0_A::TOGGLE,
144 2 => UFOA0_A::PULSE,
145 3 => UFOA0_A::PWM,
146 _ => unreachable!(),
147 }
148 }
149 #[doc = "Checks if the value of the field is `NONE`"]
150 #[inline(always)]
151 pub fn is_none(&self) -> bool {
152 *self == UFOA0_A::NONE
153 }
154 #[doc = "Checks if the value of the field is `TOGGLE`"]
155 #[inline(always)]
156 pub fn is_toggle(&self) -> bool {
157 *self == UFOA0_A::TOGGLE
158 }
159 #[doc = "Checks if the value of the field is `PULSE`"]
160 #[inline(always)]
161 pub fn is_pulse(&self) -> bool {
162 *self == UFOA0_A::PULSE
163 }
164 #[doc = "Checks if the value of the field is `PWM`"]
165 #[inline(always)]
166 pub fn is_pwm(&self) -> bool {
167 *self == UFOA0_A::PWM
168 }
169}
170#[doc = "Field `UFOA0` writer - Underflow Output Action 0"]
171pub type UFOA0_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, UFOA0_A, 2, O>;
172impl<'a, const O: u8> UFOA0_W<'a, O> {
173 #[doc = "LETn_O0 is held at its idle value as defined by OPOL0."]
174 #[inline(always)]
175 pub fn none(self) -> &'a mut W {
176 self.variant(UFOA0_A::NONE)
177 }
178 #[doc = "LETn_O0 is toggled on CNT underflow."]
179 #[inline(always)]
180 pub fn toggle(self) -> &'a mut W {
181 self.variant(UFOA0_A::TOGGLE)
182 }
183 #[doc = "LETn_O0 is held active for one LFACLKLETIMER0 clock cycle on CNT underflow. The output then returns to its idle value as defined by OPOL0."]
184 #[inline(always)]
185 pub fn pulse(self) -> &'a mut W {
186 self.variant(UFOA0_A::PULSE)
187 }
188 #[doc = "LETn_O0 is set idle on CNT underflow, and active on compare match with COMP1"]
189 #[inline(always)]
190 pub fn pwm(self) -> &'a mut W {
191 self.variant(UFOA0_A::PWM)
192 }
193}
194#[doc = "Field `UFOA1` reader - Underflow Output Action 1"]
195pub type UFOA1_R = crate::FieldReader<u8, UFOA1_A>;
196#[doc = "Underflow Output Action 1\n\nValue on reset: 0"]
197#[derive(Clone, Copy, Debug, PartialEq, Eq)]
198#[repr(u8)]
199pub enum UFOA1_A {
200 #[doc = "0: LETn_O1 is held at its idle value as defined by OPOL1."]
201 NONE = 0,
202 #[doc = "1: LETn_O1 is toggled on CNT underflow."]
203 TOGGLE = 1,
204 #[doc = "2: LETn_O1 is held active for one LFACLKLETIMER0 clock cycle on CNT underflow. The output then returns to its idle value as defined by OPOL1."]
205 PULSE = 2,
206 #[doc = "3: LETn_O1 is set idle on CNT underflow, and active on compare match with COMP1"]
207 PWM = 3,
208}
209impl From<UFOA1_A> for u8 {
210 #[inline(always)]
211 fn from(variant: UFOA1_A) -> Self {
212 variant as _
213 }
214}
215impl UFOA1_R {
216 #[doc = "Get enumerated values variant"]
217 #[inline(always)]
218 pub fn variant(&self) -> UFOA1_A {
219 match self.bits {
220 0 => UFOA1_A::NONE,
221 1 => UFOA1_A::TOGGLE,
222 2 => UFOA1_A::PULSE,
223 3 => UFOA1_A::PWM,
224 _ => unreachable!(),
225 }
226 }
227 #[doc = "Checks if the value of the field is `NONE`"]
228 #[inline(always)]
229 pub fn is_none(&self) -> bool {
230 *self == UFOA1_A::NONE
231 }
232 #[doc = "Checks if the value of the field is `TOGGLE`"]
233 #[inline(always)]
234 pub fn is_toggle(&self) -> bool {
235 *self == UFOA1_A::TOGGLE
236 }
237 #[doc = "Checks if the value of the field is `PULSE`"]
238 #[inline(always)]
239 pub fn is_pulse(&self) -> bool {
240 *self == UFOA1_A::PULSE
241 }
242 #[doc = "Checks if the value of the field is `PWM`"]
243 #[inline(always)]
244 pub fn is_pwm(&self) -> bool {
245 *self == UFOA1_A::PWM
246 }
247}
248#[doc = "Field `UFOA1` writer - Underflow Output Action 1"]
249pub type UFOA1_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, UFOA1_A, 2, O>;
250impl<'a, const O: u8> UFOA1_W<'a, O> {
251 #[doc = "LETn_O1 is held at its idle value as defined by OPOL1."]
252 #[inline(always)]
253 pub fn none(self) -> &'a mut W {
254 self.variant(UFOA1_A::NONE)
255 }
256 #[doc = "LETn_O1 is toggled on CNT underflow."]
257 #[inline(always)]
258 pub fn toggle(self) -> &'a mut W {
259 self.variant(UFOA1_A::TOGGLE)
260 }
261 #[doc = "LETn_O1 is held active for one LFACLKLETIMER0 clock cycle on CNT underflow. The output then returns to its idle value as defined by OPOL1."]
262 #[inline(always)]
263 pub fn pulse(self) -> &'a mut W {
264 self.variant(UFOA1_A::PULSE)
265 }
266 #[doc = "LETn_O1 is set idle on CNT underflow, and active on compare match with COMP1"]
267 #[inline(always)]
268 pub fn pwm(self) -> &'a mut W {
269 self.variant(UFOA1_A::PWM)
270 }
271}
272#[doc = "Field `OPOL0` reader - Output 0 Polarity"]
273pub type OPOL0_R = crate::BitReader<bool>;
274#[doc = "Field `OPOL0` writer - Output 0 Polarity"]
275pub type OPOL0_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
276#[doc = "Field `OPOL1` reader - Output 1 Polarity"]
277pub type OPOL1_R = crate::BitReader<bool>;
278#[doc = "Field `OPOL1` writer - Output 1 Polarity"]
279pub type OPOL1_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
280#[doc = "Field `BUFTOP` reader - Buffered Top"]
281pub type BUFTOP_R = crate::BitReader<bool>;
282#[doc = "Field `BUFTOP` writer - Buffered Top"]
283pub type BUFTOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
284#[doc = "Field `COMP0TOP` reader - Compare Value 0 Is Top Value"]
285pub type COMP0TOP_R = crate::BitReader<bool>;
286#[doc = "Field `COMP0TOP` writer - Compare Value 0 Is Top Value"]
287pub type COMP0TOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
288#[doc = "Field `RTCC0TEN` reader - RTC Compare 0 Trigger Enable"]
289pub type RTCC0TEN_R = crate::BitReader<bool>;
290#[doc = "Field `RTCC0TEN` writer - RTC Compare 0 Trigger Enable"]
291pub type RTCC0TEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
292#[doc = "Field `RTCC1TEN` reader - RTC Compare 1 Trigger Enable"]
293pub type RTCC1TEN_R = crate::BitReader<bool>;
294#[doc = "Field `RTCC1TEN` writer - RTC Compare 1 Trigger Enable"]
295pub type RTCC1TEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
296#[doc = "Field `DEBUGRUN` reader - Debug Mode Run Enable"]
297pub type DEBUGRUN_R = crate::BitReader<bool>;
298#[doc = "Field `DEBUGRUN` writer - Debug Mode Run Enable"]
299pub type DEBUGRUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
300impl R {
301 #[doc = "Bits 0:1 - Repeat Mode"]
302 #[inline(always)]
303 pub fn repmode(&self) -> REPMODE_R {
304 REPMODE_R::new((self.bits & 3) as u8)
305 }
306 #[doc = "Bits 2:3 - Underflow Output Action 0"]
307 #[inline(always)]
308 pub fn ufoa0(&self) -> UFOA0_R {
309 UFOA0_R::new(((self.bits >> 2) & 3) as u8)
310 }
311 #[doc = "Bits 4:5 - Underflow Output Action 1"]
312 #[inline(always)]
313 pub fn ufoa1(&self) -> UFOA1_R {
314 UFOA1_R::new(((self.bits >> 4) & 3) as u8)
315 }
316 #[doc = "Bit 6 - Output 0 Polarity"]
317 #[inline(always)]
318 pub fn opol0(&self) -> OPOL0_R {
319 OPOL0_R::new(((self.bits >> 6) & 1) != 0)
320 }
321 #[doc = "Bit 7 - Output 1 Polarity"]
322 #[inline(always)]
323 pub fn opol1(&self) -> OPOL1_R {
324 OPOL1_R::new(((self.bits >> 7) & 1) != 0)
325 }
326 #[doc = "Bit 8 - Buffered Top"]
327 #[inline(always)]
328 pub fn buftop(&self) -> BUFTOP_R {
329 BUFTOP_R::new(((self.bits >> 8) & 1) != 0)
330 }
331 #[doc = "Bit 9 - Compare Value 0 Is Top Value"]
332 #[inline(always)]
333 pub fn comp0top(&self) -> COMP0TOP_R {
334 COMP0TOP_R::new(((self.bits >> 9) & 1) != 0)
335 }
336 #[doc = "Bit 10 - RTC Compare 0 Trigger Enable"]
337 #[inline(always)]
338 pub fn rtcc0ten(&self) -> RTCC0TEN_R {
339 RTCC0TEN_R::new(((self.bits >> 10) & 1) != 0)
340 }
341 #[doc = "Bit 11 - RTC Compare 1 Trigger Enable"]
342 #[inline(always)]
343 pub fn rtcc1ten(&self) -> RTCC1TEN_R {
344 RTCC1TEN_R::new(((self.bits >> 11) & 1) != 0)
345 }
346 #[doc = "Bit 12 - Debug Mode Run Enable"]
347 #[inline(always)]
348 pub fn debugrun(&self) -> DEBUGRUN_R {
349 DEBUGRUN_R::new(((self.bits >> 12) & 1) != 0)
350 }
351}
352impl W {
353 #[doc = "Bits 0:1 - Repeat Mode"]
354 #[inline(always)]
355 #[must_use]
356 pub fn repmode(&mut self) -> REPMODE_W<0> {
357 REPMODE_W::new(self)
358 }
359 #[doc = "Bits 2:3 - Underflow Output Action 0"]
360 #[inline(always)]
361 #[must_use]
362 pub fn ufoa0(&mut self) -> UFOA0_W<2> {
363 UFOA0_W::new(self)
364 }
365 #[doc = "Bits 4:5 - Underflow Output Action 1"]
366 #[inline(always)]
367 #[must_use]
368 pub fn ufoa1(&mut self) -> UFOA1_W<4> {
369 UFOA1_W::new(self)
370 }
371 #[doc = "Bit 6 - Output 0 Polarity"]
372 #[inline(always)]
373 #[must_use]
374 pub fn opol0(&mut self) -> OPOL0_W<6> {
375 OPOL0_W::new(self)
376 }
377 #[doc = "Bit 7 - Output 1 Polarity"]
378 #[inline(always)]
379 #[must_use]
380 pub fn opol1(&mut self) -> OPOL1_W<7> {
381 OPOL1_W::new(self)
382 }
383 #[doc = "Bit 8 - Buffered Top"]
384 #[inline(always)]
385 #[must_use]
386 pub fn buftop(&mut self) -> BUFTOP_W<8> {
387 BUFTOP_W::new(self)
388 }
389 #[doc = "Bit 9 - Compare Value 0 Is Top Value"]
390 #[inline(always)]
391 #[must_use]
392 pub fn comp0top(&mut self) -> COMP0TOP_W<9> {
393 COMP0TOP_W::new(self)
394 }
395 #[doc = "Bit 10 - RTC Compare 0 Trigger Enable"]
396 #[inline(always)]
397 #[must_use]
398 pub fn rtcc0ten(&mut self) -> RTCC0TEN_W<10> {
399 RTCC0TEN_W::new(self)
400 }
401 #[doc = "Bit 11 - RTC Compare 1 Trigger Enable"]
402 #[inline(always)]
403 #[must_use]
404 pub fn rtcc1ten(&mut self) -> RTCC1TEN_W<11> {
405 RTCC1TEN_W::new(self)
406 }
407 #[doc = "Bit 12 - Debug Mode Run Enable"]
408 #[inline(always)]
409 #[must_use]
410 pub fn debugrun(&mut self) -> DEBUGRUN_W<12> {
411 DEBUGRUN_W::new(self)
412 }
413 #[doc = "Writes raw bits to the register."]
414 #[inline(always)]
415 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
416 self.0.bits(bits);
417 self
418 }
419}
420#[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 [ctrl](index.html) module"]
421pub struct CTRL_SPEC;
422impl crate::RegisterSpec for CTRL_SPEC {
423 type Ux = u32;
424}
425#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
426impl crate::Readable for CTRL_SPEC {
427 type Reader = R;
428}
429#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
430impl crate::Writable for CTRL_SPEC {
431 type Writer = W;
432 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
433 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
434}
435#[doc = "`reset()` method sets CTRL to value 0"]
436impl crate::Resettable for CTRL_SPEC {
437 const RESET_VALUE: Self::Ux = 0;
438}