1#[doc = "Reader of register CTL"]
2pub type R = crate::R<u32, super::CTL>;
3#[doc = "Writer for register CTL"]
4pub type W = crate::W<u32, super::CTL>;
5#[doc = "Register CTL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CTL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `TAEN`"]
14pub type TAEN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `TAEN`"]
16pub struct TAEN_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> TAEN_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34 self.w
35 }
36}
37#[doc = "Reader of field `TASTALL`"]
38pub type TASTALL_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `TASTALL`"]
40pub struct TASTALL_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> TASTALL_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
58 self.w
59 }
60}
61#[doc = "GPTM Timer A Event Mode\n\nValue on reset: 0"]
62#[derive(Clone, Copy, Debug, PartialEq)]
63#[repr(u8)]
64pub enum TAEVENT_A {
65 #[doc = "0: Positive edge"]
66 POS = 0,
67 #[doc = "1: Negative edge"]
68 NEG = 1,
69 #[doc = "3: Both edges"]
70 BOTH = 3,
71}
72impl From<TAEVENT_A> for u8 {
73 #[inline(always)]
74 fn from(variant: TAEVENT_A) -> Self {
75 variant as _
76 }
77}
78#[doc = "Reader of field `TAEVENT`"]
79pub type TAEVENT_R = crate::R<u8, TAEVENT_A>;
80impl TAEVENT_R {
81 #[doc = r"Get enumerated values variant"]
82 #[inline(always)]
83 pub fn variant(&self) -> crate::Variant<u8, TAEVENT_A> {
84 use crate::Variant::*;
85 match self.bits {
86 0 => Val(TAEVENT_A::POS),
87 1 => Val(TAEVENT_A::NEG),
88 3 => Val(TAEVENT_A::BOTH),
89 i => Res(i),
90 }
91 }
92 #[doc = "Checks if the value of the field is `POS`"]
93 #[inline(always)]
94 pub fn is_pos(&self) -> bool {
95 *self == TAEVENT_A::POS
96 }
97 #[doc = "Checks if the value of the field is `NEG`"]
98 #[inline(always)]
99 pub fn is_neg(&self) -> bool {
100 *self == TAEVENT_A::NEG
101 }
102 #[doc = "Checks if the value of the field is `BOTH`"]
103 #[inline(always)]
104 pub fn is_both(&self) -> bool {
105 *self == TAEVENT_A::BOTH
106 }
107}
108#[doc = "Write proxy for field `TAEVENT`"]
109pub struct TAEVENT_W<'a> {
110 w: &'a mut W,
111}
112impl<'a> TAEVENT_W<'a> {
113 #[doc = r"Writes `variant` to the field"]
114 #[inline(always)]
115 pub fn variant(self, variant: TAEVENT_A) -> &'a mut W {
116 unsafe { self.bits(variant.into()) }
117 }
118 #[doc = "Positive edge"]
119 #[inline(always)]
120 pub fn pos(self) -> &'a mut W {
121 self.variant(TAEVENT_A::POS)
122 }
123 #[doc = "Negative edge"]
124 #[inline(always)]
125 pub fn neg(self) -> &'a mut W {
126 self.variant(TAEVENT_A::NEG)
127 }
128 #[doc = "Both edges"]
129 #[inline(always)]
130 pub fn both(self) -> &'a mut W {
131 self.variant(TAEVENT_A::BOTH)
132 }
133 #[doc = r"Writes raw bits to the field"]
134 #[inline(always)]
135 pub unsafe fn bits(self, value: u8) -> &'a mut W {
136 self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
137 self.w
138 }
139}
140#[doc = "Reader of field `RTCEN`"]
141pub type RTCEN_R = crate::R<bool, bool>;
142#[doc = "Write proxy for field `RTCEN`"]
143pub struct RTCEN_W<'a> {
144 w: &'a mut W,
145}
146impl<'a> RTCEN_W<'a> {
147 #[doc = r"Sets the field bit"]
148 #[inline(always)]
149 pub fn set_bit(self) -> &'a mut W {
150 self.bit(true)
151 }
152 #[doc = r"Clears the field bit"]
153 #[inline(always)]
154 pub fn clear_bit(self) -> &'a mut W {
155 self.bit(false)
156 }
157 #[doc = r"Writes raw bits to the field"]
158 #[inline(always)]
159 pub fn bit(self, value: bool) -> &'a mut W {
160 self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
161 self.w
162 }
163}
164#[doc = "Reader of field `TAOTE`"]
165pub type TAOTE_R = crate::R<bool, bool>;
166#[doc = "Write proxy for field `TAOTE`"]
167pub struct TAOTE_W<'a> {
168 w: &'a mut W,
169}
170impl<'a> TAOTE_W<'a> {
171 #[doc = r"Sets the field bit"]
172 #[inline(always)]
173 pub fn set_bit(self) -> &'a mut W {
174 self.bit(true)
175 }
176 #[doc = r"Clears the field bit"]
177 #[inline(always)]
178 pub fn clear_bit(self) -> &'a mut W {
179 self.bit(false)
180 }
181 #[doc = r"Writes raw bits to the field"]
182 #[inline(always)]
183 pub fn bit(self, value: bool) -> &'a mut W {
184 self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
185 self.w
186 }
187}
188#[doc = "Reader of field `TAPWML`"]
189pub type TAPWML_R = crate::R<bool, bool>;
190#[doc = "Write proxy for field `TAPWML`"]
191pub struct TAPWML_W<'a> {
192 w: &'a mut W,
193}
194impl<'a> TAPWML_W<'a> {
195 #[doc = r"Sets the field bit"]
196 #[inline(always)]
197 pub fn set_bit(self) -> &'a mut W {
198 self.bit(true)
199 }
200 #[doc = r"Clears the field bit"]
201 #[inline(always)]
202 pub fn clear_bit(self) -> &'a mut W {
203 self.bit(false)
204 }
205 #[doc = r"Writes raw bits to the field"]
206 #[inline(always)]
207 pub fn bit(self, value: bool) -> &'a mut W {
208 self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
209 self.w
210 }
211}
212#[doc = "Reader of field `TBEN`"]
213pub type TBEN_R = crate::R<bool, bool>;
214#[doc = "Write proxy for field `TBEN`"]
215pub struct TBEN_W<'a> {
216 w: &'a mut W,
217}
218impl<'a> TBEN_W<'a> {
219 #[doc = r"Sets the field bit"]
220 #[inline(always)]
221 pub fn set_bit(self) -> &'a mut W {
222 self.bit(true)
223 }
224 #[doc = r"Clears the field bit"]
225 #[inline(always)]
226 pub fn clear_bit(self) -> &'a mut W {
227 self.bit(false)
228 }
229 #[doc = r"Writes raw bits to the field"]
230 #[inline(always)]
231 pub fn bit(self, value: bool) -> &'a mut W {
232 self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
233 self.w
234 }
235}
236#[doc = "Reader of field `TBSTALL`"]
237pub type TBSTALL_R = crate::R<bool, bool>;
238#[doc = "Write proxy for field `TBSTALL`"]
239pub struct TBSTALL_W<'a> {
240 w: &'a mut W,
241}
242impl<'a> TBSTALL_W<'a> {
243 #[doc = r"Sets the field bit"]
244 #[inline(always)]
245 pub fn set_bit(self) -> &'a mut W {
246 self.bit(true)
247 }
248 #[doc = r"Clears the field bit"]
249 #[inline(always)]
250 pub fn clear_bit(self) -> &'a mut W {
251 self.bit(false)
252 }
253 #[doc = r"Writes raw bits to the field"]
254 #[inline(always)]
255 pub fn bit(self, value: bool) -> &'a mut W {
256 self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
257 self.w
258 }
259}
260#[doc = "GPTM Timer B Event Mode\n\nValue on reset: 0"]
261#[derive(Clone, Copy, Debug, PartialEq)]
262#[repr(u8)]
263pub enum TBEVENT_A {
264 #[doc = "0: Positive edge"]
265 POS = 0,
266 #[doc = "1: Negative edge"]
267 NEG = 1,
268 #[doc = "3: Both edges"]
269 BOTH = 3,
270}
271impl From<TBEVENT_A> for u8 {
272 #[inline(always)]
273 fn from(variant: TBEVENT_A) -> Self {
274 variant as _
275 }
276}
277#[doc = "Reader of field `TBEVENT`"]
278pub type TBEVENT_R = crate::R<u8, TBEVENT_A>;
279impl TBEVENT_R {
280 #[doc = r"Get enumerated values variant"]
281 #[inline(always)]
282 pub fn variant(&self) -> crate::Variant<u8, TBEVENT_A> {
283 use crate::Variant::*;
284 match self.bits {
285 0 => Val(TBEVENT_A::POS),
286 1 => Val(TBEVENT_A::NEG),
287 3 => Val(TBEVENT_A::BOTH),
288 i => Res(i),
289 }
290 }
291 #[doc = "Checks if the value of the field is `POS`"]
292 #[inline(always)]
293 pub fn is_pos(&self) -> bool {
294 *self == TBEVENT_A::POS
295 }
296 #[doc = "Checks if the value of the field is `NEG`"]
297 #[inline(always)]
298 pub fn is_neg(&self) -> bool {
299 *self == TBEVENT_A::NEG
300 }
301 #[doc = "Checks if the value of the field is `BOTH`"]
302 #[inline(always)]
303 pub fn is_both(&self) -> bool {
304 *self == TBEVENT_A::BOTH
305 }
306}
307#[doc = "Write proxy for field `TBEVENT`"]
308pub struct TBEVENT_W<'a> {
309 w: &'a mut W,
310}
311impl<'a> TBEVENT_W<'a> {
312 #[doc = r"Writes `variant` to the field"]
313 #[inline(always)]
314 pub fn variant(self, variant: TBEVENT_A) -> &'a mut W {
315 unsafe { self.bits(variant.into()) }
316 }
317 #[doc = "Positive edge"]
318 #[inline(always)]
319 pub fn pos(self) -> &'a mut W {
320 self.variant(TBEVENT_A::POS)
321 }
322 #[doc = "Negative edge"]
323 #[inline(always)]
324 pub fn neg(self) -> &'a mut W {
325 self.variant(TBEVENT_A::NEG)
326 }
327 #[doc = "Both edges"]
328 #[inline(always)]
329 pub fn both(self) -> &'a mut W {
330 self.variant(TBEVENT_A::BOTH)
331 }
332 #[doc = r"Writes raw bits to the field"]
333 #[inline(always)]
334 pub unsafe fn bits(self, value: u8) -> &'a mut W {
335 self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
336 self.w
337 }
338}
339#[doc = "Reader of field `TBOTE`"]
340pub type TBOTE_R = crate::R<bool, bool>;
341#[doc = "Write proxy for field `TBOTE`"]
342pub struct TBOTE_W<'a> {
343 w: &'a mut W,
344}
345impl<'a> TBOTE_W<'a> {
346 #[doc = r"Sets the field bit"]
347 #[inline(always)]
348 pub fn set_bit(self) -> &'a mut W {
349 self.bit(true)
350 }
351 #[doc = r"Clears the field bit"]
352 #[inline(always)]
353 pub fn clear_bit(self) -> &'a mut W {
354 self.bit(false)
355 }
356 #[doc = r"Writes raw bits to the field"]
357 #[inline(always)]
358 pub fn bit(self, value: bool) -> &'a mut W {
359 self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
360 self.w
361 }
362}
363#[doc = "Reader of field `TBPWML`"]
364pub type TBPWML_R = crate::R<bool, bool>;
365#[doc = "Write proxy for field `TBPWML`"]
366pub struct TBPWML_W<'a> {
367 w: &'a mut W,
368}
369impl<'a> TBPWML_W<'a> {
370 #[doc = r"Sets the field bit"]
371 #[inline(always)]
372 pub fn set_bit(self) -> &'a mut W {
373 self.bit(true)
374 }
375 #[doc = r"Clears the field bit"]
376 #[inline(always)]
377 pub fn clear_bit(self) -> &'a mut W {
378 self.bit(false)
379 }
380 #[doc = r"Writes raw bits to the field"]
381 #[inline(always)]
382 pub fn bit(self, value: bool) -> &'a mut W {
383 self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
384 self.w
385 }
386}
387impl R {
388 #[doc = "Bit 0 - GPTM Timer A Enable"]
389 #[inline(always)]
390 pub fn taen(&self) -> TAEN_R {
391 TAEN_R::new((self.bits & 0x01) != 0)
392 }
393 #[doc = "Bit 1 - GPTM Timer A Stall Enable"]
394 #[inline(always)]
395 pub fn tastall(&self) -> TASTALL_R {
396 TASTALL_R::new(((self.bits >> 1) & 0x01) != 0)
397 }
398 #[doc = "Bits 2:3 - GPTM Timer A Event Mode"]
399 #[inline(always)]
400 pub fn taevent(&self) -> TAEVENT_R {
401 TAEVENT_R::new(((self.bits >> 2) & 0x03) as u8)
402 }
403 #[doc = "Bit 4 - GPTM RTC Stall Enable"]
404 #[inline(always)]
405 pub fn rtcen(&self) -> RTCEN_R {
406 RTCEN_R::new(((self.bits >> 4) & 0x01) != 0)
407 }
408 #[doc = "Bit 5 - GPTM Timer A Output Trigger Enable"]
409 #[inline(always)]
410 pub fn taote(&self) -> TAOTE_R {
411 TAOTE_R::new(((self.bits >> 5) & 0x01) != 0)
412 }
413 #[doc = "Bit 6 - GPTM Timer A PWM Output Level"]
414 #[inline(always)]
415 pub fn tapwml(&self) -> TAPWML_R {
416 TAPWML_R::new(((self.bits >> 6) & 0x01) != 0)
417 }
418 #[doc = "Bit 8 - GPTM Timer B Enable"]
419 #[inline(always)]
420 pub fn tben(&self) -> TBEN_R {
421 TBEN_R::new(((self.bits >> 8) & 0x01) != 0)
422 }
423 #[doc = "Bit 9 - GPTM Timer B Stall Enable"]
424 #[inline(always)]
425 pub fn tbstall(&self) -> TBSTALL_R {
426 TBSTALL_R::new(((self.bits >> 9) & 0x01) != 0)
427 }
428 #[doc = "Bits 10:11 - GPTM Timer B Event Mode"]
429 #[inline(always)]
430 pub fn tbevent(&self) -> TBEVENT_R {
431 TBEVENT_R::new(((self.bits >> 10) & 0x03) as u8)
432 }
433 #[doc = "Bit 13 - GPTM Timer B Output Trigger Enable"]
434 #[inline(always)]
435 pub fn tbote(&self) -> TBOTE_R {
436 TBOTE_R::new(((self.bits >> 13) & 0x01) != 0)
437 }
438 #[doc = "Bit 14 - GPTM Timer B PWM Output Level"]
439 #[inline(always)]
440 pub fn tbpwml(&self) -> TBPWML_R {
441 TBPWML_R::new(((self.bits >> 14) & 0x01) != 0)
442 }
443}
444impl W {
445 #[doc = "Bit 0 - GPTM Timer A Enable"]
446 #[inline(always)]
447 pub fn taen(&mut self) -> TAEN_W {
448 TAEN_W { w: self }
449 }
450 #[doc = "Bit 1 - GPTM Timer A Stall Enable"]
451 #[inline(always)]
452 pub fn tastall(&mut self) -> TASTALL_W {
453 TASTALL_W { w: self }
454 }
455 #[doc = "Bits 2:3 - GPTM Timer A Event Mode"]
456 #[inline(always)]
457 pub fn taevent(&mut self) -> TAEVENT_W {
458 TAEVENT_W { w: self }
459 }
460 #[doc = "Bit 4 - GPTM RTC Stall Enable"]
461 #[inline(always)]
462 pub fn rtcen(&mut self) -> RTCEN_W {
463 RTCEN_W { w: self }
464 }
465 #[doc = "Bit 5 - GPTM Timer A Output Trigger Enable"]
466 #[inline(always)]
467 pub fn taote(&mut self) -> TAOTE_W {
468 TAOTE_W { w: self }
469 }
470 #[doc = "Bit 6 - GPTM Timer A PWM Output Level"]
471 #[inline(always)]
472 pub fn tapwml(&mut self) -> TAPWML_W {
473 TAPWML_W { w: self }
474 }
475 #[doc = "Bit 8 - GPTM Timer B Enable"]
476 #[inline(always)]
477 pub fn tben(&mut self) -> TBEN_W {
478 TBEN_W { w: self }
479 }
480 #[doc = "Bit 9 - GPTM Timer B Stall Enable"]
481 #[inline(always)]
482 pub fn tbstall(&mut self) -> TBSTALL_W {
483 TBSTALL_W { w: self }
484 }
485 #[doc = "Bits 10:11 - GPTM Timer B Event Mode"]
486 #[inline(always)]
487 pub fn tbevent(&mut self) -> TBEVENT_W {
488 TBEVENT_W { w: self }
489 }
490 #[doc = "Bit 13 - GPTM Timer B Output Trigger Enable"]
491 #[inline(always)]
492 pub fn tbote(&mut self) -> TBOTE_W {
493 TBOTE_W { w: self }
494 }
495 #[doc = "Bit 14 - GPTM Timer B PWM Output Level"]
496 #[inline(always)]
497 pub fn tbpwml(&mut self) -> TBPWML_W {
498 TBPWML_W { w: self }
499 }
500}