[Keymap] update andrebrait GMMK Pro keymap (#18608)

master
Andre Brait 2022-10-07 20:14:29 +02:00 committed by GitHub
parent 111dcdf713
commit 150572da44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 10 deletions

View File

@ -104,8 +104,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE
#define RGB_CONFIRMATION_BLINKING_TIME 2000 // 2 seconds
/* Renaming those to make the purpose on this keymap clearer */
#define LED_FLAG_CAPS LED_FLAG_NONE
#define LED_FLAG_EFFECTS LED_FLAG_INDICATOR
@ -116,12 +114,18 @@ static uint16_t effect_started_time = 0;
static uint8_t r_effect = 0x0, g_effect = 0x0, b_effect = 0x0;
static void start_effects(void);
/* The higher this is, the slower the blinking will be */
#ifndef TIME_SELECTED_BIT
#define TIME_SELECTED_BIT 8
/* The interval time in ms */
#ifndef EFFECTS_TIME
#define EFFECTS_TIME 2000
#endif
#if TIME_SELECTED_BIT < 0 || TIME_SELECTED_BIT >= 16
#error "TIME_SELECTED_BIT must be a positive integer smaller than 16"
#ifndef EFFECTS_INTERVAL
#define EFFECTS_INTERVAL 250
#endif
#if EFFECTS_TIME <= 0 || EFFECTS_TIME >= 32767
#error "EFFECTS_TIME must be a positive integer smaller than 32767"
#endif
#if EFFECTS_INTERVAL <= 0 || EFFECTS_INTERVAL >= 32767
#error "EFFECTS_INTERVAL must be a positive integer smaller than 32767"
#endif
#define effect_red() r_effect = 0xFF, g_effect = 0x0, b_effect = 0x0
#define effect_green() r_effect = 0x0, g_effect = 0xFF, b_effect = 0x0
@ -257,8 +261,8 @@ bool rgb_matrix_indicators_user(void) {
if (effect_started_time > 0) {
/* Render blinking EFFECTS */
const uint16_t deltaTime = sync_timer_elapsed(effect_started_time);
if (deltaTime <= RGB_CONFIRMATION_BLINKING_TIME) {
const uint8_t led_state = ((~deltaTime) >> TIME_SELECTED_BIT) & 0x01;
if (deltaTime <= EFFECTS_TIME) {
const uint8_t led_state = ((deltaTime / EFFECTS_INTERVAL) + 1) & 0x01;
const uint8_t val_r = led_state * r_effect;
const uint8_t val_g = led_state * g_effect;
const uint8_t val_b = led_state * b_effect;
@ -266,7 +270,7 @@ bool rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds();
}
return;
return false;
} else {
/* EFFECTS duration is finished */
effect_started_time = 0;
@ -316,6 +320,20 @@ static void start_effects() {
// 91, led 08 92, led 19
static void set_rgb_caps_leds() {
rgb_matrix_set_color(0, 0xFF, 0x0, 0x0); // ESC
rgb_matrix_set_color(6, 0xFF, 0x0, 0x0); // F1
rgb_matrix_set_color(12, 0xFF, 0x0, 0x0); // F2
rgb_matrix_set_color(18, 0xFF, 0x0, 0x0); // F3
rgb_matrix_set_color(23, 0xFF, 0x0, 0x0); // F4
rgb_matrix_set_color(28, 0xFF, 0x0, 0x0); // F5
rgb_matrix_set_color(34, 0xFF, 0x0, 0x0); // F6
rgb_matrix_set_color(39, 0xFF, 0x0, 0x0); // F7
rgb_matrix_set_color(44, 0xFF, 0x0, 0x0); // F8
rgb_matrix_set_color(50, 0xFF, 0x0, 0x0); // F9
rgb_matrix_set_color(56, 0xFF, 0x0, 0x0); // F10
rgb_matrix_set_color(61, 0xFF, 0x0, 0x0); // F11
rgb_matrix_set_color(66, 0xFF, 0x0, 0x0); // F12
rgb_matrix_set_color(69, 0xFF, 0x0, 0x0); // Prt
rgb_matrix_set_color(67, 0xFF, 0x0, 0x0); // Left side LED 1
rgb_matrix_set_color(68, 0xFF, 0x0, 0x0); // Right side LED 1
rgb_matrix_set_color(70, 0xFF, 0x0, 0x0); // Left side LED 2