summaryrefslogtreecommitdiff
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
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>
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/config.h99
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/enums.h10
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/keymap.c149
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/layer.c69
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/layer.h9
-rw-r--r--keyboards/crkbd/keymaps/kidbrazil/rules.mk9
6 files changed, 204 insertions, 141 deletions
diff --git a/keyboards/crkbd/keymaps/kidbrazil/config.h b/keyboards/crkbd/keymaps/kidbrazil/config.h
index dd3f1a0307..6dc468c590 100644
--- a/keyboards/crkbd/keymaps/kidbrazil/config.h
+++ b/keyboards/crkbd/keymaps/kidbrazil/config.h
@@ -52,49 +52,64 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#ifdef RGB_MATRIX_ENABLE
-//# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
-// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
-// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
-# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
-// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
-// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
-# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
-# define RGB_MATRIX_HUE_STEP 8
-# define RGB_MATRIX_SAT_STEP 8
-# define RGB_MATRIX_VAL_STEP 8
-# define RGB_MATRIX_SPD_STEP 10
+ //# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
+ // # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
+ // # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
+ #define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+ #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+ // # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
+ // # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
+ #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
+ #define RGB_MATRIX_HUE_STEP 4
+ #define RGB_MATRIX_SAT_STEP 4
+ #define RGB_MATRIX_VAL_STEP 4
+ #define RGB_MATRIX_SPD_STEP 10
-/* Disable the animations you don&#39;t want/need. You will need to disable a good number of these *
- * because they take up a lot of space. Disable until you can successfully compile your firmware. */
-# define DISABLE_RGB_MATRIX_ALPHAS_MODS
-# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
-// # define DISABLE_RGB_MATRIX_BREATHING
-# define DISABLE_RGB_MATRIX_CYCLE_ALL
-# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
-# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
-# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
-# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
-# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
-# define DISABLE_RGB_MATRIX_DUAL_BEACON
-# define DISABLE_RGB_MATRIX_RAINBOW_BEACON
-# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
-# define DISABLE_RGB_MATRIX_RAINDROPS
-# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
-# define DISABLE_RGB_MATRIX_TYPING_HEATMAP
-# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
-# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
-# define DISABLE_RGB_MATRIX_SPLASH
-# define DISABLE_RGB_MATRIX_MULTISPLASH
-# define DISABLE_RGB_MATRIX_SOLID_SPLASH
-# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
+ /* Disable the animations you don&#39;t want/need. You will need to disable a good number of these *
+ * because they take up a lot of space. Disable until you can successfully compile your firmware. */
+ #define DISABLE_RGB_MATRIX_ALPHAS_MODS
+ #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+ #define DISABLE_RGB_MATRIX_BREATHING
+ #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+ #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+ #define DISABLE_RGB_MATRIX_BAND_SAT
+ #define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+ #define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+ #define DISABLE_RGB_MATRIX_BAND_VAL
+ #define DISABLE_RGB_MATRIX_CYCLE_ALL
+ #define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+ #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+ #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+ #define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
+ #define DISABLE_RGB_MATRIX_CYCLE_SPIRAL
+ #define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
+ #define DISABLE_RGB_MATRIX_DUAL_BEACON
+ #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+ #define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+ #define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+ #define DISABLE_RGB_MATRIX_SOLID_SPLASH
+ #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
+ #define DISABLE_RGB_MATRIX_SOLID_SPLASH
+ #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
+ #define DISABLE_RGB_MATRIX_SPLASH
+ #define DISABLE_RGB_MATRIX_MULTISPLASH
+ #define DISABLE_RGB_MATRIX_SPLASH
+ #define DISABLE_RGB_MATRIX_MULTISPLASH
#endif
+// Custom Font path
#define OLED_FONT_H "keyboards/crkbd/keymaps/kidbrazil/glcdfont.c"
#define OLED_DISABLE_TIMEOUT
diff --git a/keyboards/crkbd/keymaps/kidbrazil/enums.h b/keyboards/crkbd/keymaps/kidbrazil/enums.h
new file mode 100644
index 0000000000..ec1a67925f
--- /dev/null
+++ b/keyboards/crkbd/keymaps/kidbrazil/enums.h
@@ -0,0 +1,10 @@
+// [CRKBD layers Init] -------------------------------------------------------//
+typedef enum {
+ _QWERTY,
+ _NUM,
+ _SYM,
+ _GAME,
+ _WEAPON
+}CRKBD_LAYERS;
+
+extern enum CRKBD_LAYERS crkbd_layers;
diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c
index 44142d4f2f..9c950e5373 100644
--- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c
+++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c
@@ -1,4 +1,6 @@
#include QMK_KEYBOARD_H
+#include "enums.h"
+#include "layer.h"
// [Init Variables] ----------------------------------------------------------//
extern uint8_t is_master;
@@ -9,15 +11,6 @@ bool user_led_enabled = true;
// Boolean to store the master LED clear so it only runs once.
bool master_oled_cleared = false;
-// [CRKBD layers Init] -------------------------------------------------------//
-enum crkbd_layers {
- _QWERTY,
- _NUM,
- _SYM,
- _GAME,
- _WEAPON
-};
-
// [Keymaps] -----------------------------------------------------------------//
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
@@ -36,8 +29,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_SYM] = LAYOUT(
KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
- LSFT_T(KC_TAB), RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,
- KC_LCTL, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,
+ LSFT_T(KC_TAB), RGB_TOG, KC_MPLY, KC_MUTE, KC_VOLU, KC_VOLD, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,
+ KC_LCTL, KC_CALC, KC_MYCM, KC_MPRV, KC_MNXT, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,
LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN)
),
@@ -51,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_WEAPON] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEP_RST,
KC_TRNS, KC_TAB, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS
)
};
@@ -61,23 +54,24 @@ void keyboard_post_init_user(void) {
// Set RGB to known state
rgb_matrix_enable_noeeprom();
rgb_matrix_set_color_all(RGB_GREEN);
+ rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
user_led_enabled = true;
-
}
// [Process User Input] ------------------------------------------------------//
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
+ // Handle RGB Changes sans eeprom - necessary due to the layer dependent RGB color
+ // changes in marrix_scan_user
case RGB_TOG:
- if (record->event.pressed) {
- // Toggle matrix on key press
- user_led_enabled ? rgb_matrix_disable_noeeprom() : rgb_matrix_enable_noeeprom();
- } else {
- // Flip User_led_enabled variable on key release
- user_led_enabled = !user_led_enabled;
- }
- return false; // Skip all further processing of this key
+ if (record->event.pressed) {
+ // Toggle matrix on key press
+ user_led_enabled ? rgb_matrix_disable_noeeprom() : rgb_matrix_enable_noeeprom();
+ // Toggle boolean flag
+ user_led_enabled = !user_led_enabled;
+ }
+ return false;
default:
- // Use process_record_keymap to reset timer on all other keypresses
+ // Use process_record_keymap to reset timer on all other keypresses to awaken from idle.
if (record->event.pressed) {
#ifdef OLED_DRIVER_ENABLE
oled_timer = timer_read32();
@@ -91,9 +85,47 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
+// [Matrix Scan] ------------------------------------------------------------//
+void matrix_scan_user(void) {
+ // Iddle timer to return to default layer if left on game layer
+ if (timer_elapsed32(oled_timer) > 380000 && timer_elapsed32(oled_timer) < 479999) {
+ // Reset layer in case it got left on _GAME
+ // This prevents the issue where the master side sometimes wont switch off as expected
+ // in the next step.
+ if (get_highest_layer(layer_state) == _GAME) {
+ layer_off(_GAME);
+ layer_on(_QWERTY);
+ }
+ return;
+ }
+ // Timeout to turn off LEDs
+ else if (timer_elapsed32(oled_timer) > 480000) {
+ rgb_matrix_disable_noeeprom();
+ return;
+ }
+ // Set RGB Matrix color based on layers
+ if (user_led_enabled) {
+ switch (get_highest_layer(layer_state)){
+ case _GAME:
+ rgb_matrix_set_color_all(RGB_PURPLE);
+ break;
+ case _NUM:
+ case _SYM:
+ case _QWERTY:
+ rgb_matrix_set_color_all(RGB_GREEN);
+ break;
+ default:
+ rgb_matrix_set_color_all(RGB_GREEN);
+ break;
+
+ }
+ } else {
+ rgb_matrix_disable_noeeprom();
+ return;
+ }
+}
// [OLED Configuration] ------------------------------------------------------//
#ifdef OLED_DRIVER_ENABLE
-
// Init Oled and Rotate....
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!has_usb())
@@ -105,74 +137,6 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
const char *read_logo(void);
// {OLED helpers} -----------------------------------------------//
-
-// 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);
- }
-}
-
// Render Logo
void render_logo(void) {
oled_write(read_logo(), false);
@@ -209,7 +173,8 @@ void render_slave_oled(void) {
// {OLED Task} -----------------------------------------------//
void oled_task_user(void) {
- if (timer_elapsed32(oled_timer) > 80000 && timer_elapsed32(oled_timer) < 479999) {
+ // First time out switches to logo as first indication of iddle.
+ if (timer_elapsed32(oled_timer) > 100000 && timer_elapsed32(oled_timer) < 479999) {
// Render logo on both halves before full timeout
if (is_master && !master_oled_cleared) {
// Clear master OLED once so the logo renders properly
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);
+ }
+}
diff --git a/keyboards/crkbd/keymaps/kidbrazil/layer.h b/keyboards/crkbd/keymaps/kidbrazil/layer.h
new file mode 100644
index 0000000000..2134e6ddab
--- /dev/null
+++ b/keyboards/crkbd/keymaps/kidbrazil/layer.h
@@ -0,0 +1,9 @@
+// [OLED Helpers] ----------------------------------------------------//
+// Render empty space on OLED
+void render_space(void);
+// Render separator characters for rows
+void render_separator(void);
+// Render layer state
+void render_layer_state(void);
+// Render USB State
+void render_usb_state(void);
diff --git a/keyboards/crkbd/keymaps/kidbrazil/rules.mk b/keyboards/crkbd/keymaps/kidbrazil/rules.mk
index ad03b86bfc..244712cd03 100644
--- a/keyboards/crkbd/keymaps/kidbrazil/rules.mk
+++ b/keyboards/crkbd/keymaps/kidbrazil/rules.mk
@@ -8,10 +8,5 @@ RGB_MATRIX_ENABLE = WS2812
OLED_DRIVER_ENABLE = yes
# If you want to change the display of OLED, you need to change here
-SRC += ./keyboards/crkbd/keymaps/kidbrazil/logo_reader.c \
- #./lib/rgb_state_reader.c \
- #./lib/logo_reader.c \
- #./lib/keylogger.c \
- # ./lib/mode_icon_reader.c \
- # ./lib/host_led_state_reader.c \
- # ./lib/timelogger.c \
+SRC += logo_reader.c \
+ layer.c