MY9221 LED controller

Driver for the MY-Semi MY9221 LED controller. More...

Detailed Description

Driver for the MY-Semi MY9221 LED controller.

Files

file  my9221.h
 Interface for the MY9221 LED controller driver.
 
file  my9221_internal.h
 Internal config and parameters for the MY9221 LED controller.
 

Data Structures

struct  my9221_params_t
 Parameters needed for device initialization. More...
 
struct  my9221_t
 Device descriptor for MY9221 LED controller. More...
 

Macros

#define MY9221_LED_MAX   (12U)
 Maximum number of distinct LEDs the controller can operate.
 
#define MY9221_LED_ON   (0xFF)
 Max brightness value to turn LED full on.
 
#define MY9221_LED_OFF   (0x00)
 Min brightness value to turn LED off.
 

Functions

int my9221_init (my9221_t *dev, const my9221_params_t *params)
 Initialize the given driver. More...
 
void my9221_set_state (my9221_t *dev, const uint8_t *state, uint8_t len)
 Set device state. More...
 
void my9221_set_led (my9221_t *dev, const uint8_t led, const uint8_t alpha)
 Set brightness of distinct LED. More...
 
void my9221_toggle_led (my9221_t *dev, const uint8_t led)
 Toggle a distinct LED. More...
 

Direction the controller accesses LEDs

enum  { MY9221_DIR_FWD, MY9221_DIR_REV }
 

Driver specific return codes

enum  { MY9221_OK, MY9221_ERR }
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MY9221_DIR_FWD 

forward

MY9221_DIR_REV 

backward

Definition at line 51 of file my9221.h.

◆ anonymous enum

anonymous enum
Enumerator
MY9221_OK 

success

MY9221_ERR 

failure

Definition at line 61 of file my9221.h.

Function Documentation

◆ my9221_init()

int my9221_init ( my9221_t dev,
const my9221_params_t params 
)

Initialize the given driver.

Parameters
[out]devdevice descriptor of MY9221 LED controller
[in]paramsconfiguration parameters
Returns
0 on success, otherwise error

◆ my9221_set_led()

void my9221_set_led ( my9221_t dev,
const uint8_t  led,
const uint8_t  alpha 
)

Set brightness of distinct LED.

Parameters
[in]devdevice descriptor of MY9221 LED controller
[in]ledled number, start with 0
[in]alphabrightness level for led

◆ my9221_set_state()

void my9221_set_state ( my9221_t dev,
const uint8_t *  state,
uint8_t  len 
)

Set device state.

Note
If state is NULL or len is 0, current device state is set otherwise, current state is overwritten by state.
Parameters
[in]devdevice descriptor of MY9221 LED controller
[in]statenew device state array
[in]lenlength of state array

◆ my9221_toggle_led()

void my9221_toggle_led ( my9221_t dev,
const uint8_t  led 
)

Toggle a distinct LED.

Parameters
[in]devdevice descriptor of MY9221 LED controller
[in]ledled number, start with 0