I've come up with this, in order to change the color of the LED where my encoder is, based on a CCW/CW spin:
static bool encoder_active = false;
static bool encoder_clockwise = false;
#define ENCODER_LED_INDEX 65
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (last_encoder_activity_elapsed() < 500) {
encoder_active = true;
} else {
encoder_active = false;
}
if (record->event.type == ENCODER_CW_EVENT) {
encoder_clockwise = true;
} else if (record->event.type == ENCODER_CCW_EVENT) {
encoder_clockwise = false;
}
return true;
}
bool rgb_matrix_indicators_user(void) {
if (encoder_active) {
if (encoder_clockwise) {
rgb_matrix_set_color(ENCODER_LED_INDEX, 0, 0xff, 0);
} else {
rgb_matrix_set_color(ENCODER_LED_INDEX, 0xff, 0, 0);
}
}
return true;
}
I was able to figure out the index with some logging and investigation, but this just doesn't seem to be working at all... Anyone see what I'm missing?