Driver for the Grove ledbar. More...

Detailed Description

Driver for the Grove ledbar.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Files

file  grove_ledbar_params.h
 Config for the Grove LED bar based on MY9221 LED controller.
 
file  grove_ledbar.h
 Interface for the Grove ledbar driver.
 

Macros

#define GROVE_LEDBAR_MAX   UINT8_MAX
 Maximum value for ledbar level. More...
 

Typedefs

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

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
 

Macro Definition Documentation

◆ GROVE_LEDBAR_G2R

#define GROVE_LEDBAR_G2R   MY9221_DIR_REV

Definition at line 40 of file grove_ledbar.h.

◆ GROVE_LEDBAR_MAX

#define GROVE_LEDBAR_MAX   UINT8_MAX

Maximum value for ledbar level.

Definition at line 46 of file grove_ledbar.h.

◆ GROVE_LEDBAR_R2G

#define GROVE_LEDBAR_R2G   MY9221_DIR_FWD

Definition at line 39 of file grove_ledbar.h.

Typedef Documentation

◆ grove_ledbar_params_t

Parameters needed for device initialization.

Definition at line 51 of file grove_ledbar.h.

◆ grove_ledbar_t

Device descriptor for grove ledbar, alias for MY9221 LED controller.

Definition at line 56 of file grove_ledbar.h.

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