[Keymap] All about (ARM) RGB and OLEDs (drashna keymaps) (#7354)

* Add Kyria Keymap

* Enable all RGBLIGHT Animations for ARM and high capacity AVR

* Reduce GNUC version for __has_include

* Cleanup Ortho 4x12 Community layout

* Update Collide 39 keymap

* Cleanup Keymaps

* Enable full 30 LEDs for Ergodox

* Change EEPROM Load timing

* Use RGB Matrix on Planck Rev6

* Use correct keymap swap

* Enable everything for ARM

* Only enable rgb sleep on avr until crash is fixed

* Add additional Kyria keymap config

* Overhaul Kyria OLED display

* Improve kyria keymap based on usage

* Minor tweaks to rules

* Update OLED code to truncate properly

* Fix RGB Light layer indication

* Switch all of biton32 to get_highest_layer function

* Fix OLED Keylogger display

* Run qmk cformat over all of my user files

* Slight tweak to kyria based on usage

* Move around LALT_T config

* Add comments about base wrappers to keymaps

* Another cformat pass

* Temp fix for VUSB boards and NKRO

* Convert tabs to spaces in rules.mk files

* Only enable RGBLight if it's enabled

* Add Encoder Flip setting

* Update OLED font file
This commit is contained in:
Drashna Jaelre 2019-11-20 12:37:24 -08:00 committed by GitHub
parent 8e8986b250
commit eb91c96288
Failed to generate hash of commit
38 changed files with 1503 additions and 596 deletions

View file

@ -12,9 +12,9 @@ void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight
#if defined(RGB_MATRIX_ENABLE)
static uint32_t hypno_timer;
# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_crkbd)
# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
# else
# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
# endif
#endif
@ -23,68 +23,68 @@ static uint32_t hypno_timer;
* This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up.
*/
#ifdef RGBLIGHT_ENABLE
#ifdef INDICATOR_LIGHTS
# ifdef INDICATOR_LIGHTS
void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) {
if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) {
if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) {
if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) {
# ifdef SHFT_LED1
# ifdef SHFT_LED1
rgblight_sethsv_at(120, 255, 255, SHFT_LED1);
# endif // SHFT_LED1
# ifdef SHFT_LED2
# endif // SHFT_LED1
# ifdef SHFT_LED2
rgblight_sethsv_at(120, 255, 255, SHFT_LED2);
# endif // SHFT_LED2
# endif // SHFT_LED2
} else {
# ifdef SHFT_LED1
# ifdef SHFT_LED1
rgblight_sethsv_default_helper(SHFT_LED1);
# endif // SHFT_LED1
# ifdef SHFT_LED2
# endif // SHFT_LED1
# ifdef SHFT_LED2
rgblight_sethsv_default_helper(SHFT_LED2);
# endif // SHFT_LED2
# endif // SHFT_LED2
}
if ((this_mod | this_osm) & MOD_MASK_CTRL) {
# ifdef CTRL_LED1
# ifdef CTRL_LED1
rgblight_sethsv_at(0, 255, 255, CTRL_LED1);
# endif // CTRL_LED1
# ifdef CTRL_LED2
# endif // CTRL_LED1
# ifdef CTRL_LED2
rgblight_sethsv_at(0, 255, 255, CTRL_LED2);
# endif // CTRL_LED2
# endif // CTRL_LED2
} else {
# ifdef CTRL_LED1
# ifdef CTRL_LED1
rgblight_sethsv_default_helper(CTRL_LED1);
# endif // CTRL_LED1
# ifdef CTRL_LED2
# endif // CTRL_LED1
# ifdef CTRL_LED2
rgblight_sethsv_default_helper(CTRL_LED2);
# endif // CTRL_LED2
# endif // CTRL_LED2
}
if ((this_mod | this_osm) & MOD_MASK_GUI) {
# ifdef GUI_LED1
# ifdef GUI_LED1
rgblight_sethsv_at(51, 255, 255, GUI_LED1);
# endif // GUI_LED1
# ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
rgblight_sethsv_at(51, 255, 255, GUI_LED2);
# endif // GUI_LED2
# endif // GUI_LED2
} else {
# ifdef GUI_LED1
# ifdef GUI_LED1
rgblight_sethsv_default_helper(GUI_LED1);
# endif // GUI_LED1
# ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
rgblight_sethsv_default_helper(GUI_LED2);
# endif // GUI_LED2
# endif // GUI_LED2
}
if ((this_mod | this_osm) & MOD_MASK_ALT) {
# ifdef ALT_LED1
# ifdef ALT_LED1
rgblight_sethsv_at(240, 255, 255, ALT_LED1);
# endif // ALT_LED1
# ifdef GUI_LED2
# endif // ALT_LED1
# ifdef GUI_LED2
rgblight_sethsv_at(240, 255, 255, ALT_LED2);
# endif // GUI_LED2
# endif // GUI_LED2
} else {
# ifdef GUI_LED1
# ifdef GUI_LED1
rgblight_sethsv_default_helper(ALT_LED1);
# endif // GUI_LED1
# ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
rgblight_sethsv_default_helper(ALT_LED2);
# endif // GUI_LED2
# endif // GUI_LED2
}
}
}
@ -95,9 +95,9 @@ void matrix_scan_indicator(void) {
set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods());
}
}
#endif // INDICATOR_LIGHTS
# endif // INDICATOR_LIGHTS
#ifdef RGBLIGHT_TWINKLE
# ifdef RGBLIGHT_TWINKLE
static rgblight_fadeout lights[RGBLED_NUM];
__attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; }
@ -105,40 +105,40 @@ __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) {
/* This function checks for used LEDs. This way, collisions don't occur and cause weird rendering */
bool rgblight_twinkle_is_led_used(uint8_t index) {
switch (index) {
# ifdef INDICATOR_LIGHTS
# ifdef SHFT_LED1
# ifdef INDICATOR_LIGHTS
# ifdef SHFT_LED1
case SHFT_LED1:
return true;
# endif // SHFT_LED1
# ifdef SHFT_LED2
# endif // SHFT_LED1
# ifdef SHFT_LED2
case SHFT_LED2:
return true;
# endif // SHFT_LED2
# ifdef CTRL_LED1
# endif // SHFT_LED2
# ifdef CTRL_LED1
case CTRL_LED1:
return true;
# endif // CTRL_LED1
# ifdef CTRL_LED2
# endif // CTRL_LED1
# ifdef CTRL_LED2
case CTRL_LED2:
return true;
# endif // CTRL_LED2
# ifdef GUI_LED1
# endif // CTRL_LED2
# ifdef GUI_LED1
case GUI_LED1:
return true;
# endif // GUI_LED1
# ifdef GUI_LED2
# endif // GUI_LED1
# ifdef GUI_LED2
case GUI_LED2:
return true;
# endif // GUI_LED2
# ifdef ALT_LED1
# endif // GUI_LED2
# ifdef ALT_LED1
case ALT_LED1:
return true;
# endif // ALT_LED1
# ifdef ALT_LED2
# endif // ALT_LED1
# ifdef ALT_LED2
case ALT_LED2:
return true;
# endif // ALT_LED2
# endif // INDICATOR_LIGHTS
# endif // ALT_LED2
# endif // INDICATOR_LIGHTS
default:
return rgblight_twinkle_is_led_used_keymap(index);
}
@ -154,19 +154,19 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rg
if (light->life) {
light->life -= 1;
if (biton32(layer_state) == 0) {
if (get_highest_layer(layer_state) == 0) {
sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
}
light->timer = timer_read();
} else {
if (light->enabled && biton32(layer_state) == 0) {
if (light->enabled && get_highest_layer(layer_state) == 0) {
rgblight_sethsv_default_helper(light_index);
}
litup = light->enabled = false;
}
}
}
if (litup && biton32(layer_state) == 0) {
if (litup && get_highest_layer(layer_state) == 0) {
rgblight_set();
}
}
@ -211,8 +211,8 @@ void start_rgb_light(void) {
rgblight_sethsv_at(light->hue, 255, light->life, light_index);
}
#endif
#endif // RGBLIGHT_ENABLE
# endif
#endif // RGBLIGHT_ENABLE
bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
uint16_t temp_keycode = keycode;
@ -259,7 +259,9 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
userspace_config.rgb_matrix_idle_anim ^= 1;
dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
eeconfig_update_user(userspace_config.raw);
if (userspace_config.rgb_matrix_idle_anim) { rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); }
if (userspace_config.rgb_matrix_idle_anim) {
rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
}
}
#endif
break;
@ -281,7 +283,9 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
is_eeprom_updated = true;
}
#endif
if (is_eeprom_updated) { eeconfig_update_user(userspace_config.raw); }
if (is_eeprom_updated) {
eeconfig_update_user(userspace_config.raw);
}
}
break;
}
@ -290,7 +294,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
void keyboard_post_init_rgb(void) {
#if defined(RGBLIGHT_ENABLE)
# if defined(RGBLIGHT_STARTUP_ANIMATION)
# if defined(RGBLIGHT_STARTUP_ANIMATION)
bool is_enabled = rgblight_config.enable;
if (userspace_config.rgb_layer_change) {
rgblight_enable_noeeprom();
@ -309,13 +313,13 @@ void keyboard_post_init_rgb(void) {
rgblight_disable_noeeprom();
}
# endif
# endif
layer_state_set_user(layer_state);
#endif
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
if (userspace_config.rgb_matrix_idle_anim) {
rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
}
if (userspace_config.rgb_matrix_idle_anim) {
rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
}
#endif
}
@ -337,67 +341,70 @@ void matrix_scan_rgb(void) {
#endif
}
#ifdef RGBLIGHT_ENABLE
void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
rgblight_sethsv_noeeprom(hue, sat, val);
wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
rgblight_mode_noeeprom(mode);
}
#endif
layer_state_t layer_state_set_rgb(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE
if (userspace_config.rgb_layer_change) {
switch (biton32(state)) {
switch (get_highest_layer(state)) {
case _MACROS:
rgblight_sethsv_noeeprom_orange();
userspace_config.is_overwatch ? rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2) : rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 3);
rgblight_set_hsv_and_mode(HSV_ORANGE, userspace_config.is_overwatch ? RGBLIGHT_MODE_SNAKE + 2 : RGBLIGHT_MODE_SNAKE + 3);
break;
case _MEDIA:
rgblight_sethsv_noeeprom_chartreuse();
rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 1);
rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1);
break;
case _GAMEPAD:
rgblight_sethsv_noeeprom_orange();
rgblight_mode_noeeprom(RGBLIGHT_MODE_SNAKE + 2);
rgblight_set_hsv_and_mode(HSV_ORANGE, RGBLIGHT_MODE_SNAKE + 2);
break;
case _DIABLO:
rgblight_sethsv_noeeprom_red();
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3);
rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3);
break;
case _RAISE:
rgblight_sethsv_noeeprom_yellow();
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3);
rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_BREATHING + 3);
break;
case _LOWER:
rgblight_sethsv_noeeprom_green();
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3);
rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3);
break;
case _ADJUST:
rgblight_sethsv_noeeprom_red();
rgblight_mode_noeeprom(RGBLIGHT_MODE_KNIGHT + 2);
rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2);
break;
default: // for any other layers, or the default layer
switch (biton32(default_layer_state)) {
{
uint8_t mode = get_highest_layer(state) == _MODS ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT;
switch (get_highest_layer(default_layer_state)) {
case _COLEMAK:
rgblight_sethsv_noeeprom_magenta();
rgblight_set_hsv_and_mode(HSV_MAGENTA, mode);
break;
case _DVORAK:
rgblight_sethsv_noeeprom_springgreen();
rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode);
break;
case _WORKMAN:
rgblight_sethsv_noeeprom_goldenrod();
rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode);
break;
case _NORMAN:
rgblight_sethsv_noeeprom_coral();
rgblight_set_hsv_and_mode(HSV_CORAL, mode);
break;
case _MALTRON:
rgblight_sethsv_noeeprom_yellow();
rgblight_set_hsv_and_mode(HSV_YELLOW, mode);
break;
case _EUCALYN:
rgblight_sethsv_noeeprom_pink();
rgblight_set_hsv_and_mode(HSV_PINK, mode);
break;
case _CARPLAX:
rgblight_sethsv_noeeprom_blue();
rgblight_set_hsv_and_mode(HSV_BLUE, mode);
break;
default:
rgblight_sethsv_noeeprom_cyan();
rgblight_set_hsv_and_mode(HSV_CYAN, mode);
break;
}
biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it
break;
}
}
}
#endif // RGBLIGHT_ENABLE
@ -408,6 +415,7 @@ layer_state_t layer_state_set_rgb(layer_state_t state) {
#ifdef RGB_MATRIX_ENABLE
# include "lib/lib8tion/lib8tion.h"
extern led_config_t g_led_config;
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) {
HSV hsv = {hue, sat, val};
if (hsv.v > rgb_matrix_config.hsv.v) {