![]() |
![]() |
TI-RTOS Drivers
tidrivers_full_2_20_01_10
|
PWM driver implementation for Tiva PWM peripherals.
============================================================================
The PWM header file should be included in an application as follows:
Refer to PWM.h for a complete description of APIs & example of use.
This driver implementation uses the Pulse Width Modulator (PWM) peripherals present on Tiva devices to generate PWM signals. Each PWM peripheral instance contains 4 PWM signal generators, each controlling 2 PWM outputs (8 PWM outputs total). This driver manages each PWM output individually (each output has it's own PWM handle/instance). However since a single clock prescalar is available for a peripheral and a generator is responsible for producing 2 outputs, there are some limitations in place to ensure proper operation:
Since the period and duty registers are 16 bits wide the prescalar is used to divide the input clock and allow for larger periods. The maximum period supported is calculated as:
After opening, the PWM_setPeriodl() API can be used to change a PWM generator period. However, the clock prescalar is shared by all generators so the new period must be a value that can generated with the same prescaler. Also keep in mind that changing a period affects both generator outputs, so the period must be larger than both duties. The equation below can be used to determine the prescalar for a given period (the prescalar will be the following power of 2 (2^x)):
Go to the source code of this file.
Data Structures | |
struct | PWMTiva_HWAttrsV1 |
PWMTiva Hardware attributes. More... | |
struct | PWMTiva_Status |
PWMTiva_Status. More... | |
struct | PWMTiva_Object |
PWMTiva Object. More... | |
Macros | |
#define | PWMTiva_NUM_PWM_PERIPHERALS (2) |
#define | PWMTiva_NUM_PWM_GENERATORS (4) |
#define | PWMTiva_NUM_PWM_OUTPUTS (8) |
Typedefs | |
typedef struct PWMTiva_HWAttrsV1 | PWMTiva_HWAttrsV1 |
PWMTiva Hardware attributes. More... | |
typedef struct PWMTiva_Status | PWMTiva_Status |
PWMTiva_Status. More... | |
typedef struct PWMTiva_Object | PWMTiva_Object |
PWMTiva Object. More... | |
Variables | |
const PWM_FxnTable | PWMTiva_fxnTable |
#define PWMTiva_NUM_PWM_PERIPHERALS (2) |
#define PWMTiva_NUM_PWM_GENERATORS (4) |
#define PWMTiva_NUM_PWM_OUTPUTS (8) |
typedef struct PWMTiva_HWAttrsV1 PWMTiva_HWAttrsV1 |
PWMTiva Hardware attributes.
These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For TivaWare these definitions are found in:
A sample structure is shown below:
typedef struct PWMTiva_Status PWMTiva_Status |
The application must not access any member variables of this structure!
typedef struct PWMTiva_Object PWMTiva_Object |
PWMTiva Object.
The application must not access any member variables of this structure!
const PWM_FxnTable PWMTiva_fxnTable |