Loading...
Searching...
No Matches
my9221.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
21#ifndef MY9221_H
22#define MY9221_H
23
24#include <stdint.h>
25
26#include "periph/gpio.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
35#define MY9221_LED_MAX (12U)
36
40#define MY9221_LED_ON (0xFF)
41
45#define MY9221_LED_OFF (0x00)
46
51enum {
54};
61enum {
64};
70typedef struct {
71 uint8_t leds;
72 uint8_t dir;
73 gpio_t clk;
74 gpio_t dat;
76
80typedef struct {
82 uint8_t state[MY9221_LED_MAX];
83} my9221_t;
84
93int my9221_init(my9221_t *dev, const my9221_params_t *params);
94
105void my9221_set_state(my9221_t *dev, const uint8_t *state, uint8_t len);
106
114void my9221_set_led(my9221_t *dev, const uint8_t led, const uint8_t alpha);
115
122void my9221_toggle_led(my9221_t *dev, const uint8_t led);
123
124#ifdef __cplusplus
125}
126#endif
127
128#endif /* MY9221_H */
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:35
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:63
@ MY9221_OK
success
Definition my9221.h:62
@ MY9221_DIR_REV
backward
Definition my9221.h:53
@ MY9221_DIR_FWD
forward
Definition my9221.h:52
Parameters needed for device initialization.
Definition my9221.h:70
uint8_t leds
number of LEDs
Definition my9221.h:71
gpio_t dat
data gpio pin
Definition my9221.h:74
uint8_t dir
led direction
Definition my9221.h:72
gpio_t clk
clock gpio pin
Definition my9221.h:73
Device descriptor for MY9221 LED controller.
Definition my9221.h:80
my9221_params_t params
config parameters
Definition my9221.h:81