diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 7ecf9b5711adbb8ca8f5e8195fb6b1d8ff6a636b..325b80d5d8abf7c5534ab7464f1dda52a75413df 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -84,6 +84,7 @@ typedef _Bool bool; #define API_LEDS_SET_ALL 0x6a #define API_LEDS_SET_ALL_HSV 0x6b #define API_LEDS_SET_GAMMA_TABLE 0x6c +#define API_LEDS_CLEAR_ALL 0x6d #define API_VIBRA_SET 0x70 #define API_VIBRA_VIBRATE 0x71 @@ -648,6 +649,15 @@ API(API_LEDS_SET_GAMMA_TABLE, void epic_leds_set_gamma_table( uint8_t *gamma_table )); +/** + * Set all LEDs to a certain RGB color. + * + * :param uint8_t r: Value for the red color channel. + * :param uint8_t g: Value for the green color channel. + * :param uint8_t b: Value for the blue color channel. + */ +API(API_LEDS_CLEAR_ALL, void epic_leds_clear_all(uint8_t r, uint8_t g, uint8_t b)); + /** * Sensor Data Streams * =================== diff --git a/epicardium/modules/leds.c b/epicardium/modules/leds.c index 0faca35e33fc51b755c6b5e6a920ecfa23697dfc..290fb16d948aec69cc50447dc253d844d9a4f1b8 100644 --- a/epicardium/modules/leds.c +++ b/epicardium/modules/leds.c @@ -87,3 +87,16 @@ void epic_leds_set_gamma_table(uint8_t rgb_channel, uint8_t gamma_table[256]) { leds_set_gamma_table(rgb_channel, gamma_table); } + +void epic_leds_clear_all(uint8_t r, uint8_t g, uint8_t b) +{ + for (int i = 0; i < NUM_LEDS; i++) { + if (i == PERSONAL_STATE_LED && personal_state_enabled) + continue; + + leds_prep(i, r, g, b); + } + + leds_update_power(); + leds_update(); +}