TI-RTOS Drivers
tidrivers_cc13xx_cc26xx_2_16_00_08
|
PWM driver implementation using Tiva General Purpose Timer peripherals.
============================================================================
The PWM header file should be included in an application as follows:
This driver configures a Tiva General Purpose Timer (GPT) in PWM mode. Creating a PWM instance will make the corresponding timer unavailable to the TI-RTOS kernel until the PWM instance is closed. Additionally, if the required timer is already used by the kernel, the PWM instance will not be opened.
When in PWM mode, each GPT is divided into 2 PWM outputs. This driver manages each output as independent PWM instances. The timer is automatically configured in count-down mode using the system clock as the source.
The period in the PWM_Params structure must be used to set the intial period. After opening, the PWM_control() API can be used to change a period. The period and duty registers are 16 bits wide; thus, prescalars are used to extend period and duty registers. The maximum period supported is calculated as: MAX_PERIOD = (((MAX_PRESCALAR + 1) * MAX_MATCH_VAL) / CYCLES_PER_US) - 1 80 MHz clock: (((255 + 1) * 65535) / 80) - 1 = 209711 microseconds 120 MHz clock: (((255 + 1) * 65535) / 120) - 1 = 139807 microseconds
Below is an example of how to use the PWM_control() to change a period:
Updates to a PWM instance will occur instantaneously (i.e. GPT peripherals do not have shadow registers). Finally, if the duty supplied is greater than the period, the output will remain in active state.
#include <ti/drivers/PWM.h>
Go to the source code of this file.
Data Structures | |
struct | PWMTimerCC26XX_PWMPinCfg |
PWMTimerCC26XX PWM Pin Configuration. More... | |
struct | PWMTimerCC26XX_HWAttrs |
PWMTimerCC26XX Hardware attributes. More... | |
struct | PWMTimerCC26XX_Object |
PWMTimerCC26XX Object. More... | |
Macros | |
#define | PWMTimerCC26XX_CMD_CHANGE_PERIOD PWM_CMD_RESERVED + 0 |
Control command to change the PWM period. More... | |
#define | PWMTimerCC26XX_CHANGE_PERIOD PWMTimerCC26XX_CMD_CHANGE_PERIOD |
Typedefs | |
typedef struct PWMTimerCC26XX_PWMPinCfg | PWMTimerCC26XX_PWMPinCfg |
PWMTimerCC26XX PWM Pin Configuration. More... | |
typedef struct PWMTimerCC26XX_HWAttrs | PWMTimerCC26XX_HWAttrs |
PWMTimerCC26XX Hardware attributes. More... | |
typedef struct PWMTimerCC26XX_Object | PWMTimerCC26XX_Object |
PWMTimerCC26XX Object. More... | |
Variables | |
const PWM_FxnTable | PWMTimerCC26XX_fxnTable |
#define PWMTimerCC26XX_CHANGE_PERIOD PWMTimerCC26XX_CMD_CHANGE_PERIOD |
typedef struct PWMTimerCC26XX_PWMPinCfg PWMTimerCC26XX_PWMPinCfg |
PWMTimerCC26XX PWM Pin Configuration.
Pin configuration of the pin that the PWM signal should be output from.
Use the 'custom' field of the the PWM params passed to the PWM_open() call to override the default pwmPinId found in the HWAttrs structure.
typedef struct PWMTimerCC26XX_HWAttrs PWMTimerCC26XX_HWAttrs |
PWMTimerCC26XX Hardware attributes.
These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For CCWare these definitions are found in:
A sample structure is shown below:
typedef struct PWMTimerCC26XX_Object PWMTimerCC26XX_Object |
PWMTimerCC26XX Object.
The application must not access any member variables of this structure!
const PWM_FxnTable PWMTimerCC26XX_fxnTable |