AM263x MCU+ SDK  08.02.01
APIs for I2C/GPIO based LED driver

Introduction

This module contains APIs to program and use I2C or GPIO based LED module on the board.

See LED for more details.

Data Structures

struct  LED_Params
 Parameters passed during LED_open() More...
 
struct  LED_Fxns
 Driver implementation callbacks. More...
 
struct  LED_Attrs
 LED device attributes, these are filled by SysCfg based on the device that is selected. More...
 
struct  LED_Config
 LED driver configuration, these are filled by SysCfg based on the device that is selected. More...
 
struct  LED_Object
 LED driver object - not to be used by application. More...
 

Functions

void LED_Params_init (LED_Params *params)
 Set default parameters in the LED_Params_s structure. More...
 
LED_Handle LED_open (uint32_t instanceId, const LED_Params *params)
 Open LED driver. More...
 
void LED_close (LED_Handle handle)
 Open LED driver. More...
 
int32_t LED_on (LED_Handle handle, uint32_t index)
 API to power on the LED. More...
 
int32_t LED_off (LED_Handle handle, uint32_t index)
 API to power off the LED. More...
 
int32_t LED_setMask (LED_Handle handle, uint32_t mask)
 API to set the group mask incase of I2C controlled LED having more than one LED connected to the controller. More...
 
const LED_AttrsLED_getAttrs (uint32_t instanceId)
 Return LED attributes. More...
 

Typedefs

typedef void * LED_Handle
 Handle to the LED driver returned by LED_open() More...
 

LED driver implementation callbacks

typedef int32_t(* LED_OpenFxn) (LED_Config *config, const LED_Params *params)
 Driver implementation to open a specific LED driver. More...
 
typedef void(* LED_CloseFxn) (LED_Config *config)
 Driver implementation to close a specific LED driver. More...
 
typedef int32_t(* LED_OnFxn) (LED_Config *config, uint32_t index)
 Driver implementation to power on an LED using a specific LED driver. More...
 
typedef int32_t(* LED_OffFxn) (LED_Config *config, uint32_t index)
 Driver implementation to power off an LED using a specific LED driver. More...
 
typedef int32_t(* LED_SetMaskFxn) (LED_Config *config, uint32_t mask)
 Driver implementation to set group mask using a specific LED driver. More...
 

Typedef Documentation

◆ LED_Handle

typedef void* LED_Handle

Handle to the LED driver returned by LED_open()

◆ LED_OpenFxn

typedef int32_t(* LED_OpenFxn) (LED_Config *config, const LED_Params *params)

Driver implementation to open a specific LED driver.

Typically this callback is hidden from the end application and is implemented when a new type of LED device needs to be implemented.

Parameters
config[IN] LED configuration for the specific LED device
params[IN] User controllable parameters when opening the LED device
Returns
SystemP_SUCCESS on success, else failure

◆ LED_CloseFxn

typedef void(* LED_CloseFxn) (LED_Config *config)

Driver implementation to close a specific LED driver.

Typically this callback is hidden from the end application and is implemented when a new type of LED device needs to be implemented.

Parameters
config[IN] LED configuration for the specific LED device
Returns
SystemP_SUCCESS on success, else failure

◆ LED_OnFxn

typedef int32_t(* LED_OnFxn) (LED_Config *config, uint32_t index)

Driver implementation to power on an LED using a specific LED driver.

Typically this callback is hidden from the end application and is implemented when a new type of LED device needs to be implemented.

Parameters
config[IN] LED configuration for the specific LED device
index[IN] Index to the LED group which needs to be turned on
Returns
SystemP_SUCCESS on success, else failure

◆ LED_OffFxn

typedef int32_t(* LED_OffFxn) (LED_Config *config, uint32_t index)

Driver implementation to power off an LED using a specific LED driver.

Typically this callback is hidden from the end application and is implemented when a new type of LED device needs to be implemented.

Parameters
config[IN] LED configuration for the specific LED device
index[IN] Index to the LED group which needs to be turned off
Returns
SystemP_SUCCESS on success, else failure

◆ LED_SetMaskFxn

typedef int32_t(* LED_SetMaskFxn) (LED_Config *config, uint32_t mask)

Driver implementation to set group mask using a specific LED driver.

Typically this callback is hidden from the end application and is implemented when a new type of LED device needs to be implemented.

Parameters
config[IN] LED configuration for the specific LED device
mask[IN] Bit Mask to set at one go
Returns
SystemP_SUCCESS on success, else failure

Function Documentation

◆ LED_Params_init()

void LED_Params_init ( LED_Params *  params)

Set default parameters in the LED_Params_s structure.

Call this API to set defaults and then override the fields as needed before calling LED_open.

Parameters
params[OUT] Initialized parameters

◆ LED_open()

LED_Handle LED_open ( uint32_t  instanceId,
const LED_Params *  params 
)

Open LED driver.

Make sure the SOC peripheral driver is open'ed before calling this API. Drivers_open function generated by SysCfg opens the underlying SOC peripheral driver, e.g I2C.

Global variables LED_Config gLedConfig[] and uint32_t gLedConfigNum is instantiated by SysCfg to describe the LED configuration based on user selection in SysCfg.

Parameters
instanceId[IN] Index within LED_Config gLedConfig[] denoting the LED driver to open
params[IN] Open parameters
Returns
Handle to LED driver which should be used in subsequent API call Else returns NULL in case of failure

◆ LED_close()

void LED_close ( LED_Handle  handle)

Open LED driver.

Parameters
handle[IN] LED driver handle from LED_open

◆ LED_on()

int32_t LED_on ( LED_Handle  handle,
uint32_t  index 
)

API to power on the LED.

Parameters
handle[IN] LED driver handle from LED_open
index[IN] Index to the LED group which needs to be turned on. In case of GPIO controlled LED, set this to 0.
Returns
SystemP_SUCCESS on success, else failure

◆ LED_off()

int32_t LED_off ( LED_Handle  handle,
uint32_t  index 
)

API to power off the LED.

Parameters
handle[IN] LED driver handle from LED_open
index[IN] Index to the LED group which needs to be turned off. In case of GPIO controlled LED, set this to 0.
Returns
SystemP_SUCCESS on success, else failure

◆ LED_setMask()

int32_t LED_setMask ( LED_Handle  handle,
uint32_t  mask 
)

API to set the group mask incase of I2C controlled LED having more than one LED connected to the controller.

Parameters
handle[IN] LED driver handle from LED_open
mask[IN] Bit Mask to set at one go. Only bits upto the number of LED present in a group will be used by this function. Set bit to 0 for OFF. Set bit to 1 for ON.
Returns
SystemP_SUCCESS on success, else failure

◆ LED_getAttrs()

const LED_Attrs* LED_getAttrs ( uint32_t  instanceId)

Return LED attributes.

Parameters
instanceId[IN] LED instance ID
Returns
LED_Attrs, else NULL if instanceId is invalid