tm4c123x/timer0/
tamr.rs

1#[doc = "Reader of register TAMR"]
2pub type R = crate::R<u32, super::TAMR>;
3#[doc = "Writer for register TAMR"]
4pub type W = crate::W<u32, super::TAMR>;
5#[doc = "Register TAMR `reset()`'s with value 0"]
6impl crate::ResetValue for super::TAMR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "GPTM Timer A Mode\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum TAMR_A {
17    #[doc = "1: One-Shot Timer mode"]
18    _1_SHOT = 1,
19    #[doc = "2: Periodic Timer mode"]
20    PERIOD = 2,
21    #[doc = "3: Capture mode"]
22    CAP = 3,
23}
24impl From<TAMR_A> for u8 {
25    #[inline(always)]
26    fn from(variant: TAMR_A) -> Self {
27        variant as _
28    }
29}
30#[doc = "Reader of field `TAMR`"]
31pub type TAMR_R = crate::R<u8, TAMR_A>;
32impl TAMR_R {
33    #[doc = r"Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> crate::Variant<u8, TAMR_A> {
36        use crate::Variant::*;
37        match self.bits {
38            1 => Val(TAMR_A::_1_SHOT),
39            2 => Val(TAMR_A::PERIOD),
40            3 => Val(TAMR_A::CAP),
41            i => Res(i),
42        }
43    }
44    #[doc = "Checks if the value of the field is `_1_SHOT`"]
45    #[inline(always)]
46    pub fn is_1_shot(&self) -> bool {
47        *self == TAMR_A::_1_SHOT
48    }
49    #[doc = "Checks if the value of the field is `PERIOD`"]
50    #[inline(always)]
51    pub fn is_period(&self) -> bool {
52        *self == TAMR_A::PERIOD
53    }
54    #[doc = "Checks if the value of the field is `CAP`"]
55    #[inline(always)]
56    pub fn is_cap(&self) -> bool {
57        *self == TAMR_A::CAP
58    }
59}
60#[doc = "Write proxy for field `TAMR`"]
61pub struct TAMR_W<'a> {
62    w: &'a mut W,
63}
64impl<'a> TAMR_W<'a> {
65    #[doc = r"Writes `variant` to the field"]
66    #[inline(always)]
67    pub fn variant(self, variant: TAMR_A) -> &'a mut W {
68        unsafe { self.bits(variant.into()) }
69    }
70    #[doc = "One-Shot Timer mode"]
71    #[inline(always)]
72    pub fn _1_shot(self) -> &'a mut W {
73        self.variant(TAMR_A::_1_SHOT)
74    }
75    #[doc = "Periodic Timer mode"]
76    #[inline(always)]
77    pub fn period(self) -> &'a mut W {
78        self.variant(TAMR_A::PERIOD)
79    }
80    #[doc = "Capture mode"]
81    #[inline(always)]
82    pub fn cap(self) -> &'a mut W {
83        self.variant(TAMR_A::CAP)
84    }
85    #[doc = r"Writes raw bits to the field"]
86    #[inline(always)]
87    pub unsafe fn bits(self, value: u8) -> &'a mut W {
88        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
89        self.w
90    }
91}
92#[doc = "Reader of field `TACMR`"]
93pub type TACMR_R = crate::R<bool, bool>;
94#[doc = "Write proxy for field `TACMR`"]
95pub struct TACMR_W<'a> {
96    w: &'a mut W,
97}
98impl<'a> TACMR_W<'a> {
99    #[doc = r"Sets the field bit"]
100    #[inline(always)]
101    pub fn set_bit(self) -> &'a mut W {
102        self.bit(true)
103    }
104    #[doc = r"Clears the field bit"]
105    #[inline(always)]
106    pub fn clear_bit(self) -> &'a mut W {
107        self.bit(false)
108    }
109    #[doc = r"Writes raw bits to the field"]
110    #[inline(always)]
111    pub fn bit(self, value: bool) -> &'a mut W {
112        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
113        self.w
114    }
115}
116#[doc = "Reader of field `TAAMS`"]
117pub type TAAMS_R = crate::R<bool, bool>;
118#[doc = "Write proxy for field `TAAMS`"]
119pub struct TAAMS_W<'a> {
120    w: &'a mut W,
121}
122impl<'a> TAAMS_W<'a> {
123    #[doc = r"Sets the field bit"]
124    #[inline(always)]
125    pub fn set_bit(self) -> &'a mut W {
126        self.bit(true)
127    }
128    #[doc = r"Clears the field bit"]
129    #[inline(always)]
130    pub fn clear_bit(self) -> &'a mut W {
131        self.bit(false)
132    }
133    #[doc = r"Writes raw bits to the field"]
134    #[inline(always)]
135    pub fn bit(self, value: bool) -> &'a mut W {
136        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
137        self.w
138    }
139}
140#[doc = "Reader of field `TACDIR`"]
141pub type TACDIR_R = crate::R<bool, bool>;
142#[doc = "Write proxy for field `TACDIR`"]
143pub struct TACDIR_W<'a> {
144    w: &'a mut W,
145}
146impl<'a> TACDIR_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 `TAMIE`"]
165pub type TAMIE_R = crate::R<bool, bool>;
166#[doc = "Write proxy for field `TAMIE`"]
167pub struct TAMIE_W<'a> {
168    w: &'a mut W,
169}
170impl<'a> TAMIE_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 `TAWOT`"]
189pub type TAWOT_R = crate::R<bool, bool>;
190#[doc = "Write proxy for field `TAWOT`"]
191pub struct TAWOT_W<'a> {
192    w: &'a mut W,
193}
194impl<'a> TAWOT_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 `TASNAPS`"]
213pub type TASNAPS_R = crate::R<bool, bool>;
214#[doc = "Write proxy for field `TASNAPS`"]
215pub struct TASNAPS_W<'a> {
216    w: &'a mut W,
217}
218impl<'a> TASNAPS_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 << 7)) | (((value as u32) & 0x01) << 7);
233        self.w
234    }
235}
236#[doc = "Reader of field `TAILD`"]
237pub type TAILD_R = crate::R<bool, bool>;
238#[doc = "Write proxy for field `TAILD`"]
239pub struct TAILD_W<'a> {
240    w: &'a mut W,
241}
242impl<'a> TAILD_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 << 8)) | (((value as u32) & 0x01) << 8);
257        self.w
258    }
259}
260#[doc = "Reader of field `TAPWMIE`"]
261pub type TAPWMIE_R = crate::R<bool, bool>;
262#[doc = "Write proxy for field `TAPWMIE`"]
263pub struct TAPWMIE_W<'a> {
264    w: &'a mut W,
265}
266impl<'a> TAPWMIE_W<'a> {
267    #[doc = r"Sets the field bit"]
268    #[inline(always)]
269    pub fn set_bit(self) -> &'a mut W {
270        self.bit(true)
271    }
272    #[doc = r"Clears the field bit"]
273    #[inline(always)]
274    pub fn clear_bit(self) -> &'a mut W {
275        self.bit(false)
276    }
277    #[doc = r"Writes raw bits to the field"]
278    #[inline(always)]
279    pub fn bit(self, value: bool) -> &'a mut W {
280        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
281        self.w
282    }
283}
284#[doc = "Reader of field `TAMRSU`"]
285pub type TAMRSU_R = crate::R<bool, bool>;
286#[doc = "Write proxy for field `TAMRSU`"]
287pub struct TAMRSU_W<'a> {
288    w: &'a mut W,
289}
290impl<'a> TAMRSU_W<'a> {
291    #[doc = r"Sets the field bit"]
292    #[inline(always)]
293    pub fn set_bit(self) -> &'a mut W {
294        self.bit(true)
295    }
296    #[doc = r"Clears the field bit"]
297    #[inline(always)]
298    pub fn clear_bit(self) -> &'a mut W {
299        self.bit(false)
300    }
301    #[doc = r"Writes raw bits to the field"]
302    #[inline(always)]
303    pub fn bit(self, value: bool) -> &'a mut W {
304        self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
305        self.w
306    }
307}
308#[doc = "Reader of field `TAPLO`"]
309pub type TAPLO_R = crate::R<bool, bool>;
310#[doc = "Write proxy for field `TAPLO`"]
311pub struct TAPLO_W<'a> {
312    w: &'a mut W,
313}
314impl<'a> TAPLO_W<'a> {
315    #[doc = r"Sets the field bit"]
316    #[inline(always)]
317    pub fn set_bit(self) -> &'a mut W {
318        self.bit(true)
319    }
320    #[doc = r"Clears the field bit"]
321    #[inline(always)]
322    pub fn clear_bit(self) -> &'a mut W {
323        self.bit(false)
324    }
325    #[doc = r"Writes raw bits to the field"]
326    #[inline(always)]
327    pub fn bit(self, value: bool) -> &'a mut W {
328        self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
329        self.w
330    }
331}
332impl R {
333    #[doc = "Bits 0:1 - GPTM Timer A Mode"]
334    #[inline(always)]
335    pub fn tamr(&self) -> TAMR_R {
336        TAMR_R::new((self.bits & 0x03) as u8)
337    }
338    #[doc = "Bit 2 - GPTM Timer A Capture Mode"]
339    #[inline(always)]
340    pub fn tacmr(&self) -> TACMR_R {
341        TACMR_R::new(((self.bits >> 2) & 0x01) != 0)
342    }
343    #[doc = "Bit 3 - GPTM Timer A Alternate Mode Select"]
344    #[inline(always)]
345    pub fn taams(&self) -> TAAMS_R {
346        TAAMS_R::new(((self.bits >> 3) & 0x01) != 0)
347    }
348    #[doc = "Bit 4 - GPTM Timer A Count Direction"]
349    #[inline(always)]
350    pub fn tacdir(&self) -> TACDIR_R {
351        TACDIR_R::new(((self.bits >> 4) & 0x01) != 0)
352    }
353    #[doc = "Bit 5 - GPTM Timer A Match Interrupt Enable"]
354    #[inline(always)]
355    pub fn tamie(&self) -> TAMIE_R {
356        TAMIE_R::new(((self.bits >> 5) & 0x01) != 0)
357    }
358    #[doc = "Bit 6 - GPTM Timer A Wait-on-Trigger"]
359    #[inline(always)]
360    pub fn tawot(&self) -> TAWOT_R {
361        TAWOT_R::new(((self.bits >> 6) & 0x01) != 0)
362    }
363    #[doc = "Bit 7 - GPTM Timer A Snap-Shot Mode"]
364    #[inline(always)]
365    pub fn tasnaps(&self) -> TASNAPS_R {
366        TASNAPS_R::new(((self.bits >> 7) & 0x01) != 0)
367    }
368    #[doc = "Bit 8 - GPTM Timer A Interval Load Write"]
369    #[inline(always)]
370    pub fn taild(&self) -> TAILD_R {
371        TAILD_R::new(((self.bits >> 8) & 0x01) != 0)
372    }
373    #[doc = "Bit 9 - GPTM Timer A PWM Interrupt Enable"]
374    #[inline(always)]
375    pub fn tapwmie(&self) -> TAPWMIE_R {
376        TAPWMIE_R::new(((self.bits >> 9) & 0x01) != 0)
377    }
378    #[doc = "Bit 10 - GPTM Timer A Match Register Update"]
379    #[inline(always)]
380    pub fn tamrsu(&self) -> TAMRSU_R {
381        TAMRSU_R::new(((self.bits >> 10) & 0x01) != 0)
382    }
383    #[doc = "Bit 11 - GPTM Timer A PWM Legacy Operation"]
384    #[inline(always)]
385    pub fn taplo(&self) -> TAPLO_R {
386        TAPLO_R::new(((self.bits >> 11) & 0x01) != 0)
387    }
388}
389impl W {
390    #[doc = "Bits 0:1 - GPTM Timer A Mode"]
391    #[inline(always)]
392    pub fn tamr(&mut self) -> TAMR_W {
393        TAMR_W { w: self }
394    }
395    #[doc = "Bit 2 - GPTM Timer A Capture Mode"]
396    #[inline(always)]
397    pub fn tacmr(&mut self) -> TACMR_W {
398        TACMR_W { w: self }
399    }
400    #[doc = "Bit 3 - GPTM Timer A Alternate Mode Select"]
401    #[inline(always)]
402    pub fn taams(&mut self) -> TAAMS_W {
403        TAAMS_W { w: self }
404    }
405    #[doc = "Bit 4 - GPTM Timer A Count Direction"]
406    #[inline(always)]
407    pub fn tacdir(&mut self) -> TACDIR_W {
408        TACDIR_W { w: self }
409    }
410    #[doc = "Bit 5 - GPTM Timer A Match Interrupt Enable"]
411    #[inline(always)]
412    pub fn tamie(&mut self) -> TAMIE_W {
413        TAMIE_W { w: self }
414    }
415    #[doc = "Bit 6 - GPTM Timer A Wait-on-Trigger"]
416    #[inline(always)]
417    pub fn tawot(&mut self) -> TAWOT_W {
418        TAWOT_W { w: self }
419    }
420    #[doc = "Bit 7 - GPTM Timer A Snap-Shot Mode"]
421    #[inline(always)]
422    pub fn tasnaps(&mut self) -> TASNAPS_W {
423        TASNAPS_W { w: self }
424    }
425    #[doc = "Bit 8 - GPTM Timer A Interval Load Write"]
426    #[inline(always)]
427    pub fn taild(&mut self) -> TAILD_W {
428        TAILD_W { w: self }
429    }
430    #[doc = "Bit 9 - GPTM Timer A PWM Interrupt Enable"]
431    #[inline(always)]
432    pub fn tapwmie(&mut self) -> TAPWMIE_W {
433        TAPWMIE_W { w: self }
434    }
435    #[doc = "Bit 10 - GPTM Timer A Match Register Update"]
436    #[inline(always)]
437    pub fn tamrsu(&mut self) -> TAMRSU_W {
438        TAMRSU_W { w: self }
439    }
440    #[doc = "Bit 11 - GPTM Timer A PWM Legacy Operation"]
441    #[inline(always)]
442    pub fn taplo(&mut self) -> TAPLO_W {
443        TAPLO_W { w: self }
444    }
445}