1#[doc = "Register `TACTL` reader"]
2pub struct R(crate::R<TACTL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<TACTL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<TACTL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<TACTL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `TACTL` writer"]
17pub struct W(crate::W<TACTL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<TACTL_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<TACTL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<TACTL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TAIFG` reader - Timer A counter interrupt flag"]
38pub type TAIFG_R = crate::BitReader<bool>;
39#[doc = "Field `TAIFG` writer - Timer A counter interrupt flag"]
40pub type TAIFG_W<'a, const O: u8> = crate::BitWriter<'a, u16, TACTL_SPEC, bool, O>;
41#[doc = "Field `TAIE` reader - Timer A counter interrupt enable"]
42pub type TAIE_R = crate::BitReader<bool>;
43#[doc = "Field `TAIE` writer - Timer A counter interrupt enable"]
44pub type TAIE_W<'a, const O: u8> = crate::BitWriter<'a, u16, TACTL_SPEC, bool, O>;
45#[doc = "Field `TACLR` reader - Timer A counter clear"]
46pub type TACLR_R = crate::BitReader<bool>;
47#[doc = "Field `TACLR` writer - Timer A counter clear"]
48pub type TACLR_W<'a, const O: u8> = crate::BitWriter<'a, u16, TACTL_SPEC, bool, O>;
49#[doc = "Field `MC` reader - Timer A mode control 1"]
50pub type MC_R = crate::FieldReader<u8, MC_A>;
51#[doc = "Timer A mode control 1\n\nValue on reset: 0"]
52#[derive(Clone, Copy, Debug, PartialEq, Eq)]
53#[repr(u8)]
54pub enum MC_A {
55 #[doc = "0: Timer A mode control: 0 - Stop"]
56 MC_0 = 0,
57 #[doc = "1: Timer A mode control: 1 - Up to CCR0"]
58 MC_1 = 1,
59 #[doc = "2: Timer A mode control: 2 - Continous up"]
60 MC_2 = 2,
61 #[doc = "3: Timer A mode control: 3 - Up/Down"]
62 MC_3 = 3,
63}
64impl From<MC_A> for u8 {
65 #[inline(always)]
66 fn from(variant: MC_A) -> Self {
67 variant as _
68 }
69}
70impl MC_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> MC_A {
74 match self.bits {
75 0 => MC_A::MC_0,
76 1 => MC_A::MC_1,
77 2 => MC_A::MC_2,
78 3 => MC_A::MC_3,
79 _ => unreachable!(),
80 }
81 }
82 #[doc = "Checks if the value of the field is `MC_0`"]
83 #[inline(always)]
84 pub fn is_mc_0(&self) -> bool {
85 *self == MC_A::MC_0
86 }
87 #[doc = "Checks if the value of the field is `MC_1`"]
88 #[inline(always)]
89 pub fn is_mc_1(&self) -> bool {
90 *self == MC_A::MC_1
91 }
92 #[doc = "Checks if the value of the field is `MC_2`"]
93 #[inline(always)]
94 pub fn is_mc_2(&self) -> bool {
95 *self == MC_A::MC_2
96 }
97 #[doc = "Checks if the value of the field is `MC_3`"]
98 #[inline(always)]
99 pub fn is_mc_3(&self) -> bool {
100 *self == MC_A::MC_3
101 }
102}
103#[doc = "Field `MC` writer - Timer A mode control 1"]
104pub type MC_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, TACTL_SPEC, u8, MC_A, 2, O>;
105impl<'a, const O: u8> MC_W<'a, O> {
106 #[doc = "Timer A mode control: 0 - Stop"]
107 #[inline(always)]
108 pub fn mc_0(self) -> &'a mut W {
109 self.variant(MC_A::MC_0)
110 }
111 #[doc = "Timer A mode control: 1 - Up to CCR0"]
112 #[inline(always)]
113 pub fn mc_1(self) -> &'a mut W {
114 self.variant(MC_A::MC_1)
115 }
116 #[doc = "Timer A mode control: 2 - Continous up"]
117 #[inline(always)]
118 pub fn mc_2(self) -> &'a mut W {
119 self.variant(MC_A::MC_2)
120 }
121 #[doc = "Timer A mode control: 3 - Up/Down"]
122 #[inline(always)]
123 pub fn mc_3(self) -> &'a mut W {
124 self.variant(MC_A::MC_3)
125 }
126}
127#[doc = "Field `ID` reader - Timer A clock input divider 1"]
128pub type ID_R = crate::FieldReader<u8, ID_A>;
129#[doc = "Timer A clock input divider 1\n\nValue on reset: 0"]
130#[derive(Clone, Copy, Debug, PartialEq, Eq)]
131#[repr(u8)]
132pub enum ID_A {
133 #[doc = "0: Timer A input divider: 0 - /1"]
134 ID_0 = 0,
135 #[doc = "1: Timer A input divider: 1 - /2"]
136 ID_1 = 1,
137 #[doc = "2: Timer A input divider: 2 - /4"]
138 ID_2 = 2,
139 #[doc = "3: Timer A input divider: 3 - /8"]
140 ID_3 = 3,
141}
142impl From<ID_A> for u8 {
143 #[inline(always)]
144 fn from(variant: ID_A) -> Self {
145 variant as _
146 }
147}
148impl ID_R {
149 #[doc = "Get enumerated values variant"]
150 #[inline(always)]
151 pub fn variant(&self) -> ID_A {
152 match self.bits {
153 0 => ID_A::ID_0,
154 1 => ID_A::ID_1,
155 2 => ID_A::ID_2,
156 3 => ID_A::ID_3,
157 _ => unreachable!(),
158 }
159 }
160 #[doc = "Checks if the value of the field is `ID_0`"]
161 #[inline(always)]
162 pub fn is_id_0(&self) -> bool {
163 *self == ID_A::ID_0
164 }
165 #[doc = "Checks if the value of the field is `ID_1`"]
166 #[inline(always)]
167 pub fn is_id_1(&self) -> bool {
168 *self == ID_A::ID_1
169 }
170 #[doc = "Checks if the value of the field is `ID_2`"]
171 #[inline(always)]
172 pub fn is_id_2(&self) -> bool {
173 *self == ID_A::ID_2
174 }
175 #[doc = "Checks if the value of the field is `ID_3`"]
176 #[inline(always)]
177 pub fn is_id_3(&self) -> bool {
178 *self == ID_A::ID_3
179 }
180}
181#[doc = "Field `ID` writer - Timer A clock input divider 1"]
182pub type ID_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, TACTL_SPEC, u8, ID_A, 2, O>;
183impl<'a, const O: u8> ID_W<'a, O> {
184 #[doc = "Timer A input divider: 0 - /1"]
185 #[inline(always)]
186 pub fn id_0(self) -> &'a mut W {
187 self.variant(ID_A::ID_0)
188 }
189 #[doc = "Timer A input divider: 1 - /2"]
190 #[inline(always)]
191 pub fn id_1(self) -> &'a mut W {
192 self.variant(ID_A::ID_1)
193 }
194 #[doc = "Timer A input divider: 2 - /4"]
195 #[inline(always)]
196 pub fn id_2(self) -> &'a mut W {
197 self.variant(ID_A::ID_2)
198 }
199 #[doc = "Timer A input divider: 3 - /8"]
200 #[inline(always)]
201 pub fn id_3(self) -> &'a mut W {
202 self.variant(ID_A::ID_3)
203 }
204}
205#[doc = "Field `TASSEL` reader - Timer A clock source select 1"]
206pub type TASSEL_R = crate::FieldReader<u8, TASSEL_A>;
207#[doc = "Timer A clock source select 1\n\nValue on reset: 0"]
208#[derive(Clone, Copy, Debug, PartialEq, Eq)]
209#[repr(u8)]
210pub enum TASSEL_A {
211 #[doc = "0: Timer A clock source select: 0 - TACLK"]
212 TASSEL_0 = 0,
213 #[doc = "1: Timer A clock source select: 1 - ACLK"]
214 TASSEL_1 = 1,
215 #[doc = "2: Timer A clock source select: 2 - SMCLK"]
216 TASSEL_2 = 2,
217 #[doc = "3: Timer A clock source select: 3 - INCLK"]
218 TASSEL_3 = 3,
219}
220impl From<TASSEL_A> for u8 {
221 #[inline(always)]
222 fn from(variant: TASSEL_A) -> Self {
223 variant as _
224 }
225}
226impl TASSEL_R {
227 #[doc = "Get enumerated values variant"]
228 #[inline(always)]
229 pub fn variant(&self) -> TASSEL_A {
230 match self.bits {
231 0 => TASSEL_A::TASSEL_0,
232 1 => TASSEL_A::TASSEL_1,
233 2 => TASSEL_A::TASSEL_2,
234 3 => TASSEL_A::TASSEL_3,
235 _ => unreachable!(),
236 }
237 }
238 #[doc = "Checks if the value of the field is `TASSEL_0`"]
239 #[inline(always)]
240 pub fn is_tassel_0(&self) -> bool {
241 *self == TASSEL_A::TASSEL_0
242 }
243 #[doc = "Checks if the value of the field is `TASSEL_1`"]
244 #[inline(always)]
245 pub fn is_tassel_1(&self) -> bool {
246 *self == TASSEL_A::TASSEL_1
247 }
248 #[doc = "Checks if the value of the field is `TASSEL_2`"]
249 #[inline(always)]
250 pub fn is_tassel_2(&self) -> bool {
251 *self == TASSEL_A::TASSEL_2
252 }
253 #[doc = "Checks if the value of the field is `TASSEL_3`"]
254 #[inline(always)]
255 pub fn is_tassel_3(&self) -> bool {
256 *self == TASSEL_A::TASSEL_3
257 }
258}
259#[doc = "Field `TASSEL` writer - Timer A clock source select 1"]
260pub type TASSEL_W<'a, const O: u8> =
261 crate::FieldWriterSafe<'a, u16, TACTL_SPEC, u8, TASSEL_A, 2, O>;
262impl<'a, const O: u8> TASSEL_W<'a, O> {
263 #[doc = "Timer A clock source select: 0 - TACLK"]
264 #[inline(always)]
265 pub fn tassel_0(self) -> &'a mut W {
266 self.variant(TASSEL_A::TASSEL_0)
267 }
268 #[doc = "Timer A clock source select: 1 - ACLK"]
269 #[inline(always)]
270 pub fn tassel_1(self) -> &'a mut W {
271 self.variant(TASSEL_A::TASSEL_1)
272 }
273 #[doc = "Timer A clock source select: 2 - SMCLK"]
274 #[inline(always)]
275 pub fn tassel_2(self) -> &'a mut W {
276 self.variant(TASSEL_A::TASSEL_2)
277 }
278 #[doc = "Timer A clock source select: 3 - INCLK"]
279 #[inline(always)]
280 pub fn tassel_3(self) -> &'a mut W {
281 self.variant(TASSEL_A::TASSEL_3)
282 }
283}
284impl R {
285 #[doc = "Bit 0 - Timer A counter interrupt flag"]
286 #[inline(always)]
287 pub fn taifg(&self) -> TAIFG_R {
288 TAIFG_R::new((self.bits & 1) != 0)
289 }
290 #[doc = "Bit 1 - Timer A counter interrupt enable"]
291 #[inline(always)]
292 pub fn taie(&self) -> TAIE_R {
293 TAIE_R::new(((self.bits >> 1) & 1) != 0)
294 }
295 #[doc = "Bit 2 - Timer A counter clear"]
296 #[inline(always)]
297 pub fn taclr(&self) -> TACLR_R {
298 TACLR_R::new(((self.bits >> 2) & 1) != 0)
299 }
300 #[doc = "Bits 4:5 - Timer A mode control 1"]
301 #[inline(always)]
302 pub fn mc(&self) -> MC_R {
303 MC_R::new(((self.bits >> 4) & 3) as u8)
304 }
305 #[doc = "Bits 6:7 - Timer A clock input divider 1"]
306 #[inline(always)]
307 pub fn id(&self) -> ID_R {
308 ID_R::new(((self.bits >> 6) & 3) as u8)
309 }
310 #[doc = "Bits 8:9 - Timer A clock source select 1"]
311 #[inline(always)]
312 pub fn tassel(&self) -> TASSEL_R {
313 TASSEL_R::new(((self.bits >> 8) & 3) as u8)
314 }
315}
316impl W {
317 #[doc = "Bit 0 - Timer A counter interrupt flag"]
318 #[inline(always)]
319 pub fn taifg(&mut self) -> TAIFG_W<0> {
320 TAIFG_W::new(self)
321 }
322 #[doc = "Bit 1 - Timer A counter interrupt enable"]
323 #[inline(always)]
324 pub fn taie(&mut self) -> TAIE_W<1> {
325 TAIE_W::new(self)
326 }
327 #[doc = "Bit 2 - Timer A counter clear"]
328 #[inline(always)]
329 pub fn taclr(&mut self) -> TACLR_W<2> {
330 TACLR_W::new(self)
331 }
332 #[doc = "Bits 4:5 - Timer A mode control 1"]
333 #[inline(always)]
334 pub fn mc(&mut self) -> MC_W<4> {
335 MC_W::new(self)
336 }
337 #[doc = "Bits 6:7 - Timer A clock input divider 1"]
338 #[inline(always)]
339 pub fn id(&mut self) -> ID_W<6> {
340 ID_W::new(self)
341 }
342 #[doc = "Bits 8:9 - Timer A clock source select 1"]
343 #[inline(always)]
344 pub fn tassel(&mut self) -> TASSEL_W<8> {
345 TASSEL_W::new(self)
346 }
347 #[doc = "Writes raw bits to the register."]
348 #[inline(always)]
349 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
350 self.0.bits(bits);
351 self
352 }
353}
354#[doc = "Timer A Control\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 [tactl](index.html) module"]
355pub struct TACTL_SPEC;
356impl crate::RegisterSpec for TACTL_SPEC {
357 type Ux = u16;
358}
359#[doc = "`read()` method returns [tactl::R](R) reader structure"]
360impl crate::Readable for TACTL_SPEC {
361 type Reader = R;
362}
363#[doc = "`write(|w| ..)` method takes [tactl::W](W) writer structure"]
364impl crate::Writable for TACTL_SPEC {
365 type Writer = W;
366}
367#[doc = "`reset()` method sets TACTL to value 0"]
368impl crate::Resettable for TACTL_SPEC {
369 #[inline(always)]
370 fn reset_value() -> Self::Ux {
371 0
372 }
373}