Skip to content

Commit

Permalink
Additional OLED cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna committed Mar 31, 2020
1 parent 46f7cdb commit 68ceb59
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 17 deletions.
51 changes: 38 additions & 13 deletions users/drashna/oled_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static const char PROGMEM code_to_name[0xFF] = {
'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx
};

// clang-format on

void add_keylog(uint16_t keycode) {
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
Expand Down Expand Up @@ -64,7 +64,6 @@ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
return true;
}


void update_log(void) {
if (timer_elapsed(log_timer) > 750) {
// add_keylog(0);
Expand All @@ -79,14 +78,30 @@ void render_keylogger_status(void) {
void render_default_layer_state(void) {
oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
switch (get_highest_layer(default_layer_state)) {
case _QWERTY: oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false); break;
case _COLEMAK: oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false); break;
case _DVORAK: oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); break;
case _WORKMAN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false); break;
case _NORMAN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false); break;
case _MALTRON: oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false); break;
case _EUCALYN: oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false); break;
case _CARPLAX: oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false); break;
case _QWERTY:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false);
break;
case _COLEMAK:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false);
break;
case _DVORAK:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false);
break;
case _WORKMAN:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false);
break;
case _NORMAN:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false);
break;
case _MALTRON:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false);
break;
case _EUCALYN:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false);
break;
case _CARPLAX:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false);
break;
}
#ifdef OLED_DISPLAY_128X64
oled_advance_page(true);
Expand All @@ -95,9 +110,18 @@ void render_default_layer_state(void) {

void render_layer_state(void) {
oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
#ifdef OLED_DISPLAY_128X64
oled_write_P(PSTR(" "), false);
#endif
oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER));
#ifdef OLED_DISPLAY_128X64
oled_write_P(PSTR(" "), false);
#endif
oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
#if _MODS
# ifdef OLED_DISPLAY_128X64
oled_write_P(PSTR(" "), false);
# endif
oled_write_P(PSTR(OLED_RENDER_LAYER_MODS), layer_state_is(_MODS));
#endif
#ifdef OLED_DISPLAY_128X64
Expand Down Expand Up @@ -180,8 +204,8 @@ void render_bootmagic_status(void) {
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_CAPS), keymap_config.swap_control_capslock);
oled_advance_page(true);
#else
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
#else
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
#endif
}

Expand All @@ -199,11 +223,12 @@ void render_user_status(void) {
}

__attribute__((weak)) void oled_driver_render_logo(void) {
// clang-format off
static const char PROGMEM qmk_logo[] = {
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};

// clang-format on
oled_write_P(qmk_logo, false);
}

Expand Down
8 changes: 4 additions & 4 deletions users/drashna/oled_stuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
# define OLED_RENDER_LAYOUT_CARPLAX "Carplax"

# define OLED_RENDER_LAYER_NAME "Layer:\n"
# define OLED_RENDER_LAYER_LOWER " Lower"
# define OLED_RENDER_LAYER_RAISE " Raise"
# define OLED_RENDER_LAYER_ADJUST " Adjust"
# define OLED_RENDER_LAYER_MODS " Mods"
# define OLED_RENDER_LAYER_LOWER "Lower"
# define OLED_RENDER_LAYER_RAISE "Raise"
# define OLED_RENDER_LAYER_ADJUST "Adjust"
# define OLED_RENDER_LAYER_MODS "Mods"

# define OLED_RENDER_LOCK_NAME "Lock: "
# define OLED_RENDER_LOCK_NUML "NUML"
Expand Down

0 comments on commit 68ceb59

Please sign in to comment.