TI-RTOS Drivers  tidrivers_cc32xx_2_16_01_13
Data Structures | Macros | Typedefs | Variables
PWMTimerCC3200.h File Reference

Detailed Description

PWM driver implementation using CC3200 General Purpose Timer 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.

Operation

This driver configures a CC3200 General Purpose Timer (GPT) in PWM mode. 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 initial 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

Below is an example of how to use the PWM_control() to change a period:

int rc = 0;
int newPeriod = 6000; // Period in microseconds
rc = PWM_control(pwmHandle, PWMTimerCC3200_CHANGE_PERIOD, &newPeriod);
if (rc < 0) {
// handle error condition
}

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>
Include dependency graph for PWMTimerCC3200.h:

Go to the source code of this file.

Data Structures

struct  PWMTimerCC3200_HWAttrs
 PWMTimerCC3200 Hardware attributes. More...
 
struct  PWMTimerCC3200_Object
 PWMTimerCC3200 Object. More...
 

Macros

#define PWMTimerCC3200_CMD_CHANGE_PERIOD   PWM_CMD_RESERVED + 0
 Control command to change the PWM period. More...
 
#define PWMTimerCC3200_CHANGE_PERIOD   PWMTimerCC3200_CMD_CHANGE_PERIOD
 

Typedefs

typedef struct PWMTimerCC3200_HWAttrs PWMTimerCC3200_HWAttrs
 PWMTimerCC3200 Hardware attributes. More...
 
typedef struct PWMTimerCC3200_Object PWMTimerCC3200_Object
 PWMTimerCC3200 Object. More...
 

Variables

const PWM_FxnTable PWMTimerCC3200_fxnTable
 

Macro Definition Documentation

#define PWMTimerCC3200_CHANGE_PERIOD   PWMTimerCC3200_CMD_CHANGE_PERIOD

Typedef Documentation

PWMTimerCC3200 Hardware attributes.

These fields are used by CC3200 driverlib APIs and therefore must be populated by driverlib macro definitions. For CC3200 driverlib these definitions are found in:

  • inc/hw_memmap.h
  • driverlib/timer.h

A sample structure is shown below:

1 const PWMTimerCC3200_HWAttrs PWMTimerCC3200HWAttrs[] = {
2  {
3  .baseAddr = TIMERA3_BASE,
4  .timer = TIMER_A
5  },
6  {
7  .baseAddr = TIMERA3_BASE,
8  .timer = TIMER_B
9  },
10 };

PWMTimerCC3200 Object.

The application must not access any member variables of this structure!

Variable Documentation

const PWM_FxnTable PWMTimerCC3200_fxnTable
Copyright 2016, Texas Instruments Incorporated