cc2538/gptimer0/
pp.rs

1#[doc = "Reader of register PP"]
2pub type R = crate::R<u32, super::PP>;
3#[doc = "Writer for register PP"]
4pub type W = crate::W<u32, super::PP>;
5#[doc = "Register PP `reset()`'s with value 0"]
6impl crate::ResetValue for super::PP {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved32`"]
14pub type RESERVED32_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved32`"]
16pub struct RESERVED32_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED32_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x01ff_ffff << 7)) | (((value as u32) & 0x01ff_ffff) << 7);
24        self.w
25    }
26}
27#[doc = "Reader of field `ALTCLK`"]
28pub type ALTCLK_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `ALTCLK`"]
30pub struct ALTCLK_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> ALTCLK_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
48        self.w
49    }
50}
51#[doc = "Reader of field `SYNCNT`"]
52pub type SYNCNT_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `SYNCNT`"]
54pub struct SYNCNT_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> SYNCNT_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
72        self.w
73    }
74}
75#[doc = "Reader of field `CHAIN`"]
76pub type CHAIN_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `CHAIN`"]
78pub struct CHAIN_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> CHAIN_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
96        self.w
97    }
98}
99#[doc = "Reader of field `SIZE`"]
100pub type SIZE_R = crate::R<u8, u8>;
101#[doc = "Write proxy for field `SIZE`"]
102pub struct SIZE_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> SIZE_W<'a> {
106    #[doc = r"Writes raw bits to the field"]
107    #[inline(always)]
108    pub unsafe fn bits(self, value: u8) -> &'a mut W {
109        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
110        self.w
111    }
112}
113impl R {
114    #[doc = "Bits 7:31 - 31:7\\] Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation."]
115    #[inline(always)]
116    pub fn reserved32(&self) -> RESERVED32_R {
117        RESERVED32_R::new(((self.bits >> 7) & 0x01ff_ffff) as u32)
118    }
119    #[doc = "Bit 6 - 6:6\\] Alternate clock source 0: Timer is not capable of using an alternate clock. 1: Timer is capable of using an alternate clock."]
120    #[inline(always)]
121    pub fn altclk(&self) -> ALTCLK_R {
122        ALTCLK_R::new(((self.bits >> 6) & 0x01) != 0)
123    }
124    #[doc = "Bit 5 - 5:5\\] Synchronized start 0: Timer is not capable of synchronizing the count value with other timers. 1: Timer is capable of synchronizing the count value with other timers."]
125    #[inline(always)]
126    pub fn syncnt(&self) -> SYNCNT_R {
127        SYNCNT_R::new(((self.bits >> 5) & 0x01) != 0)
128    }
129    #[doc = "Bit 4 - 4:4\\] Chain with other timers 0: Timer is not capable of chaining with previously numbered Timers. 1: Timer is capable of chaining with previously numbered timers."]
130    #[inline(always)]
131    pub fn chain(&self) -> CHAIN_R {
132        CHAIN_R::new(((self.bits >> 4) & 0x01) != 0)
133    }
134    #[doc = "Bits 0:3 - 3:0\\] Timer size 0: Timer A and Timer B are 16 bits wide with 8-bit prescale. 1: Timer A and Timer B are 32 bits wide with 16-bit prescale."]
135    #[inline(always)]
136    pub fn size(&self) -> SIZE_R {
137        SIZE_R::new((self.bits & 0x0f) as u8)
138    }
139}
140impl W {
141    #[doc = "Bits 7:31 - 31:7\\] Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation."]
142    #[inline(always)]
143    pub fn reserved32(&mut self) -> RESERVED32_W {
144        RESERVED32_W { w: self }
145    }
146    #[doc = "Bit 6 - 6:6\\] Alternate clock source 0: Timer is not capable of using an alternate clock. 1: Timer is capable of using an alternate clock."]
147    #[inline(always)]
148    pub fn altclk(&mut self) -> ALTCLK_W {
149        ALTCLK_W { w: self }
150    }
151    #[doc = "Bit 5 - 5:5\\] Synchronized start 0: Timer is not capable of synchronizing the count value with other timers. 1: Timer is capable of synchronizing the count value with other timers."]
152    #[inline(always)]
153    pub fn syncnt(&mut self) -> SYNCNT_W {
154        SYNCNT_W { w: self }
155    }
156    #[doc = "Bit 4 - 4:4\\] Chain with other timers 0: Timer is not capable of chaining with previously numbered Timers. 1: Timer is capable of chaining with previously numbered timers."]
157    #[inline(always)]
158    pub fn chain(&mut self) -> CHAIN_W {
159        CHAIN_W { w: self }
160    }
161    #[doc = "Bits 0:3 - 3:0\\] Timer size 0: Timer A and Timer B are 16 bits wide with 8-bit prescale. 1: Timer A and Timer B are 32 bits wide with 16-bit prescale."]
162    #[inline(always)]
163    pub fn size(&mut self) -> SIZE_W {
164        SIZE_W { w: self }
165    }
166}