Loading...
Searching...
No Matches
my9221.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 HAW Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20#include <stdint.h>
21
22#include "periph/gpio.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
31#define MY9221_LED_MAX (12U)
32
36#define MY9221_LED_ON (0xFF)
37
41#define MY9221_LED_OFF (0x00)
42
47enum {
50};
52
57enum {
60};
62
66typedef struct {
67 uint8_t leds;
68 uint8_t dir;
69 gpio_t clk;
70 gpio_t dat;
72
76typedef struct {
79} my9221_t;
80
89int my9221_init(my9221_t *dev, const my9221_params_t *params);
90
101void my9221_set_state(my9221_t *dev, const uint8_t *state, uint8_t len);
102
110void my9221_set_led(my9221_t *dev, const uint8_t led, const uint8_t alpha);
111
118void my9221_toggle_led(my9221_t *dev, const uint8_t led);
119
120#ifdef __cplusplus
121}
122#endif
123
Low-level GPIO peripheral driver interface definitions.
void my9221_toggle_led(my9221_t *dev, const uint8_t led)
Toggle a distinct LED.
#define MY9221_LED_MAX
Maximum number of distinct LEDs the controller can operate.
Definition my9221.h:31
void my9221_set_led(my9221_t *dev, const uint8_t led, const uint8_t alpha)
Set brightness of distinct LED.
int my9221_init(my9221_t *dev, const my9221_params_t *params)
Initialize the given driver.
void my9221_set_state(my9221_t *dev, const uint8_t *state, uint8_t len)
Set device state.
@ MY9221_ERR
failure
Definition my9221.h:59
@ MY9221_OK
success
Definition my9221.h:58
@ MY9221_DIR_REV
backward
Definition my9221.h:49
@ MY9221_DIR_FWD
forward
Definition my9221.h:48
Parameters needed for device initialization.
Definition my9221.h:66
uint8_t leds
number of LEDs
Definition my9221.h:67
gpio_t dat
data gpio pin
Definition my9221.h:70
uint8_t dir
led direction
Definition my9221.h:68
gpio_t clk
clock gpio pin
Definition my9221.h:69
Device descriptor for MY9221 LED controller.
Definition my9221.h:76
uint8_t state[MY9221_LED_MAX]
state of individual leds
Definition my9221.h:78
my9221_params_t params
config parameters
Definition my9221.h:77