Data Structures | Macros | Typedefs | Enumerations | Functions
GPTimerCC26XX.h File Reference

Detailed Description

GPTimer driver implementation for CC26XX/CC13XX.


# Overview #

This TI RTOS driver can be used to configure GPTimer modules to the modes supported by the GPTimer. The board file or application must define the device specific configuration before using the driver.

Configuration

The GPTimer can be used in two different configurations. In 32-bit mode the timer will act as a full-width timer and is controlled using the Timer A unit. In split (16-bit) mode the timer is split into 2x 16-bit timers. In 16-bit mode a prescaler is available for each timer unit, effectively increasing the resolution in this mode to 24-bit. All supported modes by driver in split configuration uses prescaler as timer extension.

Modes

The GPTimer driver supports the following timer modes:

Power Management

The TI-RTOS power management framework will try to put the device into the most power efficient mode whenever possible. Please see the technical reference manual for further details on each power mode.

The GPTimerCC26XX driver will set constraints on disallowed power modes when needed, removing the need for the application to handle this. The following statements are valid:

Accuracy

The GPTimer clock is dependent on the MCU system clock. If very high-accuracy outputs are needed, the application should request using the external HF crystal:

#include <ti/sysbios/family/arm/cc26xx/Power.h>
#include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h>

Limitations

GPTimerCC26XX usage

Periodic timer

The example below will generate an interrupt using the GPTimer every 1 ms.

void timerCallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask) {
// interrupt callback code goes here. Minimize processing in interrupt.
}
void taskFxn(uintptr_t a0, uintptr_t a1) {
hTimer = GPTimerCC26XX_open(CC2650_GPTIMER0A, &params);
if(hTimer == NULL) {
Log_error0("Failed to open GPTimer");
Task_exit();
}
Types_FreqHz freq;
BIOS_getCpuFreq(&freq);
GPTimerCC26XX_Value loadVal = freq.lo / 1000 - 1; //47999
GPTimerCC26XX_setLoadValue(hTimer, loadVal);
while(1) {
Task_sleep(BIOS_WAIT_FOREVER);
}
}

PWM output

See the PWM2TimerCC26XX driver

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/devices/DeviceFamily.h>
#include <DeviceFamily_constructPath(inc/hw_gpt.h)>
#include <DeviceFamily_constructPath(driverlib/event.h)>
#include <DeviceFamily_constructPath(driverlib/ioc.h)>
#include <DeviceFamily_constructPath(driverlib/timer.h)>
Include dependency graph for GPTimerCC26XX.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GPTimerCC26XX_HWAttrs
 GPTimer26XX Hardware attributes. More...
 
struct  GPTimerCC26XX_Object
 GPTimer26XX Object. More...
 
struct  GPTimerCC26XX_Config
 GPTimer Global configuration. More...
 
struct  GPTimerCC26XX_Params
 GPTimerCC26XX Parameters. More...
 

Macros

#define GPT_MODE_ONESHOT_UP   GPT_MODE_ONESHOT
 
#define GPT_MODE_PERIODIC_UP   GPT_MODE_PERIODIC
 
#define GPT_MODE_EDGE_COUNT_UP   GPT_MODE_EDGE_COUNT
 
#define GPT_MODE_EDGE_TIME_UP   GPT_MODE_EDGE_TIME
 
#define GPT_NUM_INTS   4
 
#define GPT_PARTS_COUNT   2
 

Typedefs

typedef enum GPTimerCC26XX_Width GPTimerCC26XX_Width
 Definitions for specifying the GPTimer configuration (width) More...
 
typedef enum GPTimerCC26XX_Mode GPTimerCC26XX_Mode
 Definitions for supported GPTimer modes. Driver code assumes only modes using prescaler as timer extension in 16-bit configuration are used. Therefore new modes must not be added to the below description without also updating driver. More...
 
typedef enum GPTimerCC26XX_Interrupt GPTimerCC26XX_Interrupt
 Definitions for supported GPTimer interrupts. GPTimerCC26XX_IntMask arguments should be a bit vector containing these definitions. See description in Technical Reference. More...
 
typedef enum GPTimerCC26XX_Part GPTimerCC26XX_Part
 Definitions for GPTimer parts (Timer A / Timer B). Used in GPTimer configuration structure GPTimerCC26XX_config to configure the corresponding timer unit. More...
 
typedef enum GPTimerCC26XX_PinMux GPTimerCC26XX_PinMux
 Definitions for input / output ports in IO controller to connect GPTimer to a pin. Used in gptimerCC26xxHWAttrs for static timer configuration PIN driver is used to mux a pin to the timer. More...
 
typedef enum GPTimerCC26XX_DebugMode GPTimerCC26XX_DebugMode
 Definitions for controlling timer debug stall mode. More...
 
typedef enum GPTimerCC26XX_Direction GPTimerCC26XX_Direction
 Definitions for controlling timer counting direction. Setting the Direction for PWM operation has no effect (always counts down). More...
 
typedef enum GPTimerCC26XX_SetMatchTiming GPTimerCC26XX_SetMatchTiming
 Definitions for new value loading behaviour. More...
 
typedef enum GPTimerCC26XX_Edge GPTimerCC26XX_Edge
 Definitions for controlling edges used for timer capture. Used in GPTimer edge-time and edge-count modes. More...
 
typedef struct GPTimerCC26XX_Config GPTimerCC26XX_Config
 
typedef GPTimerCC26XX_ConfigGPTimerCC26XX_Handle
 
typedef uint16_t GPTimerCC26XX_IntMask
 
typedef uint32_t GPTimerCC26XX_Value
 
typedef void(* GPTimerCC26XX_HwiFxn) (GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
 
typedef struct GPTimerCC26XX_HWAttrs GPTimerCC26XX_HWAttrs
 GPTimer26XX Hardware attributes. More...
 
typedef struct GPTimerCC26XX_Object GPTimerCC26XX_Object
 GPTimer26XX Object. More...
 
typedef struct GPTimerCC26XX_Params GPTimerCC26XX_Params
 GPTimerCC26XX Parameters. More...
 

Enumerations

enum  GPTimerCC26XX_Width { GPT_CONFIG_32BIT = GPT_CFG_CFG_32BIT_TIMER, GPT_CONFIG_16BIT = GPT_CFG_CFG_16BIT_TIMER }
 Definitions for specifying the GPTimer configuration (width) More...
 
enum  GPTimerCC26XX_Mode {
  GPT_MODE_ONESHOT = GPT_TAMR_TAMR_ONE_SHOT | GPT_TAMR_TAMIE, GPT_MODE_PERIODIC = GPT_TAMR_TAMR_PERIODIC | GPT_TAMR_TAMIE, GPT_MODE_EDGE_COUNT = GPT_TAMR_TAMR_CAPTURE | GPT_TAMR_TACM_EDGCNT, GPT_MODE_EDGE_TIME = GPT_TAMR_TAMR_CAPTURE | GPT_TAMR_TACM_EDGTIME,
  GPT_MODE_PWM
}
 Definitions for supported GPTimer modes. Driver code assumes only modes using prescaler as timer extension in 16-bit configuration are used. Therefore new modes must not be added to the below description without also updating driver. More...
 
enum  GPTimerCC26XX_Interrupt { GPT_INT_TIMEOUT = 1 << 0, GPT_INT_CAPTURE_MATCH = 1 << 1, GPT_INT_CAPTURE = 1 << 2, GPT_INT_MATCH = 1 << 3 }
 Definitions for supported GPTimer interrupts. GPTimerCC26XX_IntMask arguments should be a bit vector containing these definitions. See description in Technical Reference. More...
 
enum  GPTimerCC26XX_Part { GPT_A = 0, GPT_B }
 Definitions for GPTimer parts (Timer A / Timer B). Used in GPTimer configuration structure GPTimerCC26XX_config to configure the corresponding timer unit. More...
 
enum  GPTimerCC26XX_PinMux {
  GPT_PIN_0A = IOC_PORT_MCU_PORT_EVENT0, GPT_PIN_0B = IOC_PORT_MCU_PORT_EVENT1, GPT_PIN_1A = IOC_PORT_MCU_PORT_EVENT2, GPT_PIN_1B = IOC_PORT_MCU_PORT_EVENT3,
  GPT_PIN_2A = IOC_PORT_MCU_PORT_EVENT4, GPT_PIN_2B = IOC_PORT_MCU_PORT_EVENT5, GPT_PIN_3A = IOC_PORT_MCU_PORT_EVENT6, GPT_PIN_3B = IOC_PORT_MCU_PORT_EVENT7
}
 Definitions for input / output ports in IO controller to connect GPTimer to a pin. Used in gptimerCC26xxHWAttrs for static timer configuration PIN driver is used to mux a pin to the timer. More...
 
enum  GPTimerCC26XX_DebugMode { GPTimerCC26XX_DEBUG_STALL_OFF = 0, GPTimerCC26XX_DEBUG_STALL_ON }
 Definitions for controlling timer debug stall mode. More...
 
enum  GPTimerCC26XX_Direction { GPTimerCC26XX_DIRECTION_DOWN = 0, GPTimerCC26XX_DIRECTION_UP }
 Definitions for controlling timer counting direction. Setting the Direction for PWM operation has no effect (always counts down). More...
 
enum  GPTimerCC26XX_SetMatchTiming { GPTimerCC26XX_SET_MATCH_NEXT_CLOCK = 0, GPTimerCC26XX_SET_MATCH_ON_TIMEOUT }
 Definitions for new value loading behaviour. More...
 
enum  GPTimerCC26XX_Edge { GPTimerCC26XX_POS_EDGE = GPT_CTL_TAEVENT_POS, GPTimerCC26XX_NEG_EDGE = GPT_CTL_TAEVENT_NEG, GPTimerCC26XX_BOTH_EDGES = GPT_CTL_TAEVENT_BOTH }
 Definitions for controlling edges used for timer capture. Used in GPTimer edge-time and edge-count modes. More...
 

Functions

void GPTimerCC26XX_Params_init (GPTimerCC26XX_Params *params)
 Function to initialize the GPTimerCC26XX_Params struct to its default values. More...
 
GPTimerCC26XX_Handle GPTimerCC26XX_open (unsigned int index, const GPTimerCC26XX_Params *params)
 This function opens a given GPTimer peripheral. Will set dependency on timer and configure it into specified mode. More...
 
void GPTimerCC26XX_close (GPTimerCC26XX_Handle handle)
 Function to close a GPTimer peripheral specified by the GPTimer handle. Closing timer will releae dependency on timer and clear configuration. More...
 
void GPTimerCC26XX_start (GPTimerCC26XX_Handle handle)
 Function to start the specified GPTimer with current settings. More...
 
void GPTimerCC26XX_stop (GPTimerCC26XX_Handle handle)
 Function to stop the specified GPTimer. More...
 
void GPTimerCC26XX_setLoadValue (GPTimerCC26XX_Handle handle, GPTimerCC26XX_Value loadValue)
 Function to set load value of the specified GPTimer. Function can be called while GPTimer is running. More...
 
void GPTimerCC26XX_setMatchValue (GPTimerCC26XX_Handle handle, GPTimerCC26XX_Value matchValue)
 Function to set match value of the specified GPTimer. Function can be called while GPTimer is running. More...
 
void GPTimerCC26XX_setCaptureEdge (GPTimerCC26XX_Handle handle, GPTimerCC26XX_Edge edge)
 Function to set which input edge the GPTimer capture should use. Applies to edge-count and edge-time modes Function can be called while GPTimer is running. More...
 
GPTimerCC26XX_Value GPTimerCC26XX_getFreeRunValue (GPTimerCC26XX_Handle handle)
 Function to retrieve the current free-running value of timer. More...
 
GPTimerCC26XX_Value GPTimerCC26XX_getValue (GPTimerCC26XX_Handle handle)
 Function to retrieve the current value of timer This returns the value of the timer in all modes except for input edge count and input edge time mode. In edge count mode, this register contains the number of edges that have occurred. In input edge time, this register contains the timer value at which the last edge event took place. More...
 
void GPTimerCC26XX_registerInterrupt (GPTimerCC26XX_Handle handle, GPTimerCC26XX_HwiFxn callback, GPTimerCC26XX_IntMask intMask)
 Function to register a CPU interrupt for a given timer handle and enable a set of timer interrupt sources. The interrupt to the CPU will be a bitwise OR of the enabled interrupt sources. When an interrupt occurs, the driver will clear the interrupt source and call the application provided callback. The callback is executed in HW interrupt context and processing in callback should be minimized. More...
 
void GPTimerCC26XX_unregisterInterrupt (GPTimerCC26XX_Handle handle)
 Function to disable a CPU interrupt for a given timer handle and disable all interrupt sources for corresponding GPTimer unit. More...
 
void GPTimerCC26XX_enableInterrupt (GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
 Function to enable a set of GPTimer interrupt sources. The interrupt to the CPU must be enabled using GPTimerCC26XX_registerInterrupt. More...
 
void GPTimerCC26XX_disableInterrupt (GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
 Function to disable a set of GPTimer interrupt sources. More...
 
void GPTimerCC26XX_configureDebugStall (GPTimerCC26XX_Handle handle, GPTimerCC26XX_DebugMode mode)
 Function to control timer debug stall mode. When enabled, the timer will stop when the debugger halts the CPU. More...
 
static GPTimerCC26XX_PinMux GPTimerCC26XX_getPinMux (GPTimerCC26XX_Handle handle)
 Function to return the PIN mux used by the GPTimer identified by handle. This is used to connect a GPTimer capture/compare port to a device DIO using PINCC26XX_setMux. This is typically used in PWM mode and Timer Edge-Count / Edge-Time modes. Function assumes correct pinMux is set up in device specific GPTimerCC26XX_HWAttrs. More...
 

Macro Definition Documentation

§ GPT_MODE_ONESHOT_UP

#define GPT_MODE_ONESHOT_UP   GPT_MODE_ONESHOT

§ GPT_MODE_PERIODIC_UP

#define GPT_MODE_PERIODIC_UP   GPT_MODE_PERIODIC

§ GPT_MODE_EDGE_COUNT_UP

#define GPT_MODE_EDGE_COUNT_UP   GPT_MODE_EDGE_COUNT

§ GPT_MODE_EDGE_TIME_UP

#define GPT_MODE_EDGE_TIME_UP   GPT_MODE_EDGE_TIME

§ GPT_NUM_INTS

#define GPT_NUM_INTS   4

§ GPT_PARTS_COUNT

#define GPT_PARTS_COUNT   2

Typedef Documentation

§ GPTimerCC26XX_Width

Definitions for specifying the GPTimer configuration (width)

§ GPTimerCC26XX_Mode

Definitions for supported GPTimer modes. Driver code assumes only modes using prescaler as timer extension in 16-bit configuration are used. Therefore new modes must not be added to the below description without also updating driver.

§ GPTimerCC26XX_Interrupt

Definitions for supported GPTimer interrupts. GPTimerCC26XX_IntMask arguments should be a bit vector containing these definitions. See description in Technical Reference.

§ GPTimerCC26XX_Part

Definitions for GPTimer parts (Timer A / Timer B). Used in GPTimer configuration structure GPTimerCC26XX_config to configure the corresponding timer unit.

§ GPTimerCC26XX_PinMux

Definitions for input / output ports in IO controller to connect GPTimer to a pin. Used in gptimerCC26xxHWAttrs for static timer configuration PIN driver is used to mux a pin to the timer.

See also
PINCC26XX_setMux
GPTimerCC26XX_getPinMux

§ GPTimerCC26XX_DebugMode

Definitions for controlling timer debug stall mode.

§ GPTimerCC26XX_Direction

Definitions for controlling timer counting direction. Setting the Direction for PWM operation has no effect (always counts down).

§ GPTimerCC26XX_SetMatchTiming

Definitions for new value loading behaviour.

If set to NEXT_CLOCK, then the new match value is updated immediately. If set to ON_TIMEOUT the new match will only be applied to the next timer cycle.

Only match setting is affected by this option. Load setting is always applied immediately.

§ GPTimerCC26XX_Edge

Definitions for controlling edges used for timer capture. Used in GPTimer edge-time and edge-count modes.

§ GPTimerCC26XX_Config

§ GPTimerCC26XX_Handle

§ GPTimerCC26XX_IntMask

typedef uint16_t GPTimerCC26XX_IntMask

§ GPTimerCC26XX_Value

typedef uint32_t GPTimerCC26XX_Value

§ GPTimerCC26XX_HwiFxn

typedef void(* GPTimerCC26XX_HwiFxn) (GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)

§ GPTimerCC26XX_HWAttrs

GPTimer26XX Hardware attributes.

These fields are used by the driver to set up underlying GPTimer driver statically. A sample structure is shown below:

// GPTimer hardware attributes, one per timer unit (Timer 0A, 0B, 1A, 1B..)
const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650_GPTIMERPARTSCOUNT] = {
{.baseAddr = GPT0_BASE, .intNum = INT_TIMER0A, .powerMngrId = PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
{.baseAddr = GPT0_BASE, .intNum = INT_TIMER0B, .powerMngrId = PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
{.baseAddr = GPT1_BASE, .intNum = INT_TIMER1A, .powerMngrId = PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
{.baseAddr = GPT1_BASE, .intNum = INT_TIMER1B, .powerMngrId = PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
{.baseAddr = GPT2_BASE, .intNum = INT_TIMER2A, .powerMngrId = PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
{.baseAddr = GPT2_BASE, .intNum = INT_TIMER2B, .powerMngrId = PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
{.baseAddr = GPT3_BASE, .intNum = INT_TIMER3A, .powerMngrId = PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
{.baseAddr = GPT3_BASE, .intNum = INT_TIMER3B, .powerMngrId = PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
};

§ GPTimerCC26XX_Object

GPTimer26XX Object.

These fields are used by the driver to store and modify GPTimer configuration during run-time. The application must not edit any member variables of this structure. Appplications should also not access member variables of this structure as backwards compatibility is not guaranteed. An example structure is shown below:

// GPTimer objects, one per full-width timer (A+B) (Timer 0, Timer 1..)
GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650_GPTIMERCOUNT];

§ GPTimerCC26XX_Params

GPTimerCC26XX Parameters.

GPTimer parameters are used to with the GPTimerCC26XX_open() call. Default values for these parameters are set using GPTimerCC26XX_Params_init().

See also
GPTimerCC26XX_Params_init()

Enumeration Type Documentation

§ GPTimerCC26XX_Width

Definitions for specifying the GPTimer configuration (width)

Enumerator
GPT_CONFIG_32BIT 
GPT_CONFIG_16BIT 

§ GPTimerCC26XX_Mode

Definitions for supported GPTimer modes. Driver code assumes only modes using prescaler as timer extension in 16-bit configuration are used. Therefore new modes must not be added to the below description without also updating driver.

Enumerator
GPT_MODE_ONESHOT 
GPT_MODE_PERIODIC 
GPT_MODE_EDGE_COUNT 
GPT_MODE_EDGE_TIME 
GPT_MODE_PWM 

§ GPTimerCC26XX_Interrupt

Definitions for supported GPTimer interrupts. GPTimerCC26XX_IntMask arguments should be a bit vector containing these definitions. See description in Technical Reference.

Enumerator
GPT_INT_TIMEOUT 
GPT_INT_CAPTURE_MATCH 
GPT_INT_CAPTURE 
GPT_INT_MATCH 

§ GPTimerCC26XX_Part

Definitions for GPTimer parts (Timer A / Timer B). Used in GPTimer configuration structure GPTimerCC26XX_config to configure the corresponding timer unit.

Enumerator
GPT_A 
GPT_B 

§ GPTimerCC26XX_PinMux

Definitions for input / output ports in IO controller to connect GPTimer to a pin. Used in gptimerCC26xxHWAttrs for static timer configuration PIN driver is used to mux a pin to the timer.

See also
PINCC26XX_setMux
GPTimerCC26XX_getPinMux
Enumerator
GPT_PIN_0A 
GPT_PIN_0B 
GPT_PIN_1A 
GPT_PIN_1B 
GPT_PIN_2A 
GPT_PIN_2B 
GPT_PIN_3A 
GPT_PIN_3B 

§ GPTimerCC26XX_DebugMode

Definitions for controlling timer debug stall mode.

Enumerator
GPTimerCC26XX_DEBUG_STALL_OFF 
GPTimerCC26XX_DEBUG_STALL_ON 

§ GPTimerCC26XX_Direction

Definitions for controlling timer counting direction. Setting the Direction for PWM operation has no effect (always counts down).

Enumerator
GPTimerCC26XX_DIRECTION_DOWN 
GPTimerCC26XX_DIRECTION_UP 

§ GPTimerCC26XX_SetMatchTiming

Definitions for new value loading behaviour.

If set to NEXT_CLOCK, then the new match value is updated immediately. If set to ON_TIMEOUT the new match will only be applied to the next timer cycle.

Only match setting is affected by this option. Load setting is always applied immediately.

Enumerator
GPTimerCC26XX_SET_MATCH_NEXT_CLOCK 
GPTimerCC26XX_SET_MATCH_ON_TIMEOUT 

§ GPTimerCC26XX_Edge

Definitions for controlling edges used for timer capture. Used in GPTimer edge-time and edge-count modes.

Enumerator
GPTimerCC26XX_POS_EDGE 
GPTimerCC26XX_NEG_EDGE 
GPTimerCC26XX_BOTH_EDGES 

Function Documentation

§ GPTimerCC26XX_Params_init()

void GPTimerCC26XX_Params_init ( GPTimerCC26XX_Params params)

Function to initialize the GPTimerCC26XX_Params struct to its default values.

Parameters
paramsAn pointer to GPTimerCC26XX_Params structure for initialization

Defaults values are:

  • 32-bit configuration
  • Periodic mode counting upwards
  • Debug stall mode disabled

§ GPTimerCC26XX_open()

GPTimerCC26XX_Handle GPTimerCC26XX_open ( unsigned int  index,
const GPTimerCC26XX_Params params 
)

This function opens a given GPTimer peripheral. Will set dependency on timer and configure it into specified mode.

Parameters
indexLogical peripheral number for the GPTimer indexed into the GPTimerCC26XX_config table
paramsPointer to a parameter block. If NULL, it will use default values.
Returns
A GPTimerCC26XX_Handle on success or a NULL on an error or if it has been opened already. If NULL is returned, further GPTimerCC26XX API calls will result in undefined behaviour.
See also
GPTimerCC26XX_close()

§ GPTimerCC26XX_close()

void GPTimerCC26XX_close ( GPTimerCC26XX_Handle  handle)

Function to close a GPTimer peripheral specified by the GPTimer handle. Closing timer will releae dependency on timer and clear configuration.

Precondition
GPTimerCC26XX_open() has to be called first.
GPTimerCC26XX_stop() should to be called first if GPTimer is started
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open()
See also
GPTimerCC26XX_open()
GPTimerCC26XX_start()
GPTimerCC26XX_stop()

§ GPTimerCC26XX_start()

void GPTimerCC26XX_start ( GPTimerCC26XX_Handle  handle)

Function to start the specified GPTimer with current settings.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open()
See also
GPTimerCC26XX_open()
GPTimerCC26XX_stop()

§ GPTimerCC26XX_stop()

void GPTimerCC26XX_stop ( GPTimerCC26XX_Handle  handle)

Function to stop the specified GPTimer.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open()
See also
GPTimerCC26XX_open()
GPTimerCC26XX_start()

§ GPTimerCC26XX_setLoadValue()

void GPTimerCC26XX_setLoadValue ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_Value  loadValue 
)

Function to set load value of the specified GPTimer. Function can be called while GPTimer is running.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
loadValueLoad value to set the GPTimer to.
See also
GPTimerCC26XX_open()

§ GPTimerCC26XX_setMatchValue()

void GPTimerCC26XX_setMatchValue ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_Value  matchValue 
)

Function to set match value of the specified GPTimer. Function can be called while GPTimer is running.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
matchValueMatch value to set the GPTimer to.
See also
GPTimerCC26XX_open()

§ GPTimerCC26XX_setCaptureEdge()

void GPTimerCC26XX_setCaptureEdge ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_Edge  edge 
)

Function to set which input edge the GPTimer capture should use. Applies to edge-count and edge-time modes Function can be called while GPTimer is running.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
edgeThe edge that should trigger a capture
See also
GPTimerCC26XX_open()

§ GPTimerCC26XX_getFreeRunValue()

GPTimerCC26XX_Value GPTimerCC26XX_getFreeRunValue ( GPTimerCC26XX_Handle  handle)

Function to retrieve the current free-running value of timer.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
Returns
Current free-running timer value for all modes
See also
GPTimerCC26XX_open()

§ GPTimerCC26XX_getValue()

GPTimerCC26XX_Value GPTimerCC26XX_getValue ( GPTimerCC26XX_Handle  handle)

Function to retrieve the current value of timer This returns the value of the timer in all modes except for input edge count and input edge time mode. In edge count mode, this register contains the number of edges that have occurred. In input edge time, this register contains the timer value at which the last edge event took place.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
Returns
Current free-running timer value for all modes
See also
GPTimerCC26XX_open()

§ GPTimerCC26XX_registerInterrupt()

void GPTimerCC26XX_registerInterrupt ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_HwiFxn  callback,
GPTimerCC26XX_IntMask  intMask 
)

Function to register a CPU interrupt for a given timer handle and enable a set of timer interrupt sources. The interrupt to the CPU will be a bitwise OR of the enabled interrupt sources. When an interrupt occurs, the driver will clear the interrupt source and call the application provided callback. The callback is executed in HW interrupt context and processing in callback should be minimized.

Interrupt sources can also be individually disabled and enabled by using GPTimerCC26XX_enableInterrupt / GPTimerCC26XX_disableInterrupt.

This function should only be called once for a handle after opening the timer. If closing a GPTimer, interrupts for the timer should be unregistered first using GPTimerCC26XX_unregisterInterrupt.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
callbackAn application provided callback function
intMaskA bit vector mask containing values from GPTimerCC26XX_Interrupt
See also
GPTimerCC26XX_open
GPTimerCC26XX_enableInterrupt
GPTimerCC26XX_disableInterrupt

§ GPTimerCC26XX_unregisterInterrupt()

void GPTimerCC26XX_unregisterInterrupt ( GPTimerCC26XX_Handle  handle)

Function to disable a CPU interrupt for a given timer handle and disable all interrupt sources for corresponding GPTimer unit.

This function should only be called once for a handle after opening the timer and registering the interrupt.

Precondition
GPTimerCC26XX_open() has to be called first successfully
GPTimerCC26XX_registerInterrupt() has to be called first
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
See also
GPTimerCC26XX_open
GPTimerCC26XX_registerInterrupt

§ GPTimerCC26XX_enableInterrupt()

void GPTimerCC26XX_enableInterrupt ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_IntMask  interruptMask 
)

Function to enable a set of GPTimer interrupt sources. The interrupt to the CPU must be enabled using GPTimerCC26XX_registerInterrupt.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
interruptMaskA bit vector mask containing values from GPTimerCC26XX_Interrupt
See also
GPTimerCC26XX_open
GPTimerCC26XX_disableInterrupt

§ GPTimerCC26XX_disableInterrupt()

void GPTimerCC26XX_disableInterrupt ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_IntMask  interruptMask 
)

Function to disable a set of GPTimer interrupt sources.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
interruptMaskA bit vector mask containing values from GPTimerCC26XX_Interrupt
See also
GPTimerCC26XX_open
GPTimerCC26XX_enableInterrupt

§ GPTimerCC26XX_configureDebugStall()

void GPTimerCC26XX_configureDebugStall ( GPTimerCC26XX_Handle  handle,
GPTimerCC26XX_DebugMode  mode 
)

Function to control timer debug stall mode. When enabled, the timer will stop when the debugger halts the CPU.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
modeConfiguration for debug stall mode (enable/disable)
See also
GPTimerCC26XX_open

§ GPTimerCC26XX_getPinMux()

static GPTimerCC26XX_PinMux GPTimerCC26XX_getPinMux ( GPTimerCC26XX_Handle  handle)
inlinestatic

Function to return the PIN mux used by the GPTimer identified by handle. This is used to connect a GPTimer capture/compare port to a device DIO using PINCC26XX_setMux. This is typically used in PWM mode and Timer Edge-Count / Edge-Time modes. Function assumes correct pinMux is set up in device specific GPTimerCC26XX_HWAttrs.

Precondition
GPTimerCC26XX_open() has to be called first successfully
Parameters
handleA GPTimerCC26XX handle returned from GPTimerCC26XX_open
See also
GPTimerCC26XX_open

References GPTimerCC26XX_Config::hwAttrs, and GPTimerCC26XX_HWAttrs::pinMux.

© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale