AnnePro2: Adjust RGB flushing (#18640)
This commit is contained in:
parent
86938fd958
commit
85dc473faa
4 changed files with 13 additions and 29 deletions
|
@ -46,7 +46,6 @@ ble_capslock_t ble_capslock = {._dummy = {0}, .caps_lock = false};
|
|||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
static uint8_t led_enabled = 1;
|
||||
static uint8_t current_rgb_row = 0;
|
||||
#endif
|
||||
|
||||
void bootloader_jump(void) {
|
||||
|
@ -125,15 +124,6 @@ void matrix_scan_kb() {
|
|||
proto_consume(&proto, byte);
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
/* If there's data ready to be sent to LED MCU - send it. */
|
||||
if(rgb_row_changed[current_rgb_row])
|
||||
{
|
||||
rgb_row_changed[current_rgb_row] = 0;
|
||||
ap2_led_colors_set_row(current_rgb_row);
|
||||
}
|
||||
current_rgb_row = (current_rgb_row + 1) % NUM_ROW;
|
||||
#endif
|
||||
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
ap2_led_t led_mask[KEY_COUNT];
|
||||
ap2_led_t led_colors[KEY_COUNT];
|
||||
ap2_led_status_t ap2_led_status;
|
||||
uint8_t rgb_row_changed[NUM_ROW];
|
||||
|
||||
void led_command_callback(const message_t *msg) {
|
||||
switch (msg->command) {
|
||||
|
|
|
@ -41,7 +41,6 @@ typedef union {
|
|||
/* Local copy of led_mask, used to override colors on the board */
|
||||
extern ap2_led_t led_mask[KEY_COUNT];
|
||||
extern ap2_led_t led_colors[KEY_COUNT];
|
||||
extern uint8_t rgb_row_changed[NUM_ROW];
|
||||
|
||||
/* Handle incoming messages */
|
||||
extern void led_command_callback(const message_t *msg);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
|
||||
#include "rgb_matrix.h"
|
||||
#include "ap2_led.h"
|
||||
# include "rgb_matrix.h"
|
||||
# include "ap2_led.h"
|
||||
|
||||
uint8_t led_pos[RGB_MATRIX_LED_COUNT];
|
||||
|
||||
|
@ -33,26 +33,22 @@ void init(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void flush(void) {}
|
||||
void flush(void) {
|
||||
for (uint8_t row = 0; row < NUM_ROW; row++)
|
||||
ap2_led_colors_set_row(row);
|
||||
}
|
||||
|
||||
void set_color(int index, uint8_t r, uint8_t g, uint8_t b) {
|
||||
if (r != led_colors[led_pos[index]].p.red ||
|
||||
g != led_colors[led_pos[index]].p.green ||
|
||||
b != led_colors[led_pos[index]].p.blue)
|
||||
{
|
||||
led_colors[led_pos[index]] = (ap2_led_t){
|
||||
.p.blue = b,
|
||||
.p.red = r,
|
||||
.p.green = g,
|
||||
.p.alpha = 0xff,
|
||||
};
|
||||
int row = led_pos[index] / NUM_COLUMN;
|
||||
rgb_row_changed[row] = 1;
|
||||
}
|
||||
led_colors[led_pos[index]] = (ap2_led_t){
|
||||
.p.blue = b,
|
||||
.p.red = r,
|
||||
.p.green = g,
|
||||
.p.alpha = 0xff,
|
||||
};
|
||||
}
|
||||
|
||||
void set_color_all(uint8_t r, uint8_t g, uint8_t b) {
|
||||
for (int i=0; i<RGB_MATRIX_LED_COUNT; i++)
|
||||
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++)
|
||||
set_color(i, r, g, b);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue