Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
hdw-led.h
Go to the documentation of this file.
1
48#ifndef _HDW_LED_H_
49#define _HDW_LED_H_
50
51#include <stdint.h>
52
53#include <esp_err.h>
54#include <soc/gpio_num.h>
55
57#define MAX_LED_BRIGHTNESS 8
58
62typedef struct __attribute__((packed))
63{
64 uint8_t g;
65 uint8_t r;
66 uint8_t b;
67} led_t;
68
69esp_err_t initLeds(gpio_num_t gpio, gpio_num_t gpioAlt, uint8_t brightness);
70esp_err_t deinitLeds(void);
71esp_err_t setLeds(led_t* leds, uint8_t numLeds);
72void setLedBrightness(uint8_t brightness);
73uint8_t getLedState(led_t* leds, uint8_t numLeds);
74void flushLeds(void);
75
76#endif
uint8_t g
The green component, 0-255.
Definition hdw-led.h:64
void setLedBrightness(uint8_t brightness)
Set the global LED brightness. setLedBrightnessSetting() should be called instead if the new volume s...
Definition hdw-led.c:93
void flushLeds(void)
Wait until any pending LED transactions are finished, then return.
Definition hdw-led.c:157
uint8_t b
The blue component, 0-255.
Definition hdw-led.h:66
uint8_t r
The red component, 0-255.
Definition hdw-led.h:65
esp_err_t initLeds(gpio_num_t gpio, gpio_num_t gpioAlt, uint8_t brightness)
Initialize the RGB LEDs.
Definition hdw-led.c:41
uint8_t getLedState(led_t *leds, uint8_t numLeds)
Write the current LED state into the given array.
Definition hdw-led.c:138
esp_err_t setLeds(led_t *leds, uint8_t numLeds)
Set the RGB LEDs to the given values.
Definition hdw-led.c:107
esp_err_t deinitLeds(void)
Deinitialize LEDs.
Definition hdw-led.c:79
LED colors, with red, green, and blue components.
Definition hdw-led.h:63