PWMTimerMSP432.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file PWMTimerMSP432.h
34  *
35  * @brief PWM driver implementation using MSP432 Timer_A peripherals.
36  *
37  * The PWM header file should be included in an application as follows:
38  * @code
39  * #include <ti/drivers/PWM.h>
40  * #include <ti/drivers/pwm/PWMTimerMSP432.h>
41  * @endcode
42  *
43  * * Refer to @ref PWM.h for a complete description of APIs & example of use.
44  *
45  * ## Overview #
46  * This driver configures a MSP432 Timer_A peripheral for PWM. If the
47  * timer is already in use (by the kernel for instance), PWM instances will
48  * not be opened.
49  *
50  * When used for PWM generation, each Timer_A can produce up to 6 PWM outputs
51  * and this driver manages each output as an independent PWM instance. However
52  * since a single period, prescalar, and clock source are used for all PWM
53  * outputs, there are limitations in place to ensure proper operation:
54  * * The PWM period and prescalar are calculated and set based on the first
55  * instance opened. Opening a second instance will fail if the period
56  * is not the same as what was set by the first instance. The PWM period
57  * unit and clock source are set based on the first
58  * instance opened. Opening a second instance will fail if either
59  * are not the same.
60  * * PWM_setPeriod() will fail if the calculated period is less than
61  * any calculated duty currently open on the Timer_A peripheral.
62  * * PWM_setPeriod() will fail if the calculated prescalar is not
63  * equal to the prescalar currently set on the Timer_A peripheral.
64  *
65  * The timer is automatically configured in count-up mode using the clock
66  * source specified in the hwAttrs structure. In PWM mode, the timer
67  * capture/compare register 0 is used as the period register and cannot be
68  * used to generate a PWM output.
69  *
70  * The period and duty registers are 16 bits wide, thus a prescalar is used to
71  * divide the input clock and allow for larger periods. The maximum period
72  * supported is calculated as:
73  * - MAX_PERIOD = (MAX_PRESCALAR * MAX_MATCH_VALUE) / CYCLES_PER_US
74  * - Ex:
75  * - 12 MHz clock: (64 * 65535) / 12 = 349520 microseconds
76  * - 6 MHz clock: (64 * 65535) / 6 = 699040 microseconds
77  * - 3 MHz clock: (64 * 65535) / 3 = 1398080 microseconds
78  *
79  * After opening, the PWM_setPeriod() API can be used to change the PWM period.
80  * Keep in mind the period is shared by all other PWMs on the timer, so all
81  * other PWM outputs on the timer will change.
82  *
83  * ### MPS432 PWM Driver Configuration #
84  *
85  * In order to use the PWM APIs, the application is required
86  * to define 4 configuration items in the application Board.c file:
87  *
88  * 1. An array of PWMTimerMSP432_Object elements, which will be used by
89  * by the driver to maintain instance state.
90  * Below is an example PWMTimerMSP432_Object array appropriate for the MSP432
91  * LaunchPad board:
92  * @code
93  * #include <ti/drivers/PWM.h>
94  * #include <ti/drivers/pwm/PWMTimerMSP432.h>
95  *
96  * PWMTimerMSP432_Object pwmTimerMSP432Objects[2];
97  * @endcode
98  *
99  * 2. An array of PWMTimerMSP432_HWAttrsV2 elements that defines which
100  * pin will be used by the corresponding PWM instance
101  * (see @ref pwmPinIdentifiersMSP432).
102  * Below is an example PWMTimerMSP432_HWAttrsV2 array appropriate for the
103  * MSP432 LaunchPad board:
104  * @code
105  * const PWMTimerMSP432_HWAttrsV2 pwmTimerMSP432HWAttrs[2] = {
106  * {
107  * .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
108  * .pwmPin = PWMTimerMSP432_P2_1_TA1CCR1A
109  * },
110  * {
111  * .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
112  * .pwmPin = PWMTimerMSP432_P2_2_TA1CCR2A
113  * }
114  * };
115  * @endcode
116  *
117  * 3. An array of @ref PWM_Config elements, one for each PWM instance. Each
118  * element of this array identifies the device-specific API function table,
119  * the device specific PWM object instance, and the device specific Hardware
120  * Attributes to be used for each PWM channel.
121  * Below is an example @ref PWM_Config array appropriate for the MSP432
122  * LaunchPad board:
123  * @code
124  * const PWM_Config PWM_config[2] = {
125  * {
126  * .fxnTablePtr = &PWMTimerMSP432_fxnTable,
127  * .object = &pwmTimerMSP432Objects[0],
128  * .hwAttrs = &pwmTimerMSP432HWAttrs[0]
129  * },
130  * {
131  * .fxnTablePtr = &PWMTimerMSP432_fxnTable,
132  * .object = &pwmTimerMSP432Objects[1],
133  * .hwAttrs = &pwmTimerMSP432HWAttrs[1]
134  * }
135  * };
136  * @endcode
137  *
138  * 4. A global variable, PWM_count, that informs the driver how many PWM
139  * instances are defined:
140  * @code
141  * const uint_least8_t PWM_count = 2;
142  * @endcode
143  *
144  * # Resource Allocation #
145  * Allocation of each timer peripheral is managed through a set of resource
146  * allocation APIs. For example, the TimerMSP432_allocateTimerResource API
147  * will allocate a timer for exclusive use. Any attempt to allocate this
148  * resource in the future will result in a false value being returned from the
149  * allocation API. To free a timer resource, the TimerMSP432_freeTimerResource
150  * is used. The application is not responsible for calling these allocation
151  * APIs directly.
152  *
153  * ### Power Management #
154  * The TI-RTOS power management framework will try to put the device into the
155  * most power efficient mode whenever possible. Please see the technical
156  * reference manual for further details on each power mode.
157  *
158  * This driver supports dynamic power performance levels. The driver will
159  * determine which power performance levels are compatible with the desired
160  * period and period units. The driver prevents transitions to performance
161  * levels in which the period cannot be generated. When PWM_setPeriod() is
162  * called, the compatible performance levels are re-calculated and set.
163  *
164  * After a performance level change, the period is recalculated such that the
165  * generated period will remain the same. The duty cycle is not recalculated.
166  * The application is responsible for calling PWM_setDuty() after a performance
167  * level change. The exact period may vary after a performance level transition.
168  * This is due to a change in clock frequency and hence period per clock cycle.
169  *
170  * @code
171  * PWM_stop(pwmHandle);
172  * // Change performance level code
173  * PWM_setDuty(pwmHandle, duty);
174  * PWM_start(pwmHandle);
175  * @endcode
176  *
177  * The following statements are valid:
178  * - After PWM_open(): Clocks are enabled to the timer resource and the
179  * configured pwmPin. Dynamic performance level changes are allowed.
180  * - After PWM_start(): DEEPSLEEP mode is disabled. The device can only go
181  * to Idle power mode since the high-frequency clock is needed for PWM
182  * operation. Performance level changes are not allowed.
183  * - After PWM_stop(): Conditions are equal as for after PWM_open().
184  * - After PWM_close(): The underlying GPTimer is turned off, and the clock
185  * to the timer and pin are disabled.
186  *
187  ******************************************************************************
188  */
189 
190 #ifndef ti_driver_pwm_PWMTimerMSP432__include
191 #define ti_driver_pwm_PWMTimerMSP432__include
192 
193 #ifdef __cplusplus
194 extern "C" {
195 #endif
196 
197 #include <stdbool.h>
198 
199 #include <ti/devices/DeviceFamily.h>
200 
201 #include <ti/drivers/Power.h>
202 #include <ti/drivers/PWM.h>
203 
204 #include <ti/devices/msp432p4xx/driverlib/pmap.h>
205 #include <ti/devices/msp432p4xx/driverlib/timer_a.h>
206 
208 /*
209  * PWMTimer port/pin defines for pin configuration. Ports P2, P3, and P7 are
210  * configurable through the port mapping controller.
211  * Value specifies the pin function and ranges from 0 to 31
212  * pin range: 0 - 7, port range: 0 - 15.
213  * The timer id (0, 1, 2, 3, or 4) is stored in bits 16 - 19
214  * The capture compare register is stored in bits 20 - 23.
215  *
216  *
217  * 23 - 20 19 - 16 15 - 10 9 8 7 - 4 3 - 0
218  * ---------------------------------------------------
219  * | CCR | Timer id | VALUE | X | X | PORT | PIN |
220  * ---------------------------------------------------
221  *
222  * value = pinConfig >> 10
223  * port = (pinConfig >> 4) & 0xf
224  * pin = pinConfig & 0x7
225  * ccr = (pinConfig >> 16) & 0xf
226  *
227  * pmap = port * 0x8; // 2 -> 0x10, 3 -> 0x18, 7 -> 0x38
228  * portMapReconfigure = PMAP_ENABLE_RECONFIGURATION;
229  *
230  * Code from pmap.c:
231  * //Get write-access to port mapping registers:
232  * PMAP->KEYID = PMAP_KEYID_VAL;
233  *
234  * //Enable/Disable reconfiguration during runtime
235  * PMAP->CTL = (PMAP->CTL & ~PMAP_CTL_PRECFG) | portMapReconfigure;
236  * HWREG8(PMAP_BASE + pin + pmap) = value;
237  *
238  * For non-configurable ports (bits 20 - 12 will be 0).
239  * Bits 8 and 9 hold the module function (PRIMARY, SECONDARY, or
240  * TERTIALRY).
241  *
242  * 23 - 20 19 - 16 15 - 10 9 8 7 - 4 3 - 0
243  * -----------------------------------------------------------------
244  * | CCR | Timer id | 0 | PnSEL1.x | PnSEL0.x | PORT | PIN |
245  * -----------------------------------------------------------------
246  *
247  * moduleFunction = (pinConfig >> 8) & 0x3
248  * port = (pinConfig >> 4) & 0xf
249  * pin = 1 << (pinConfig & 0xf)
250  *
251  * MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(port,
252  * pin, moduleFunction);
253  *
254  */
255 
256 #define PWMTimerMSP432_CCR1 (TIMER_A_CAPTURECOMPARE_REGISTER_1 << 20)
257 #define PWMTimerMSP432_CCR2 (TIMER_A_CAPTURECOMPARE_REGISTER_2 << 20)
258 #define PWMTimerMSP432_CCR3 (TIMER_A_CAPTURECOMPARE_REGISTER_3 << 20)
259 #define PWMTimerMSP432_CCR4 (TIMER_A_CAPTURECOMPARE_REGISTER_4 << 20)
260 
261 #define PWMTimerMSP432_TA0 (0 << 16)
262 #define PWMTimerMSP432_TA1 (1 << 16)
263 #define PWMTimerMSP432_TA2 (2 << 16)
264 #define PWMTimerMSP432_TA3 (3 << 16)
265 
266 #define PWMTimerMSP432_TA0CCR1 (PWMTimerMSP432_TA0 | PWMTimerMSP432_CCR1 | (PMAP_TA0CCR1A << 10))
267 #define PWMTimerMSP432_TA0CCR2 (PWMTimerMSP432_TA0 | PWMTimerMSP432_CCR2 | (PMAP_TA0CCR2A << 10))
268 #define PWMTimerMSP432_TA0CCR3 (PWMTimerMSP432_TA0 | PWMTimerMSP432_CCR3 | (PMAP_TA0CCR3A << 10))
269 #define PWMTimerMSP432_TA0CCR4 (PWMTimerMSP432_TA0 | PWMTimerMSP432_CCR4 | (PMAP_TA0CCR4A << 10))
270 
271 #define PWMTimerMSP432_TA1CCR1 (PWMTimerMSP432_TA1 | PWMTimerMSP432_CCR1 | (PMAP_TA1CCR1A << 10))
272 #define PWMTimerMSP432_TA1CCR2 (PWMTimerMSP432_TA1 | PWMTimerMSP432_CCR2 | (PMAP_TA1CCR2A << 10))
273 #define PWMTimerMSP432_TA1CCR3 (PWMTimerMSP432_TA1 | PWMTimerMSP432_CCR3 | (PMAP_TA1CCR3A << 10))
274 #define PWMTimerMSP432_TA1CCR4 (PWMTimerMSP432_TA1 | PWMTimerMSP432_CCR4 | (PMAP_TA1CCR4A << 10))
275 
276 #define PWMTimerMSP432_TA2CCR1 (PWMTimerMSP432_TA2 | PWMTimerMSP432_CCR1)
277 #define PWMTimerMSP432_TA2CCR2 (PWMTimerMSP432_TA2 | PWMTimerMSP432_CCR2)
278 #define PWMTimerMSP432_TA2CCR3 (PWMTimerMSP432_TA2 | PWMTimerMSP432_CCR3)
279 #define PWMTimerMSP432_TA2CCR4 (PWMTimerMSP432_TA2 | PWMTimerMSP432_CCR4)
280 
281 #define PWMTimerMSP432_TA3CCR1 (PWMTimerMSP432_TA3 | PWMTimerMSP432_CCR1)
282 #define PWMTimerMSP432_TA3CCR2 (PWMTimerMSP432_TA3 | PWMTimerMSP432_CCR2)
283 #define PWMTimerMSP432_TA3CCR3 (PWMTimerMSP432_TA3 | PWMTimerMSP432_CCR3)
284 #define PWMTimerMSP432_TA3CCR4 (PWMTimerMSP432_TA3 | PWMTimerMSP432_CCR4)
285 
296 #define PWMTimerMSP432_P2_0_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x20)
297 #define PWMTimerMSP432_P2_0_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x20)
298 #define PWMTimerMSP432_P2_0_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x20)
299 #define PWMTimerMSP432_P2_0_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x20)
300 #define PWMTimerMSP432_P2_0_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x20)
301 #define PWMTimerMSP432_P2_0_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x20)
302 #define PWMTimerMSP432_P2_0_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x20)
303 #define PWMTimerMSP432_P2_0_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x20)
310 #define PWMTimerMSP432_P2_1_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x21)
311 #define PWMTimerMSP432_P2_1_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x21)
312 #define PWMTimerMSP432_P2_1_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x21)
313 #define PWMTimerMSP432_P2_1_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x21)
314 #define PWMTimerMSP432_P2_1_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x21)
315 #define PWMTimerMSP432_P2_1_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x21)
316 #define PWMTimerMSP432_P2_1_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x21)
317 #define PWMTimerMSP432_P2_1_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x21)
324 #define PWMTimerMSP432_P2_2_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x22)
325 #define PWMTimerMSP432_P2_2_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x22)
326 #define PWMTimerMSP432_P2_2_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x22)
327 #define PWMTimerMSP432_P2_2_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x22)
328 #define PWMTimerMSP432_P2_2_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x22)
329 #define PWMTimerMSP432_P2_2_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x22)
330 #define PWMTimerMSP432_P2_2_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x22)
331 #define PWMTimerMSP432_P2_2_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x22)
338 #define PWMTimerMSP432_P2_3_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x23)
339 #define PWMTimerMSP432_P2_3_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x23)
340 #define PWMTimerMSP432_P2_3_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x23)
341 #define PWMTimerMSP432_P2_3_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x23)
342 #define PWMTimerMSP432_P2_3_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x23)
343 #define PWMTimerMSP432_P2_3_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x23)
344 #define PWMTimerMSP432_P2_3_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x23)
345 #define PWMTimerMSP432_P2_3_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x23)
352 #define PWMTimerMSP432_P2_4_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x24)
353 #define PWMTimerMSP432_P2_4_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x24)
354 #define PWMTimerMSP432_P2_4_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x24)
355 #define PWMTimerMSP432_P2_4_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x24)
356 #define PWMTimerMSP432_P2_4_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x24)
357 #define PWMTimerMSP432_P2_4_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x24)
358 #define PWMTimerMSP432_P2_4_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x24)
359 #define PWMTimerMSP432_P2_4_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x24)
366 #define PWMTimerMSP432_P2_5_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x25)
367 #define PWMTimerMSP432_P2_5_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x25)
368 #define PWMTimerMSP432_P2_5_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x25)
369 #define PWMTimerMSP432_P2_5_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x25)
370 #define PWMTimerMSP432_P2_5_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x25)
371 #define PWMTimerMSP432_P2_5_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x25)
372 #define PWMTimerMSP432_P2_5_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x25)
373 #define PWMTimerMSP432_P2_5_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x25)
380 #define PWMTimerMSP432_P2_6_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x26)
381 #define PWMTimerMSP432_P2_6_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x26)
382 #define PWMTimerMSP432_P2_6_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x26)
383 #define PWMTimerMSP432_P2_6_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x26)
384 #define PWMTimerMSP432_P2_6_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x26)
385 #define PWMTimerMSP432_P2_6_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x26)
386 #define PWMTimerMSP432_P2_6_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x26)
387 #define PWMTimerMSP432_P2_6_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x26)
394 #define PWMTimerMSP432_P2_7_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x27)
395 #define PWMTimerMSP432_P2_7_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x27)
396 #define PWMTimerMSP432_P2_7_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x27)
397 #define PWMTimerMSP432_P2_7_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x27)
398 #define PWMTimerMSP432_P2_7_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x27)
399 #define PWMTimerMSP432_P2_7_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x27)
400 #define PWMTimerMSP432_P2_7_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x27)
401 #define PWMTimerMSP432_P2_7_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x27)
408 #define PWMTimerMSP432_P3_0_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x30)
409 #define PWMTimerMSP432_P3_0_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x30)
410 #define PWMTimerMSP432_P3_0_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x30)
411 #define PWMTimerMSP432_P3_0_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x30)
412 #define PWMTimerMSP432_P3_0_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x30)
413 #define PWMTimerMSP432_P3_0_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x30)
414 #define PWMTimerMSP432_P3_0_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x30)
415 #define PWMTimerMSP432_P3_0_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x30)
422 #define PWMTimerMSP432_P3_1_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x31)
423 #define PWMTimerMSP432_P3_1_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x31)
424 #define PWMTimerMSP432_P3_1_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x31)
425 #define PWMTimerMSP432_P3_1_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x31)
426 #define PWMTimerMSP432_P3_1_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x31)
427 #define PWMTimerMSP432_P3_1_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x31)
428 #define PWMTimerMSP432_P3_1_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x31)
429 #define PWMTimerMSP432_P3_1_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x31)
436 #define PWMTimerMSP432_P3_2_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x32)
437 #define PWMTimerMSP432_P3_2_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x32)
438 #define PWMTimerMSP432_P3_2_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x32)
439 #define PWMTimerMSP432_P3_2_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x32)
440 #define PWMTimerMSP432_P3_2_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x32)
441 #define PWMTimerMSP432_P3_2_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x32)
442 #define PWMTimerMSP432_P3_2_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x32)
443 #define PWMTimerMSP432_P3_2_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x32)
450 #define PWMTimerMSP432_P3_3_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x33)
451 #define PWMTimerMSP432_P3_3_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x33)
452 #define PWMTimerMSP432_P3_3_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x33)
453 #define PWMTimerMSP432_P3_3_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x33)
454 #define PWMTimerMSP432_P3_3_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x33)
455 #define PWMTimerMSP432_P3_3_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x33)
456 #define PWMTimerMSP432_P3_3_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x33)
457 #define PWMTimerMSP432_P3_3_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x33)
464 #define PWMTimerMSP432_P3_4_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x34)
465 #define PWMTimerMSP432_P3_4_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x34)
466 #define PWMTimerMSP432_P3_4_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x34)
467 #define PWMTimerMSP432_P3_4_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x34)
468 #define PWMTimerMSP432_P3_4_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x34)
469 #define PWMTimerMSP432_P3_4_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x34)
470 #define PWMTimerMSP432_P3_4_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x34)
471 #define PWMTimerMSP432_P3_4_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x34)
478 #define PWMTimerMSP432_P3_5_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x35)
479 #define PWMTimerMSP432_P3_5_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x35)
480 #define PWMTimerMSP432_P3_5_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x35)
481 #define PWMTimerMSP432_P3_5_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x35)
482 #define PWMTimerMSP432_P3_5_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x35)
483 #define PWMTimerMSP432_P3_5_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x35)
484 #define PWMTimerMSP432_P3_5_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x35)
485 #define PWMTimerMSP432_P3_5_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x35)
492 #define PWMTimerMSP432_P3_6_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x36)
493 #define PWMTimerMSP432_P3_6_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x36)
494 #define PWMTimerMSP432_P3_6_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x36)
495 #define PWMTimerMSP432_P3_6_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x36)
496 #define PWMTimerMSP432_P3_6_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x36)
497 #define PWMTimerMSP432_P3_6_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x36)
498 #define PWMTimerMSP432_P3_6_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x36)
499 #define PWMTimerMSP432_P3_6_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x36)
506 #define PWMTimerMSP432_P3_7_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x37)
507 #define PWMTimerMSP432_P3_7_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x37)
508 #define PWMTimerMSP432_P3_7_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x37)
509 #define PWMTimerMSP432_P3_7_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x37)
510 #define PWMTimerMSP432_P3_7_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x37)
511 #define PWMTimerMSP432_P3_7_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x37)
512 #define PWMTimerMSP432_P3_7_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x37)
513 #define PWMTimerMSP432_P3_7_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x37)
520 #define PWMTimerMSP432_P5_6_TA2CCR1A (PWMTimerMSP432_TA2CCR1 | 0x156)
521 #define PWMTimerMSP432_P5_7_TA2CCR2A (PWMTimerMSP432_TA2CCR2 | 0x157)
528 #define PWMTimerMSP432_P6_6_TA2CCR3A (PWMTimerMSP432_TA2CCR3 | 0x166)
529 #define PWMTimerMSP432_P6_7_TA2CCR4A (PWMTimerMSP432_TA2CCR4 | 0x167)
536 #define PWMTimerMSP432_P7_0_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x70)
537 #define PWMTimerMSP432_P7_0_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x70)
538 #define PWMTimerMSP432_P7_0_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x70)
539 #define PWMTimerMSP432_P7_0_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x70)
540 #define PWMTimerMSP432_P7_0_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x70)
541 #define PWMTimerMSP432_P7_0_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x70)
542 #define PWMTimerMSP432_P7_0_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x70)
543 #define PWMTimerMSP432_P7_0_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x70)
550 #define PWMTimerMSP432_P7_1_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x71)
551 #define PWMTimerMSP432_P7_1_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x71)
552 #define PWMTimerMSP432_P7_1_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x71)
553 #define PWMTimerMSP432_P7_1_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x71)
554 #define PWMTimerMSP432_P7_1_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x71)
555 #define PWMTimerMSP432_P7_1_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x71)
556 #define PWMTimerMSP432_P7_1_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x71)
557 #define PWMTimerMSP432_P7_1_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x71)
564 #define PWMTimerMSP432_P7_2_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x72)
565 #define PWMTimerMSP432_P7_2_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x72)
566 #define PWMTimerMSP432_P7_2_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x72)
567 #define PWMTimerMSP432_P7_2_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x72)
568 #define PWMTimerMSP432_P7_2_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x72)
569 #define PWMTimerMSP432_P7_2_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x72)
570 #define PWMTimerMSP432_P7_2_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x72)
571 #define PWMTimerMSP432_P7_2_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x72)
578 #define PWMTimerMSP432_P7_3_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x73)
579 #define PWMTimerMSP432_P7_3_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x73)
580 #define PWMTimerMSP432_P7_3_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x73)
581 #define PWMTimerMSP432_P7_3_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x73)
582 #define PWMTimerMSP432_P7_3_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x73)
583 #define PWMTimerMSP432_P7_3_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x73)
584 #define PWMTimerMSP432_P7_3_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x73)
585 #define PWMTimerMSP432_P7_3_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x73)
592 #define PWMTimerMSP432_P7_4_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x74)
593 #define PWMTimerMSP432_P7_4_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x74)
594 #define PWMTimerMSP432_P7_4_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x74)
595 #define PWMTimerMSP432_P7_4_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x74)
596 #define PWMTimerMSP432_P7_4_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x74)
597 #define PWMTimerMSP432_P7_4_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x74)
598 #define PWMTimerMSP432_P7_4_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x74)
599 #define PWMTimerMSP432_P7_4_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x74)
606 #define PWMTimerMSP432_P7_5_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x75)
607 #define PWMTimerMSP432_P7_5_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x75)
608 #define PWMTimerMSP432_P7_5_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x75)
609 #define PWMTimerMSP432_P7_5_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x75)
610 #define PWMTimerMSP432_P7_5_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x75)
611 #define PWMTimerMSP432_P7_5_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x75)
612 #define PWMTimerMSP432_P7_5_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x75)
613 #define PWMTimerMSP432_P7_5_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x75)
620 #define PWMTimerMSP432_P7_6_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x76)
621 #define PWMTimerMSP432_P7_6_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x76)
622 #define PWMTimerMSP432_P7_6_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x76)
623 #define PWMTimerMSP432_P7_6_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x76)
624 #define PWMTimerMSP432_P7_6_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x76)
625 #define PWMTimerMSP432_P7_6_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x76)
626 #define PWMTimerMSP432_P7_6_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x76)
627 #define PWMTimerMSP432_P7_6_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x76)
634 #define PWMTimerMSP432_P7_7_TA0CCR1A (PWMTimerMSP432_TA0CCR1 | 0x77)
635 #define PWMTimerMSP432_P7_7_TA0CCR2A (PWMTimerMSP432_TA0CCR2 | 0x77)
636 #define PWMTimerMSP432_P7_7_TA0CCR3A (PWMTimerMSP432_TA0CCR3 | 0x77)
637 #define PWMTimerMSP432_P7_7_TA0CCR4A (PWMTimerMSP432_TA0CCR4 | 0x77)
638 #define PWMTimerMSP432_P7_7_TA1CCR1A (PWMTimerMSP432_TA1CCR1 | 0x77)
639 #define PWMTimerMSP432_P7_7_TA1CCR2A (PWMTimerMSP432_TA1CCR2 | 0x77)
640 #define PWMTimerMSP432_P7_7_TA1CCR3A (PWMTimerMSP432_TA1CCR3 | 0x77)
641 #define PWMTimerMSP432_P7_7_TA1CCR4A (PWMTimerMSP432_TA1CCR4 | 0x77)
648 #define PWMTimerMSP432_P8_2_TA3CCR2A (PWMTimerMSP432_TA3CCR2 | 0x182)
655 #define PWMTimerMSP432_P9_2_TA3CCR3A (PWMTimerMSP432_TA3CCR3 | 0x192)
656 #define PWMTimerMSP432_P9_3_TA3CCR4A (PWMTimerMSP432_TA3CCR4 | 0x193)
662 #define PWMTimerMSP432_P10_5_TA3CCR1A (PWMTimerMSP432_TA3CCR1 | 0x1A5)
676 /* Add PWMTimerMSP432_STATUS_* macros here */
677 
690 /* Add PWMTimerMSP432_CMD_* macros here */
691 
695 /* Number of Timer_A peripherals available on a device. */
696 #define PWMTimerMSP432_NUM_TIMERS (4)
697 
698 /* Number of PWM outputs a Timer_A peripheral can generate. */
699 #define PWMTimerMSP432_NUM_PWM_OUTPUTS (6)
700 
702 /* PWM function table pointer */
704 
728 typedef struct PWMTimerMSP432_HWAttrsV2 {
729  uint16_t clockSource;
731  uint32_t pwmPin;
734 
740 typedef struct PWMTimerMSP432_Status {
744  uint32_t clockSource;
745  uint32_t duties[PWMTimerMSP432_NUM_PWM_OUTPUTS];
746  uint32_t periodCounts;
747  uint32_t period;
748  uint8_t prescalar;
750  uint8_t openMask;
752 
758 typedef struct PWMTimerMSP432_Object {
760  uint32_t baseAddress; /* PWMTimer base address */
761  PWM_Duty_Units dutyUnits; /* Current duty cycle unit */
762  PWM_IdleLevel idleLevel; /* PWM idle level when stopped */
763  uint8_t compareOutputNum; /* Timer's compare output */
764  /* number */
766 
767 #ifdef __cplusplus
768 }
769 #endif
770 
771 #endif /* ti_driver_pwm_PWMTimerMSP432__include */
uint32_t pwmPin
Definition: PWMTimerMSP432.h:731
struct PWMTimerMSP432_Object PWMTimerMSP432_Object
PWMTimerMSP432 Object.
PWM_Duty_Units dutyUnits
Definition: PWMTimerMSP432.h:761
uint32_t periodCounts
Definition: PWMTimerMSP432.h:746
PWMTimerMSP432 Hardware attributes.
Definition: PWMTimerMSP432.h:728
struct PWMTimerMSP432_HWAttrsV2 PWMTimerMSP432_HWAttrsV2
PWMTimerMSP432 Hardware attributes.
PWMTimerMSP432_Status.
Definition: PWMTimerMSP432.h:740
PWMTimerMSP432_Status * timerStatus
Definition: PWMTimerMSP432.h:759
PWM_Period_Units periodUnits
Definition: PWMTimerMSP432.h:742
Power Manager interface.
const PWM_FxnTable PWMTimerMSP432_fxnTable
Power notify object structure.
Definition: Power.h:121
uint16_t clockSource
Definition: PWMTimerMSP432.h:729
PWM driver interface.
uint32_t baseAddress
Definition: PWMTimerMSP432.h:760
The definition of a PWM function table that contains the required set of functions to control a speci...
Definition: PWM.h:442
PWMTimerMSP432 Object.
Definition: PWMTimerMSP432.h:758
Power_NotifyObj perfChangeNotify
Definition: PWMTimerMSP432.h:741
enum PWM_Period_Units_ PWM_Period_Units
PWM period unit definitions. Refer to device specific implementation if using PWM_PERIOD_COUNTS (raw ...
uint8_t openMask
Definition: PWMTimerMSP432.h:750
uint8_t prescalar
Definition: PWMTimerMSP432.h:748
PWM_IdleLevel idleLevel
Definition: PWMTimerMSP432.h:762
uint8_t activeOutputsMask
Definition: PWMTimerMSP432.h:749
enum PWM_IdleLevel_ PWM_IdleLevel
Idle output level when PWM is not running (stopped / not started).
uint8_t compareOutputNum
Definition: PWMTimerMSP432.h:763
struct PWMTimerMSP432_Status PWMTimerMSP432_Status
PWMTimerMSP432_Status.
uint32_t period
Definition: PWMTimerMSP432.h:747
uint32_t perfConstraintMask
Definition: PWMTimerMSP432.h:743
uint32_t clockSource
Definition: PWMTimerMSP432.h:744
enum PWM_Duty_Units_ PWM_Duty_Units
PWM duty cycle unit definitions. Refer to device specific implementation if using PWM_DUTY_COUNTS (ra...
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale