summaryrefslogtreecommitdiff
path: root/keyboards/crkbd/keymaps/kidbrazil/layer.c
diff options
context:
space:
mode:
authorLucas Moreira <hello@lucasmoreira.dev>2020-01-25 17:43:57 -0500
committerDrashna Jaelre <drashna@live.com>2020-01-25 14:43:57 -0800
commit9ff61601e31585b924a3b3ff3738a30c520acc65 (patch)
tree12ac9ef5e19011e0902f3db1c1cbf0cd42da8722 /keyboards/crkbd/keymaps/kidbrazil/layer.c
parent09370a95dbc95334fe7335478b108e1a844a2578 (diff)
[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>
Diffstat (limited to 'keyboards/crkbd/keymaps/kidbrazil/layer.c')
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/layer.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/keyboards/crkbd/keymaps/kidbrazil/layer.c b/keyboards/crkbd/keymaps/kidbrazil/layer.c
new file mode 100644
index 0000000000..bd04f3b883
--- /dev/null
+++ b/keyboards/crkbd/keymaps/kidbrazil/layer.c
@@ -0,0 +1,69 @@
+#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);
+ }
+}