qmk-keychron-q3-colemak-dh/keyboards/crkbd/keymaps/kidbrazil/layer.c

70 lines
2.1 KiB
C
Raw Normal View History

[Keymap] crkbd/kidbrazil adding layer dependent RGB & better idle timeout. (#7901) * Added KidBrazil custom keymap for CRKBD -Custom Font -Custom OLED output * Added missing readme * Oled Timeout Update for KidBrazil Keymap (#1) * Setup Oled timeout based on simple timer * Cleaned up comments and added timeout for LEDs * Fixed some small errors * Updated oled timout with matrix scan * Updated oled timout with matrix scan * Update withou eeprom * Update timer code * Use process user instead of keymap * Added ifdef to protect oledtimer * Updated with half timeout state for logo * Removed middle tier timer * Final cleanup of unused files * Updated code as per suggestions & requests * Second round of revisions * Updated keymap to better handle LED timeout - Added boolean to hold LED state - Added init function to set rgb to known state - Modified RGB_TOG to work with noeeprom commands * Finished adding the timeout for OLED and testing on CRKBD * Updated documentation * fixed the timeout logic so it works as intended * Added initial limits to color settings * Added layer reset as part of the iddle timeout process * Split Keymap into more manageable files * Finalizing RGB Layer status on CRKBD - Refactored OLED timeout to deal only with oled - If user remains iddle on game layer for too long it will switch to default - LED / OLED iddle working - Minor changes to _SYM layer - Removed some rgb controls from keyboard due to layer dependent RGB colors * Update keyboards/crkbd/keymaps/kidbrazil/keymap.c Used suggestion from Drashna to replace EEPROM_RESET with shorter version. Co-Authored-By: Drashna Jaelre <drashna@live.com> * Update keyboards/crkbd/keymaps/kidbrazil/keymap.c Co-Authored-By: Drashna Jaelre <drashna@live.com> * Implemented drashna's comment Co-authored-by: Drashna Jaelre <drashna@live.com>
2020-01-25 23:43:57 +01:00
#include QMK_KEYBOARD_H
#include "enums.h"
// Render Blank Space
void render_space(void) {
oled_write_ln_P(PSTR(" "), false);
}
// Render separator lines for oled display
void render_separator(void) {
switch (get_highest_layer(layer_state)){
case _GAME:
case _WEAPON:
oled_write_ln_P(PSTR("===================="), false);
break;
default:
oled_write_ln_P(PSTR("++++++++++++++++++++"), false);
}
}
// Render current layer state
void render_layer_state(void){
// If you want to change the display of OLED, you need to change here
switch (get_highest_layer(layer_state)){
case _QWERTY:
oled_write_ln_P(PSTR("| MODE | QWRTY ]"), false);
break;
case _NUM:
oled_write_ln_P(PSTR("| MODE | NUMBERS ]"), false);
break;
case _SYM:
oled_write_ln_P(PSTR("| MODE | SYMBOLS ]"), false);
break;
case _GAME:
oled_write_ln_P(PSTR("| G A M E ]"), false);
break;
case _WEAPON:
oled_write_ln_P(PSTR("| W E A P O N ]"), false);
break;
default:
oled_write_ln_P(PSTR("| MODE | UNDEF ]"), false);
}
}
// Render USB State
void render_usb_state(void) {
switch (USB_DeviceState) {
case DEVICE_STATE_Unattached:
oled_write_ln_P(PSTR("| USB | FREE ]"), false);
break;
case DEVICE_STATE_Suspended:
oled_write_ln_P(PSTR("| USB | SLEEP ]"), false);
break;
case DEVICE_STATE_Configured:
oled_write_ln_P(PSTR("| USB | READY ]"), false);
break;
case DEVICE_STATE_Powered:
oled_write_ln_P(PSTR("| USB | PWRD ]"), false);
break;
case DEVICE_STATE_Default:
oled_write_ln_P(PSTR("| USB | DFLT ]"), false);
break;
case DEVICE_STATE_Addressed:
oled_write_ln_P(PSTR("| USB | ADDRS ]"), false);
break;
default:
oled_write_ln_P(PSTR("| USB | INVALID ]"), false);
}
}