my9221.h¶
Interface for the MY9221 LED controller driver.
-
enum
@140
¶ - MY9221_DIR_FWD
- forward
- MY9221_DIR_REV
- backward
-
enum
@141
¶ - MY9221_OK
- success
- MY9221_ERR
- failure
-
MY9221_LED_MAX
¶ Maximum number of distinct LEDs the controller can operate.
1
(12U)
-
MY9221_LED_ON
¶ Max brightness value to turn LED full on.
1
(0xFF)
-
MY9221_LED_OFF
¶ Min brightness value to turn LED off.
1
(0x00)
-
int
my9221_init
(my9221_t * dev, const my9221_params_t * params)¶ Initialize the given driver.
Parameters
dev: device descriptor of MY9221 LED controller params: configuration parameters Return values
- 0 on success, otherwise error
-
void
my9221_set_state
(my9221_t * dev, const uint8_t * state, uint8_t len)¶ Set device state.
Note
If
state
is NULL orlen
is 0, current device state is set otherwise, current state is overwritten bystate
.Parameters
dev: device descriptor of MY9221 LED controller state: new device state array len: length of state array
-
void
my9221_set_led
(my9221_t * dev, const uint8_t led, const uint8_t alpha)¶ Set brightness of distinct LED.
Parameters
dev: device descriptor of MY9221 LED controller led: led number, start with 0 alpha: brightness level for led
-
void
my9221_toggle_led
(my9221_t * dev, const uint8_t led)¶ Toggle a distinct LED.
Parameters
dev: device descriptor of MY9221 LED controller led: led number, start with 0
-
struct
my9221_params_t
¶ Parameters needed for device initialization.
-
uint8_t
leds
¶ number of LEDs
-
uint8_t
dir
¶ led direction
-
gpio.h::gpio_t
clk
¶ clock gpio pin
-
gpio.h::gpio_t
dat
¶ data gpio pin
-
uint8_t
-
struct
my9221_t
¶ Device descriptor for MY9221 LED controller.
-
my9221_params_t
params
¶ config parameters
-
uint8_t
state
()¶ state of individual leds
-
my9221_params_t