bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { if ( record->event.pressed ) { uint8_t led[8], led_count; map_row_column_to_led(record->event.key.row, record->event.key.col, led, &led_count); if (led_count > 0) { for (uint8_t i = LED_HITS_TO_REMEMBER; i > 1; i--) { g_last_led_hit[i - 1] = g_last_led_hit[i - 2]; } g_last_led_hit[0] = led[0]; g_last_led_count = MIN(LED_HITS_TO_REMEMBER, g_last_led_count + 1); } for(uint8_t i = 0; i < led_count; i++) g_key_hit[led[i]] = 0; g_any_key_hit = 0; } else { #ifdef RGB_MATRIX_KEYRELEASES uint8_t led[8], led_count; map_row_column_to_led(record->event.key.row, record->event.key.col, led, &led_count); for(uint8_t i = 0; i < led_count; i++) g_key_hit[led[i]] = 255; g_any_key_hit = 255; #endif } return true; }
// This tests the LEDs // Note that it will change the LED control registers // in the LED drivers, and leave them in an invalid // state for other backlight effects. // ONLY USE THIS FOR TESTING LEDS! void rgb_matrix_single_LED_test(void) { static uint8_t color = 0; // 0,1,2 for R,G,B static uint8_t row = 0; static uint8_t column = 0; static uint8_t tick = 0; tick++; if ( tick > 2 ) { tick = 0; column++; } if ( column > MATRIX_COLS ) { column = 0; row++; } if ( row > MATRIX_ROWS ) { row = 0; color++; } if ( color > 2 ) { color = 0; } uint8_t led[8], led_count; map_row_column_to_led(row,column,led,&led_count); for(uint8_t i = 0; i < led_count; i++) { rgb_matrix_set_color_all( 40, 40, 40 ); rgb_matrix_test_led( led[i], color==0, color==1, color==2 ); } }