Driver for the Grove ledbar. More...

Detailed Description

Driver for the Grove ledbar.

Files

file  grove_ledbar.h
 Interface for the Grove ledbar driver.
 

Macros

#define GROVE_LEDBAR_MAX   UINT8_MAX
 Maximum value for ledbar level.
 

Typedefs

typedef my9221_params_t grove_ledbar_params_t
 Parameters needed for device initialization.
 
typedef my9221_t grove_ledbar_t
 Device descriptor for grove ledbar, alias for MY9221 LED controller.
 

Functions

int grove_ledbar_init (grove_ledbar_t *dev, const grove_ledbar_params_t *params)
 Initialize the given driver. More...
 
void grove_ledbar_set (grove_ledbar_t *dev, uint8_t level)
 Set overall (brightness) level distributed over all LEDs. More...
 
void grove_ledbar_clear (grove_ledbar_t *dev)
 Clear ledbar, i.e. More...
 

Ledbar direction, either red to green, or vice versa.

#define GROVE_LEDBAR_R2G   MY9221_DIR_FWD
 
#define GROVE_LEDBAR_G2R   MY9221_DIR_REV
 

Function Documentation

◆ grove_ledbar_clear()

void grove_ledbar_clear ( grove_ledbar_t dev)

Clear ledbar, i.e.

set all LEDs off

Precondition
dev != NULL
Parameters
[in]devdevice descriptor grove ledbar

◆ grove_ledbar_init()

int grove_ledbar_init ( grove_ledbar_t dev,
const grove_ledbar_params_t params 
)

Initialize the given driver.

Precondition
dev != NULL and params != NULL
Parameters
[out]devdevice descriptor grove ledbar
[in]paramsconfiguration parameters
Returns
0 on success, otherwise error

◆ grove_ledbar_set()

void grove_ledbar_set ( grove_ledbar_t dev,
uint8_t  level 
)

Set overall (brightness) level distributed over all LEDs.

Precondition
dev != NULL
Parameters
[in]devdevice descriptor grove ledbar
[in]leveloverall brightness level