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
9#pragma once
10
23#include <stdint.h>
24
25#include "periph/gpio.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
34#define MY9221_LED_MAX (12U)
35
39#define MY9221_LED_ON (0xFF)
40
44#define MY9221_LED_OFF (0x00)
45
50enum {
53};
60enum {
63};
69typedef struct {
70 uint8_t leds;
71 uint8_t dir;
75
79typedef struct {
81 uint8_t state[MY9221_LED_MAX];
82} my9221_t;
83
92int my9221_init(my9221_t *dev, const my9221_params_t *params);
93
104void my9221_set_state(my9221_t *dev, const uint8_t *state, uint8_t len);
105
113void my9221_set_led(my9221_t *dev, const uint8_t led, const uint8_t alpha);
114
121void my9221_toggle_led(my9221_t *dev, const uint8_t led);
122
123#ifdef __cplusplus
124}
125#endif
126
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:34
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:62
@ MY9221_OK
success
Definition my9221.h:61
@ MY9221_DIR_REV
backward
Definition my9221.h:52
@ MY9221_DIR_FWD
forward
Definition my9221.h:51
uint16_t gpio_t
GPIO type identifier.
Definition periph_cpu.h:117
Parameters needed for device initialization.
Definition my9221.h:69
uint8_t leds
number of LEDs
Definition my9221.h:70
gpio_t dat
data gpio pin
Definition my9221.h:73
uint8_t dir
led direction
Definition my9221.h:71
gpio_t clk
clock gpio pin
Definition my9221.h:72
Device descriptor for MY9221 LED controller.
Definition my9221.h:79
my9221_params_t params
config parameters
Definition my9221.h:80