PWMMSP432E4.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019, 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  */
87 #ifndef ti_drivers_pwm_PWMMSP432E4__include
88 #define ti_drivers_pwm_PWMMSP432E4__include
89 
90 #include <stdbool.h>
91 #include <stdint.h>
92 
93 #include <ti/devices/msp432e4/inc/msp432.h>
94 
95 #include <ti/devices/msp432e4/driverlib/gpio.h>
96 #include <ti/devices/msp432e4/driverlib/pin_map.h>
97 
99 #include <ti/drivers/PWM.h>
100 
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
104 
115 /* Add PWMMSP432E4_STATUS_* macros here */
116 
131 /* Number of PWM peripherals available on a device. */
132 #define PWMMSP432E4_NUM_PWM_PERIPHERALS (1)
133 
134 /* Number of signal generator blocks per PWM peripheral. */
135 #define PWMMSP432E4_NUM_PWM_GENERATORS (4)
136 
137  /* Number of PWM signals a PWM peripheral can generate. */
138 #define PWMMSP432E4_NUM_PWM_OUTPUTS (8)
139 
143 #define PWMMSP432E4_PF0_M0PWM0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 0, GPIO_PF0_M0PWM0)
144 
148 #define PWMMSP432E4_PR0_M0PWM0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 0, GPIO_PR0_M0PWM0)
149 
153 #define PWMMSP432E4_PF1_M0PWM1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 1, GPIO_PF1_M0PWM1)
154 
158 #define PWMMSP432E4_PR1_M0PWM1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 1, GPIO_PR1_M0PWM1)
159 
163 #define PWMMSP432E4_PF2_M0PWM2 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 2, GPIO_PF2_M0PWM2)
164 
168 #define PWMMSP432E4_PR2_M0PWM2 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 2, GPIO_PR2_M0PWM2)
169 
173 #define PWMMSP432E4_PF3_M0PWM3 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 3, GPIO_PF3_M0PWM3)
174 
178 #define PWMMSP432E4_PR3_M0PWM3 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 3, GPIO_PR3_M0PWM3)
179 
183 #define PWMMSP432E4_PG0_M0PWM4 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 0, GPIO_PG0_M0PWM4)
184 
188 #define PWMMSP432E4_PR4_M0PWM4 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 4, GPIO_PR4_M0PWM4)
189 
193 #define PWMMSP432E4_PG1_M0PWM5 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 1, GPIO_PG1_M0PWM5)
194 
198 #define PWMMSP432E4_PR5_M0PWM5 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 5, GPIO_PR5_M0PWM5)
199 
203 #define PWMMSP432E4_PK4_M0PWM6 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTK, 4, GPIO_PK4_M0PWM6)
204 
208 #define PWMMSP432E4_PR6_M0PWM6 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 6, GPIO_PR6_M0PWM6)
209 
213 #define PWMMSP432E4_PK5_M0PWM7 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTK, 5, GPIO_PK5_M0PWM7)
214 
218 #define PWMMSP432E4_PR7_M0PWM7 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 7, GPIO_PR7_M0PWM7)
219 
220 /* PWM function table pointer */
222 
244 typedef struct {
246  uint32_t pwmBaseAddr;
248  uint32_t pwmOutput;
250  uint32_t pwmGenOpts;
252  uint32_t pinConfig;
254 
260 typedef struct {
261  uint32_t pwmDuties[PWMMSP432E4_NUM_PWM_OUTPUTS];
262  uint32_t genPeriods[PWMMSP432E4_NUM_PWM_GENERATORS];
263  uint8_t prescalar;
264  uint8_t activeOutputs;
266 
272 typedef struct {
277  uint8_t pwmOutputNum;
278  uint8_t pwmOutputBit;
279  bool isOpen;
280  bool isRunning;
282 
283 #ifdef __cplusplus
284 }
285 #endif
286 
287 #endif /* ti_drivers_pwm_PWMMSP432E4__include */
uint8_t pwmOutputBit
Definition: PWMMSP432E4.h:278
bool isRunning
Definition: PWMMSP432E4.h:280
PWM_Duty_Units
PWM duty cycle unit definitions. Refer to device specific implementation if using PWM_DUTY_COUNTS (ra...
Definition: PWM.h:306
uint8_t prescalar
Definition: PWMMSP432E4.h:263
uint32_t pinConfig
Definition: PWMMSP432E4.h:252
PWM_IdleLevel idleLevel
Definition: PWMMSP432E4.h:276
PWMMSP432E4_Status.
Definition: PWMMSP432E4.h:260
Pulse Width Modulation (PWM) driver.
PWM_Period_Units periodUnits
Definition: PWMMSP432E4.h:275
PWM_Period_Units
PWM period unit definitions. Refer to device specific implementation if using PWM_PERIOD_COUNTS (raw ...
Definition: PWM.h:295
#define PWMMSP432E4_NUM_PWM_GENERATORS
Definition: PWMMSP432E4.h:135
uint8_t activeOutputs
Definition: PWMMSP432E4.h:264
The definition of a PWM function table that contains the required set of functions to control a speci...
Definition: PWM.h:410
const PWM_FxnTable PWMMSP432E4_fxnTable
MSP432E4 GPIO driver.
uint32_t pwmGenOpts
Definition: PWMMSP432E4.h:250
PWMMSP432E4_Status * pwmStatusStruct
Definition: PWMMSP432E4.h:273
PWMMSP432E4 Object.
Definition: PWMMSP432E4.h:272
uint8_t pwmOutputNum
Definition: PWMMSP432E4.h:277
PWMMSP432E4 Hardware attributes.
Definition: PWMMSP432E4.h:244
uint32_t pwmOutput
Definition: PWMMSP432E4.h:248
uint32_t pwmBaseAddr
Definition: PWMMSP432E4.h:246
PWM_IdleLevel
Idle output level when PWM is not running (stopped / not started).
Definition: PWM.h:320
bool isOpen
Definition: PWMMSP432E4.h:279
PWM_Duty_Units dutyUnits
Definition: PWMMSP432E4.h:274
#define PWMMSP432E4_NUM_PWM_OUTPUTS
Definition: PWMMSP432E4.h:138
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale