2 * Copyright (c) 2014, Texas Instruments Incorporated
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
9 * * Redistributions of source code must retain the above copyright
\r
10 * notice, this list of conditions and the following disclaimer.
\r
12 * * Redistributions in binary form must reproduce the above copyright
\r
13 * notice, this list of conditions and the following disclaimer in the
\r
14 * documentation and/or other materials provided with the distribution.
\r
16 * * Neither the name of Texas Instruments Incorporated nor the names of
\r
17 * its contributors may be used to endorse or promote products derived
\r
18 * from this software without specific prior written permission.
\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
\r
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\r
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
\r
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
\r
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
\r
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
\r
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
32 //*****************************************************************************
\r
34 // timer_a.h - Driver for the TIMER_A Module.
\r
36 //*****************************************************************************
\r
38 #ifndef __MSP430WARE_TIMER_A_H__
\r
39 #define __MSP430WARE_TIMER_A_H__
\r
41 #include "inc/hw_memmap.h"
\r
43 #ifdef __MSP430_HAS_TxA7__
\r
45 //*****************************************************************************
\r
47 // If building with a C++ compiler, make all of the definitions in this header
\r
48 // have a C binding.
\r
50 //*****************************************************************************
\r
56 #include "inc/hw_regaccess.h"
\r
57 //*****************************************************************************
\r
59 // The following is a parameter used for Timer_A_getCounterValue that
\r
60 // determines the maximum difference in counts of the TAxR register for a
\r
63 //*****************************************************************************
\r
64 #define TIMER_A_THRESHOLD 50
\r
66 //*****************************************************************************
\r
68 //! \brief Used in the Timer_A_initContinuousMode() function as the param
\r
71 //*****************************************************************************
\r
72 typedef struct Timer_A_initContinuousModeParam
\r
74 //! Selects Clock source.
\r
75 //! \n Valid values are:
\r
76 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
\r
77 //! - \b TIMER_A_CLOCKSOURCE_ACLK
\r
78 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
\r
79 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
\r
80 uint16_t clockSource;
\r
81 //! Is the desired divider for the clock source
\r
82 //! \n Valid values are:
\r
83 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
\r
84 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
\r
85 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
\r
86 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
\r
87 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
\r
88 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
\r
89 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
\r
90 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
\r
91 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
\r
92 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
\r
93 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
\r
94 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
\r
95 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
\r
96 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
\r
97 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
\r
98 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
\r
99 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
\r
100 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
\r
101 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
\r
102 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
\r
103 uint16_t clockSourceDivider;
\r
104 //! Is to enable or disable Timer_A interrupt
\r
105 //! \n Valid values are:
\r
106 //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
\r
107 //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default]
\r
108 uint16_t timerInterruptEnable_TAIE;
\r
109 //! Decides if Timer_A clock divider, count direction, count need to be
\r
111 //! \n Valid values are:
\r
112 //! - \b TIMER_A_DO_CLEAR
\r
113 //! - \b TIMER_A_SKIP_CLEAR [Default]
\r
114 uint16_t timerClear;
\r
115 //! Whether to start the timer immediately
\r
117 } Timer_A_initContinuousModeParam;
\r
119 //*****************************************************************************
\r
121 //! \brief Used in the Timer_A_initCaptureMode() function as the param
\r
124 //*****************************************************************************
\r
125 typedef struct Timer_A_initCaptureModeParam
\r
127 //! Selects the Capture register being used. Refer to datasheet to ensure
\r
128 //! the device has the capture compare register being used.
\r
129 //! \n Valid values are:
\r
130 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
131 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
132 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
133 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
134 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
135 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
136 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
137 uint16_t captureRegister;
\r
138 //! Is the capture mode selected.
\r
139 //! \n Valid values are:
\r
140 //! - \b TIMER_A_CAPTUREMODE_NO_CAPTURE [Default]
\r
141 //! - \b TIMER_A_CAPTUREMODE_RISING_EDGE
\r
142 //! - \b TIMER_A_CAPTUREMODE_FALLING_EDGE
\r
143 //! - \b TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE
\r
144 uint16_t captureMode;
\r
145 //! Decides the Input Select
\r
146 //! \n Valid values are:
\r
147 //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxA
\r
148 //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxB
\r
149 //! - \b TIMER_A_CAPTURE_INPUTSELECT_GND
\r
150 //! - \b TIMER_A_CAPTURE_INPUTSELECT_Vcc
\r
151 uint16_t captureInputSelect;
\r
152 //! Decides if capture source should be synchronized with timer clock
\r
153 //! \n Valid values are:
\r
154 //! - \b TIMER_A_CAPTURE_ASYNCHRONOUS [Default]
\r
155 //! - \b TIMER_A_CAPTURE_SYNCHRONOUS
\r
156 uint16_t synchronizeCaptureSource;
\r
157 //! Is to enable or disable timer captureComapre interrupt.
\r
158 //! \n Valid values are:
\r
159 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default]
\r
160 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
\r
161 uint16_t captureInterruptEnable;
\r
162 //! Specifies the output mode.
\r
163 //! \n Valid values are:
\r
164 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
\r
165 //! - \b TIMER_A_OUTPUTMODE_SET
\r
166 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
\r
167 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
\r
168 //! - \b TIMER_A_OUTPUTMODE_TOGGLE
\r
169 //! - \b TIMER_A_OUTPUTMODE_RESET
\r
170 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
\r
171 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
\r
172 uint16_t captureOutputMode;
\r
173 } Timer_A_initCaptureModeParam;
\r
175 //*****************************************************************************
\r
177 //! \brief Used in the Timer_A_initUpDownMode() function as the param
\r
180 //*****************************************************************************
\r
181 typedef struct Timer_A_initUpDownModeParam
\r
183 //! Selects Clock source.
\r
184 //! \n Valid values are:
\r
185 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
\r
186 //! - \b TIMER_A_CLOCKSOURCE_ACLK
\r
187 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
\r
188 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
\r
189 uint16_t clockSource;
\r
190 //! Is the desired divider for the clock source
\r
191 //! \n Valid values are:
\r
192 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
\r
193 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
\r
194 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
\r
195 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
\r
196 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
\r
197 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
\r
198 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
\r
199 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
\r
200 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
\r
201 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
\r
202 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
\r
203 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
\r
204 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
\r
205 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
\r
206 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
\r
207 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
\r
208 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
\r
209 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
\r
210 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
\r
211 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
\r
212 uint16_t clockSourceDivider;
\r
213 //! Is the specified Timer_A period
\r
214 uint16_t timerPeriod;
\r
215 //! Is to enable or disable Timer_A interrupt
\r
216 //! \n Valid values are:
\r
217 //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
\r
218 //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default]
\r
219 uint16_t timerInterruptEnable_TAIE;
\r
220 //! Is to enable or disable Timer_A CCR0 captureComapre interrupt.
\r
221 //! \n Valid values are:
\r
222 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE
\r
223 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default]
\r
224 uint16_t captureCompareInterruptEnable_CCR0_CCIE;
\r
225 //! Decides if Timer_A clock divider, count direction, count need to be
\r
227 //! \n Valid values are:
\r
228 //! - \b TIMER_A_DO_CLEAR
\r
229 //! - \b TIMER_A_SKIP_CLEAR [Default]
\r
230 uint16_t timerClear;
\r
231 //! Whether to start the timer immediately
\r
233 } Timer_A_initUpDownModeParam;
\r
235 //*****************************************************************************
\r
237 //! \brief Used in the Timer_A_outputPWM() function as the param parameter.
\r
239 //*****************************************************************************
\r
240 typedef struct Timer_A_outputPWMParam
\r
242 //! Selects Clock source.
\r
243 //! \n Valid values are:
\r
244 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
\r
245 //! - \b TIMER_A_CLOCKSOURCE_ACLK
\r
246 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
\r
247 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
\r
248 uint16_t clockSource;
\r
249 //! Is the desired divider for the clock source
\r
250 //! \n Valid values are:
\r
251 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
\r
252 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
\r
253 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
\r
254 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
\r
255 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
\r
256 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
\r
257 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
\r
258 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
\r
259 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
\r
260 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
\r
261 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
\r
262 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
\r
263 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
\r
264 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
\r
265 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
\r
266 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
\r
267 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
\r
268 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
\r
269 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
\r
270 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
\r
271 uint16_t clockSourceDivider;
\r
272 //! Selects the desired timer period
\r
273 uint16_t timerPeriod;
\r
274 //! Selects the compare register being used. Refer to datasheet to ensure
\r
275 //! the device has the capture compare register being used.
\r
276 //! \n Valid values are:
\r
277 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
278 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
279 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
280 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
281 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
282 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
283 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
284 uint16_t compareRegister;
\r
285 //! Specifies the output mode.
\r
286 //! \n Valid values are:
\r
287 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
\r
288 //! - \b TIMER_A_OUTPUTMODE_SET
\r
289 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
\r
290 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
\r
291 //! - \b TIMER_A_OUTPUTMODE_TOGGLE
\r
292 //! - \b TIMER_A_OUTPUTMODE_RESET
\r
293 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
\r
294 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
\r
295 uint16_t compareOutputMode;
\r
296 //! Specifies the dutycycle for the generated waveform
\r
297 uint16_t dutyCycle;
\r
298 } Timer_A_outputPWMParam;
\r
300 //*****************************************************************************
\r
302 //! \brief Used in the Timer_A_initUpMode() function as the param parameter.
\r
304 //*****************************************************************************
\r
305 typedef struct Timer_A_initUpModeParam
\r
307 //! Selects Clock source.
\r
308 //! \n Valid values are:
\r
309 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
\r
310 //! - \b TIMER_A_CLOCKSOURCE_ACLK
\r
311 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
\r
312 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
\r
313 uint16_t clockSource;
\r
314 //! Is the desired divider for the clock source
\r
315 //! \n Valid values are:
\r
316 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
\r
317 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
\r
318 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
\r
319 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
\r
320 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
\r
321 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
\r
322 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
\r
323 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
\r
324 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
\r
325 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
\r
326 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
\r
327 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
\r
328 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
\r
329 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
\r
330 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
\r
331 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
\r
332 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
\r
333 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
\r
334 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
\r
335 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
\r
336 uint16_t clockSourceDivider;
\r
337 //! Is the specified Timer_A period. This is the value that gets written
\r
338 //! into the CCR0. Limited to 16 bits[uint16_t]
\r
339 uint16_t timerPeriod;
\r
340 //! Is to enable or disable Timer_A interrupt
\r
341 //! \n Valid values are:
\r
342 //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
\r
343 //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default]
\r
344 uint16_t timerInterruptEnable_TAIE;
\r
345 //! Is to enable or disable Timer_A CCR0 captureComapre interrupt.
\r
346 //! \n Valid values are:
\r
347 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE
\r
348 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default]
\r
349 uint16_t captureCompareInterruptEnable_CCR0_CCIE;
\r
350 //! Decides if Timer_A clock divider, count direction, count need to be
\r
352 //! \n Valid values are:
\r
353 //! - \b TIMER_A_DO_CLEAR
\r
354 //! - \b TIMER_A_SKIP_CLEAR [Default]
\r
355 uint16_t timerClear;
\r
356 //! Whether to start the timer immediately
\r
358 } Timer_A_initUpModeParam;
\r
360 //*****************************************************************************
\r
362 //! \brief Used in the Timer_A_initCompareMode() function as the param
\r
365 //*****************************************************************************
\r
366 typedef struct Timer_A_initCompareModeParam
\r
368 //! Selects the Capture register being used. Refer to datasheet to ensure
\r
369 //! the device has the capture compare register being used.
\r
370 //! \n Valid values are:
\r
371 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
372 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
373 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
374 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
375 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
376 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
377 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
378 uint16_t compareRegister;
\r
379 //! Is to enable or disable timer captureComapre interrupt.
\r
380 //! \n Valid values are:
\r
381 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default]
\r
382 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
\r
383 uint16_t compareInterruptEnable;
\r
384 //! Specifies the output mode.
\r
385 //! \n Valid values are:
\r
386 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
\r
387 //! - \b TIMER_A_OUTPUTMODE_SET
\r
388 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
\r
389 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
\r
390 //! - \b TIMER_A_OUTPUTMODE_TOGGLE
\r
391 //! - \b TIMER_A_OUTPUTMODE_RESET
\r
392 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
\r
393 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
\r
394 uint16_t compareOutputMode;
\r
395 //! Is the count to be compared with in compare mode
\r
396 uint16_t compareValue;
\r
397 } Timer_A_initCompareModeParam;
\r
399 //*****************************************************************************
\r
401 // The following are values that can be passed to the param parameter for
\r
402 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(),
\r
403 // Timer_A_initUpDownMode(), and Timer_A_outputPWM().
\r
405 //*****************************************************************************
\r
406 #define TIMER_A_CLOCKSOURCE_DIVIDER_1 0x00
\r
407 #define TIMER_A_CLOCKSOURCE_DIVIDER_2 0x08
\r
408 #define TIMER_A_CLOCKSOURCE_DIVIDER_3 0x02
\r
409 #define TIMER_A_CLOCKSOURCE_DIVIDER_4 0x10
\r
410 #define TIMER_A_CLOCKSOURCE_DIVIDER_5 0x04
\r
411 #define TIMER_A_CLOCKSOURCE_DIVIDER_6 0x05
\r
412 #define TIMER_A_CLOCKSOURCE_DIVIDER_7 0x06
\r
413 #define TIMER_A_CLOCKSOURCE_DIVIDER_8 0x18
\r
414 #define TIMER_A_CLOCKSOURCE_DIVIDER_10 0x0C
\r
415 #define TIMER_A_CLOCKSOURCE_DIVIDER_12 0x0D
\r
416 #define TIMER_A_CLOCKSOURCE_DIVIDER_14 0x0E
\r
417 #define TIMER_A_CLOCKSOURCE_DIVIDER_16 0x0F
\r
418 #define TIMER_A_CLOCKSOURCE_DIVIDER_20 0x14
\r
419 #define TIMER_A_CLOCKSOURCE_DIVIDER_24 0x15
\r
420 #define TIMER_A_CLOCKSOURCE_DIVIDER_28 0x16
\r
421 #define TIMER_A_CLOCKSOURCE_DIVIDER_32 0x17
\r
422 #define TIMER_A_CLOCKSOURCE_DIVIDER_40 0x1C
\r
423 #define TIMER_A_CLOCKSOURCE_DIVIDER_48 0x1D
\r
424 #define TIMER_A_CLOCKSOURCE_DIVIDER_56 0x1E
\r
425 #define TIMER_A_CLOCKSOURCE_DIVIDER_64 0x1F
\r
427 //*****************************************************************************
\r
429 // The following are values that can be passed to the timerMode parameter for
\r
430 // functions: Timer_A_startCounter().
\r
432 //*****************************************************************************
\r
433 #define TIMER_A_STOP_MODE MC_0
\r
434 #define TIMER_A_UP_MODE MC_1
\r
435 #define TIMER_A_CONTINUOUS_MODE MC_2
\r
436 #define TIMER_A_UPDOWN_MODE MC_3
\r
438 //*****************************************************************************
\r
440 // The following are values that can be passed to the param parameter for
\r
441 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), and
\r
442 // Timer_A_initUpDownMode().
\r
444 //*****************************************************************************
\r
445 #define TIMER_A_DO_CLEAR TACLR
\r
446 #define TIMER_A_SKIP_CLEAR 0x00
\r
448 //*****************************************************************************
\r
450 // The following are values that can be passed to the param parameter for
\r
451 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(),
\r
452 // Timer_A_initUpDownMode(), and Timer_A_outputPWM().
\r
454 //*****************************************************************************
\r
455 #define TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK TASSEL__TACLK
\r
456 #define TIMER_A_CLOCKSOURCE_ACLK TASSEL__ACLK
\r
457 #define TIMER_A_CLOCKSOURCE_SMCLK TASSEL__SMCLK
\r
458 #define TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK TASSEL__INCLK
\r
460 //*****************************************************************************
\r
462 // The following are values that can be passed to the param parameter for
\r
463 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), and
\r
464 // Timer_A_initUpDownMode().
\r
466 //*****************************************************************************
\r
467 #define TIMER_A_TAIE_INTERRUPT_ENABLE TAIE
\r
468 #define TIMER_A_TAIE_INTERRUPT_DISABLE 0x00
\r
470 //*****************************************************************************
\r
472 // The following are values that can be passed to the param parameter for
\r
473 // functions: Timer_A_initUpMode(), and Timer_A_initUpDownMode().
\r
475 //*****************************************************************************
\r
476 #define TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE CCIE
\r
477 #define TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE 0x00
\r
479 //*****************************************************************************
\r
481 // The following are values that can be passed to the param parameter for
\r
482 // functions: Timer_A_initCaptureMode(), and Timer_A_initCompareMode().
\r
484 //*****************************************************************************
\r
485 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE 0x00
\r
486 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE CCIE
\r
488 //*****************************************************************************
\r
490 // The following are values that can be passed to the param parameter for
\r
491 // functions: Timer_A_initCaptureMode().
\r
493 //*****************************************************************************
\r
494 #define TIMER_A_CAPTURE_INPUTSELECT_CCIxA CCIS_0
\r
495 #define TIMER_A_CAPTURE_INPUTSELECT_CCIxB CCIS_1
\r
496 #define TIMER_A_CAPTURE_INPUTSELECT_GND CCIS_2
\r
497 #define TIMER_A_CAPTURE_INPUTSELECT_Vcc CCIS_3
\r
499 //*****************************************************************************
\r
501 // The following are values that can be passed to the param parameter for
\r
502 // functions: Timer_A_initCaptureMode(), Timer_A_initCompareMode(), and
\r
503 // Timer_A_outputPWM().
\r
505 //*****************************************************************************
\r
506 #define TIMER_A_OUTPUTMODE_OUTBITVALUE OUTMOD_0
\r
507 #define TIMER_A_OUTPUTMODE_SET OUTMOD_1
\r
508 #define TIMER_A_OUTPUTMODE_TOGGLE_RESET OUTMOD_2
\r
509 #define TIMER_A_OUTPUTMODE_SET_RESET OUTMOD_3
\r
510 #define TIMER_A_OUTPUTMODE_TOGGLE OUTMOD_4
\r
511 #define TIMER_A_OUTPUTMODE_RESET OUTMOD_5
\r
512 #define TIMER_A_OUTPUTMODE_TOGGLE_SET OUTMOD_6
\r
513 #define TIMER_A_OUTPUTMODE_RESET_SET OUTMOD_7
\r
515 //*****************************************************************************
\r
517 // The following are values that can be passed to the compareRegister parameter
\r
518 // for functions: Timer_A_setCompareValue(); the captureCompareRegister
\r
519 // parameter for functions: Timer_A_enableCaptureCompareInterrupt(),
\r
520 // Timer_A_disableCaptureCompareInterrupt(),
\r
521 // Timer_A_getCaptureCompareInterruptStatus(),
\r
522 // Timer_A_getSynchronizedCaptureCompareInput(),
\r
523 // Timer_A_getOutputForOutputModeOutBitValue(),
\r
524 // Timer_A_getCaptureCompareCount(),
\r
525 // Timer_A_setOutputForOutputModeOutBitValue(), and
\r
526 // Timer_A_clearCaptureCompareInterrupt(); the param parameter for functions:
\r
527 // Timer_A_initCaptureMode(), Timer_A_initCompareMode(), and
\r
528 // Timer_A_outputPWM().
\r
530 //*****************************************************************************
\r
531 #define TIMER_A_CAPTURECOMPARE_REGISTER_0 0x02
\r
532 #define TIMER_A_CAPTURECOMPARE_REGISTER_1 0x04
\r
533 #define TIMER_A_CAPTURECOMPARE_REGISTER_2 0x06
\r
534 #define TIMER_A_CAPTURECOMPARE_REGISTER_3 0x08
\r
535 #define TIMER_A_CAPTURECOMPARE_REGISTER_4 0x0A
\r
536 #define TIMER_A_CAPTURECOMPARE_REGISTER_5 0x0C
\r
537 #define TIMER_A_CAPTURECOMPARE_REGISTER_6 0x0E
\r
539 //*****************************************************************************
\r
541 // The following are values that can be passed to the param parameter for
\r
542 // functions: Timer_A_initCaptureMode().
\r
544 //*****************************************************************************
\r
545 #define TIMER_A_CAPTUREMODE_NO_CAPTURE CM_0
\r
546 #define TIMER_A_CAPTUREMODE_RISING_EDGE CM_1
\r
547 #define TIMER_A_CAPTUREMODE_FALLING_EDGE CM_2
\r
548 #define TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE CM_3
\r
550 //*****************************************************************************
\r
552 // The following are values that can be passed to the param parameter for
\r
553 // functions: Timer_A_initCaptureMode().
\r
555 //*****************************************************************************
\r
556 #define TIMER_A_CAPTURE_ASYNCHRONOUS 0x00
\r
557 #define TIMER_A_CAPTURE_SYNCHRONOUS SCS
\r
559 //*****************************************************************************
\r
561 // The following are values that can be passed to the mask parameter for
\r
562 // functions: Timer_A_getCaptureCompareInterruptStatus() as well as returned by
\r
563 // the Timer_A_getCaptureCompareInterruptStatus() function.
\r
565 //*****************************************************************************
\r
566 #define TIMER_A_CAPTURE_OVERFLOW COV
\r
567 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG CCIFG
\r
569 //*****************************************************************************
\r
571 // The following are values that can be passed to the synchronized parameter
\r
572 // for functions: Timer_A_getSynchronizedCaptureCompareInput().
\r
574 //*****************************************************************************
\r
575 #define TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI
\r
576 #define TIMER_A_READ_CAPTURE_COMPARE_INPUT CCI
\r
578 //*****************************************************************************
\r
580 // The following are values that can be passed toThe following are values that
\r
581 // can be returned by the Timer_A_getSynchronizedCaptureCompareInput()
\r
584 //*****************************************************************************
\r
585 #define TIMER_A_CAPTURECOMPARE_INPUT_HIGH 0x01
\r
586 #define TIMER_A_CAPTURECOMPARE_INPUT_LOW 0x00
\r
588 //*****************************************************************************
\r
590 // The following are values that can be passed to the outputModeOutBitValue
\r
591 // parameter for functions: Timer_A_setOutputForOutputModeOutBitValue() as well
\r
592 // as returned by the Timer_A_getOutputForOutputModeOutBitValue() function.
\r
594 //*****************************************************************************
\r
595 #define TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH OUT
\r
596 #define TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW 0x00
\r
598 //*****************************************************************************
\r
600 // The following are values that can be passed toThe following are values that
\r
601 // can be returned by the Timer_A_getInterruptStatus() function.
\r
603 //*****************************************************************************
\r
604 #define TIMER_A_INTERRUPT_NOT_PENDING 0x00
\r
605 #define TIMER_A_INTERRUPT_PENDING 0x01
\r
607 //*****************************************************************************
\r
609 // Prototypes for the APIs.
\r
611 //*****************************************************************************
\r
613 //*****************************************************************************
\r
615 //! \brief Starts Timer_A counter
\r
617 //! This function assumes that the timer has been previously configured using
\r
618 //! Timer_A_configureContinuousMode, Timer_A_configureUpMode or
\r
619 //! Timer_A_configureUpDownMode.
\r
621 //! \param baseAddress is the base address of the TIMER_A module.
\r
622 //! \param timerMode mode to put the timer in
\r
623 //! Valid values are:
\r
624 //! - \b TIMER_A_STOP_MODE
\r
625 //! - \b TIMER_A_UP_MODE
\r
626 //! - \b TIMER_A_CONTINUOUS_MODE [Default]
\r
627 //! - \b TIMER_A_UPDOWN_MODE
\r
629 //! Modified bits of \b TAxCTL register.
\r
633 //*****************************************************************************
\r
634 extern void Timer_A_startCounter(uint16_t baseAddress,
\r
635 uint16_t timerMode);
\r
637 //*****************************************************************************
\r
639 //! \brief Configures Timer_A in continuous mode.
\r
641 //! \param baseAddress is the base address of the TIMER_A module.
\r
642 //! \param param is the pointer to struct for continuous mode initialization.
\r
644 //! Modified bits of \b TAxCTL register.
\r
648 //*****************************************************************************
\r
649 extern void Timer_A_initContinuousMode(uint16_t baseAddress,
\r
650 Timer_A_initContinuousModeParam *param);
\r
652 //*****************************************************************************
\r
654 //! \brief Configures Timer_A in up mode.
\r
656 //! \param baseAddress is the base address of the TIMER_A module.
\r
657 //! \param param is the pointer to struct for up mode initialization.
\r
659 //! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register and bits
\r
660 //! of \b TAxCCR0 register.
\r
664 //*****************************************************************************
\r
665 extern void Timer_A_initUpMode(uint16_t baseAddress,
\r
666 Timer_A_initUpModeParam *param);
\r
668 //*****************************************************************************
\r
670 //! \brief Configures Timer_A in up down mode.
\r
672 //! \param baseAddress is the base address of the TIMER_A module.
\r
673 //! \param param is the pointer to struct for up-down mode initialization.
\r
675 //! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register and bits
\r
676 //! of \b TAxCCR0 register.
\r
680 //*****************************************************************************
\r
681 extern void Timer_A_initUpDownMode(uint16_t baseAddress,
\r
682 Timer_A_initUpDownModeParam *param);
\r
684 //*****************************************************************************
\r
686 //! \brief Initializes Capture Mode
\r
688 //! \param baseAddress is the base address of the TIMER_A module.
\r
689 //! \param param is the pointer to struct for capture mode initialization.
\r
691 //! Modified bits of \b TAxCCTLn register.
\r
695 //*****************************************************************************
\r
696 extern void Timer_A_initCaptureMode(uint16_t baseAddress,
\r
697 Timer_A_initCaptureModeParam *param);
\r
699 //*****************************************************************************
\r
701 //! \brief Initializes Compare Mode
\r
703 //! \param baseAddress is the base address of the TIMER_A module.
\r
704 //! \param param is the pointer to struct for compare mode initialization.
\r
706 //! Modified bits of \b TAxCCRn register and bits of \b TAxCCTLn register.
\r
710 //*****************************************************************************
\r
711 extern void Timer_A_initCompareMode(uint16_t baseAddress,
\r
712 Timer_A_initCompareModeParam *param);
\r
714 //*****************************************************************************
\r
716 //! \brief Enable timer interrupt
\r
718 //! Does not clear interrupt flags
\r
720 //! \param baseAddress is the base address of the TIMER_A module.
\r
722 //! Modified bits of \b TAxCTL register.
\r
726 //*****************************************************************************
\r
727 extern void Timer_A_enableInterrupt(uint16_t baseAddress);
\r
729 //*****************************************************************************
\r
731 //! \brief Disable timer interrupt
\r
733 //! \param baseAddress is the base address of the TIMER_A module.
\r
735 //! Modified bits of \b TAxCTL register.
\r
739 //*****************************************************************************
\r
740 extern void Timer_A_disableInterrupt(uint16_t baseAddress);
\r
742 //*****************************************************************************
\r
744 //! \brief Get timer interrupt status
\r
746 //! \param baseAddress is the base address of the TIMER_A module.
\r
748 //! \return One of the following:
\r
749 //! - \b Timer_A_INTERRUPT_NOT_PENDING
\r
750 //! - \b Timer_A_INTERRUPT_PENDING
\r
751 //! \n indicating the Timer_A interrupt status
\r
753 //*****************************************************************************
\r
754 extern uint32_t Timer_A_getInterruptStatus(uint16_t baseAddress);
\r
756 //*****************************************************************************
\r
758 //! \brief Enable capture compare interrupt
\r
760 //! Does not clear interrupt flags
\r
762 //! \param baseAddress is the base address of the TIMER_A module.
\r
763 //! \param captureCompareRegister is the selected capture compare register
\r
764 //! Valid values are:
\r
765 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
766 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
767 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
768 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
769 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
770 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
771 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
773 //! Modified bits of \b TAxCCTLn register.
\r
777 //*****************************************************************************
\r
778 extern void Timer_A_enableCaptureCompareInterrupt(uint16_t baseAddress,
\r
779 uint16_t captureCompareRegister);
\r
781 //*****************************************************************************
\r
783 //! \brief Disable capture compare interrupt
\r
785 //! \param baseAddress is the base address of the TIMER_A module.
\r
786 //! \param captureCompareRegister is the selected capture compare register
\r
787 //! Valid values are:
\r
788 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
789 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
790 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
791 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
792 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
793 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
794 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
796 //! Modified bits of \b TAxCCTLn register.
\r
800 //*****************************************************************************
\r
801 extern void Timer_A_disableCaptureCompareInterrupt(uint16_t baseAddress,
\r
802 uint16_t captureCompareRegister);
\r
804 //*****************************************************************************
\r
806 //! \brief Return capture compare interrupt status
\r
808 //! \param baseAddress is the base address of the TIMER_A module.
\r
809 //! \param captureCompareRegister is the selected capture compare register
\r
810 //! Valid values are:
\r
811 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
812 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
813 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
814 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
815 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
816 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
817 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
818 //! \param mask is the mask for the interrupt status
\r
819 //! Mask value is the logical OR of any of the following:
\r
820 //! - \b TIMER_A_CAPTURE_OVERFLOW
\r
821 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
\r
823 //! \return Logical OR of any of the following:
\r
824 //! - \b Timer_A_CAPTURE_OVERFLOW
\r
825 //! - \b Timer_A_CAPTURECOMPARE_INTERRUPT_FLAG
\r
826 //! \n indicating the status of the masked interrupts
\r
828 //*****************************************************************************
\r
829 extern uint32_t Timer_A_getCaptureCompareInterruptStatus(uint16_t baseAddress,
\r
830 uint16_t captureCompareRegister,
\r
833 //*****************************************************************************
\r
835 //! \brief Reset/Clear the timer clock divider, count direction, count
\r
837 //! \param baseAddress is the base address of the TIMER_A module.
\r
839 //! Modified bits of \b TAxCTL register.
\r
843 //*****************************************************************************
\r
844 extern void Timer_A_clear(uint16_t baseAddress);
\r
846 //*****************************************************************************
\r
848 //! \brief Get synchronized capturecompare input
\r
850 //! \param baseAddress is the base address of the TIMER_A module.
\r
851 //! \param captureCompareRegister
\r
852 //! Valid values are:
\r
853 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
854 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
855 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
856 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
857 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
858 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
859 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
860 //! \param synchronized
\r
861 //! Valid values are:
\r
862 //! - \b TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
\r
863 //! - \b TIMER_A_READ_CAPTURE_COMPARE_INPUT
\r
865 //! \return One of the following:
\r
866 //! - \b Timer_A_CAPTURECOMPARE_INPUT_HIGH
\r
867 //! - \b Timer_A_CAPTURECOMPARE_INPUT_LOW
\r
869 //*****************************************************************************
\r
870 extern uint8_t Timer_A_getSynchronizedCaptureCompareInput(uint16_t baseAddress,
\r
871 uint16_t captureCompareRegister,
\r
872 uint16_t synchronized);
\r
874 //*****************************************************************************
\r
876 //! \brief Get output bit for output mode
\r
878 //! \param baseAddress is the base address of the TIMER_A module.
\r
879 //! \param captureCompareRegister
\r
880 //! Valid values are:
\r
881 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
882 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
883 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
884 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
885 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
886 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
887 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
889 //! \return One of the following:
\r
890 //! - \b Timer_A_OUTPUTMODE_OUTBITVALUE_HIGH
\r
891 //! - \b Timer_A_OUTPUTMODE_OUTBITVALUE_LOW
\r
893 //*****************************************************************************
\r
894 extern uint8_t Timer_A_getOutputForOutputModeOutBitValue(uint16_t baseAddress,
\r
895 uint16_t captureCompareRegister);
\r
897 //*****************************************************************************
\r
899 //! \brief Get current capturecompare count
\r
901 //! \param baseAddress is the base address of the TIMER_A module.
\r
902 //! \param captureCompareRegister
\r
903 //! Valid values are:
\r
904 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
905 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
906 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
907 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
908 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
909 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
910 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
912 //! \return Current count as an uint16_t
\r
914 //*****************************************************************************
\r
915 extern uint16_t Timer_A_getCaptureCompareCount(uint16_t baseAddress,
\r
916 uint16_t captureCompareRegister);
\r
918 //*****************************************************************************
\r
920 //! \brief Set output bit for output mode
\r
922 //! \param baseAddress is the base address of the TIMER_A module.
\r
923 //! \param captureCompareRegister
\r
924 //! Valid values are:
\r
925 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
926 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
927 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
928 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
929 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
930 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
931 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
932 //! \param outputModeOutBitValue is the value to be set for out bit
\r
933 //! Valid values are:
\r
934 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH
\r
935 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW
\r
937 //! Modified bits of \b TAxCCTLn register.
\r
941 //*****************************************************************************
\r
942 extern void Timer_A_setOutputForOutputModeOutBitValue(uint16_t baseAddress,
\r
943 uint16_t captureCompareRegister,
\r
944 uint8_t outputModeOutBitValue);
\r
946 //*****************************************************************************
\r
948 //! \brief Generate a PWM with timer running in up mode
\r
950 //! \param baseAddress is the base address of the TIMER_A module.
\r
951 //! \param param is the pointer to struct for PWM configuration.
\r
953 //! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register, bits of
\r
954 //! \b TAxCCR0 register and bits of \b TAxCCTLn register.
\r
958 //*****************************************************************************
\r
959 extern void Timer_A_outputPWM(uint16_t baseAddress,
\r
960 Timer_A_outputPWMParam *param);
\r
962 //*****************************************************************************
\r
964 //! \brief Stops the timer
\r
966 //! \param baseAddress is the base address of the TIMER_A module.
\r
968 //! Modified bits of \b TAxCTL register.
\r
972 //*****************************************************************************
\r
973 extern void Timer_A_stop(uint16_t baseAddress);
\r
975 //*****************************************************************************
\r
977 //! \brief Sets the value of the capture-compare register
\r
979 //! \param baseAddress is the base address of the TIMER_A module.
\r
980 //! \param compareRegister selects the Capture register being used. Refer to
\r
981 //! datasheet to ensure the device has the capture compare register
\r
983 //! Valid values are:
\r
984 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
985 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
986 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
987 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
988 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
989 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
990 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
991 //! \param compareValue is the count to be compared with in compare mode
\r
993 //! Modified bits of \b TAxCCRn register.
\r
997 //*****************************************************************************
\r
998 extern void Timer_A_setCompareValue(uint16_t baseAddress,
\r
999 uint16_t compareRegister,
\r
1000 uint16_t compareValue);
\r
1002 //*****************************************************************************
\r
1004 //! \brief Clears the Timer TAIFG interrupt flag
\r
1006 //! \param baseAddress is the base address of the TIMER_A module.
\r
1008 //! Modified bits are \b TAIFG of \b TAxCTL register.
\r
1012 //*****************************************************************************
\r
1013 extern void Timer_A_clearTimerInterrupt(uint16_t baseAddress);
\r
1015 //*****************************************************************************
\r
1017 //! \brief Clears the capture-compare interrupt flag
\r
1019 //! \param baseAddress is the base address of the TIMER_A module.
\r
1020 //! \param captureCompareRegister selects the Capture-compare register being
\r
1022 //! Valid values are:
\r
1023 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
\r
1024 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
\r
1025 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
\r
1026 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
\r
1027 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
\r
1028 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
\r
1029 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
\r
1031 //! Modified bits are \b CCIFG of \b TAxCCTLn register.
\r
1035 //*****************************************************************************
\r
1036 extern void Timer_A_clearCaptureCompareInterrupt(uint16_t baseAddress,
\r
1037 uint16_t captureCompareRegister);
\r
1039 //*****************************************************************************
\r
1041 //! \brief Reads the current timer count value
\r
1043 //! Reads the current count value of the timer. There is a majority vote system
\r
1044 //! in place to confirm an accurate value is returned. The TIMER_A_THRESHOLD
\r
1045 //! #define in the corresponding header file can be modified so that the votes
\r
1046 //! must be closer together for a consensus to occur.
\r
1048 //! \param baseAddress is the base address of the TIMER_A module.
\r
1050 //! \return Majority vote of timer count value
\r
1052 //*****************************************************************************
\r
1053 extern uint16_t Timer_A_getCounterValue(uint16_t baseAddress);
\r
1055 //*****************************************************************************
\r
1057 // Mark the end of the C bindings section for C++ compilers.
\r
1059 //*****************************************************************************
\r
1060 #ifdef __cplusplus
\r
1065 #endif // __MSP430WARE_TIMER_A_H__
\r