diff options
author | Eric Gebhart <e.a.gebhart@gmail.com> | 2022-11-12 00:09:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 23:09:41 +0000 |
commit | 050472a4d07d07c1d9ae17d2fd26d44e9d95d950 (patch) | |
tree | 8c326011ec8cac395a92839ec4b420bf12652fa1 /users/ericgebhart/oled | |
parent | 49a78b81145213e2883e6c3beab6d9c136c10085 (diff) |
Eric Gebhart user space and keymaps (#17487)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users/ericgebhart/oled')
-rw-r--r-- | users/ericgebhart/oled/oled_cartes.c | 325 | ||||
-rw-r--r-- | users/ericgebhart/oled/oled_layers.c | 252 | ||||
-rwxr-xr-x | users/ericgebhart/oled/oled_stuff.c | 192 | ||||
-rwxr-xr-x | users/ericgebhart/oled/oled_stuff.h | 61 |
4 files changed, 830 insertions, 0 deletions
diff --git a/users/ericgebhart/oled/oled_cartes.c b/users/ericgebhart/oled/oled_cartes.c new file mode 100644 index 0000000000..8ab88e969e --- /dev/null +++ b/users/ericgebhart/oled/oled_cartes.c @@ -0,0 +1,325 @@ +/* + Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifdef OLED_CUSTOM_ENABLE + +#include "ericgebhart.h" + +void oled_render_layer_map(void) { + uint8_t lyr = get_highest_layer(layer_state); + if (lyr < _LAYERS) { + switch (get_highest_layer(default_layer_state)) { + +#ifdef QWERTY_LAYER_ENABLE + SHOW_MAP(_QWERTY) +#endif + +#ifdef COLEMAK_DH_LAYER_ENABLE + SHOW_MAP(_COLEMAK_DH) +#endif + +#ifdef COLEMAK_LAYER_ENABLE + SHOW_MAP(_COLEMAK) +#endif +#ifdef HALMAK_LAYER_ENABLE + SHOW_MAP(_HALMAK) +#endif +#ifdef MINIMAK_LAYER_ENABLE + SHOW_MAP(_MINIMAK) +#endif +#ifdef MINIMAK_8_LAYER_ENABLE + SHOW_MAP(_MINIMAK_8) +#endif +#ifdef MINIMAK_12_LAYER_ENABLE + SHOW_MAP(_MINIMAK_12) +#endif + +#ifdef DVORAK_LAYER_ENABLE + SHOW_MAP(_DVORAK) +#endif +#ifdef DVORAK_RLC_IU_LAYER_ENABLE + SHOW_MAP(_DVORAK_RLC_IU) +#endif +#ifdef BOO_LAYER_ENABLE + SHOW_MAP(_BOO) +#endif +#ifdef CAPEWELL_DVORAK_LAYER_ENABLE + SHOW_MAP(_CAPEWELL_DVORAK) +#endif +#ifdef AHEI_LAYER_ENABLE + SHOW_MAP(_AHEI) +#endif + +#ifdef BEAKL27_LAYER_ENABLE + SHOW_MAP(_BEAKL27) +#endif + +#ifdef BEAKL15_LAYER_ENABLE + SHOW_MAP(_BEAKL15) +#endif + +#ifdef BEAKL19_LAYER_ENABLE + SHOW_MAP(_BEAKL19) +#endif + +#ifdef BEAKLWI_LAYER_ENABLE + SHOW_MAP(_BEAKLWI) +#endif + +#ifdef CARPALX_QFMLWY_LAYER_ENABLE + SHOW_MAP(_CARPALX_QFMLWY) +#endif + +#ifdef CARPALX_QGMLWB_LAYER_ENABLE + SHOW_MAP(_CARPALX_QGMLWB) +#endif + +#ifdef CARPALX_QGMLWY_LAYER_ENABLE + SHOW_MAP(_CARPALX_QGMLWY) +#endif + +#ifdef MTGAP_LAYER_ENABLE + SHOW_MAP(_MTGAP) +#endif + +#ifdef CTGAP_LAYER_ENABLE + SHOW_MAP(_CTGAP) +#endif + +#ifdef APT_LAYER_ENABLE + SHOW_MAP(_APT) +#endif + +#ifdef CANARY_LAYER_ENABLE + SHOW_MAP(_CANARY) +#endif + + +#ifdef HD_NEU_LAYER_ENABLE + SHOW_MAP(_HD_NEU) +#endif + +#ifdef HD_NEU_NARROW_LAYER_ENABLE + SHOW_MAP(_HD_NEU_NARROW) +#endif + +#ifdef HD_TITANIUM_LAYER_ENABLE + SHOW_MAP(_HD_TITANIUM) +#endif + +#ifdef HD_GOLD_LAYER_ENABLE + SHOW_MAP(_HD_GOLD) +#endif + +#ifdef HD_PLATINUM_LAYER_ENABLE + SHOW_MAP(_HD_PLATINUM) +#endif + +#ifdef HD_SILVER_LAYER_ENABLE + SHOW_MAP(_HD_SILVER) +#endif + +#ifdef HD_BRONZE_LAYER_ENABLE + SHOW_MAP(_HD_BRONZE) +#endif + +#ifdef HD_ELAN_LAYER_ENABLE + SHOW_MAP(_HD_ELAN) +#endif + +#ifdef HD_DASH_LAYER_ENABLE + SHOW_MAP(_HD_DASH) +#endif + +#ifdef HD_REF_LAYER_ENABLE + SHOW_MAP(_HD_REF) +#endif + +#ifdef RSTHD_LAYER_ENABLE + SHOW_MAP(_RSTHD) +#endif + +#ifdef HANDS_UP_LAYER_ENABLE + SHOW_MAP(_HANDS_UP) +#endif +#ifdef WHITE_LAYER_ENABLE + SHOW_MAP(_WHITE) +#endif +#ifdef ISRT_LAYER_ENABLE + SHOW_MAP(_ISRT) +#endif +#ifdef SOUL_LAYER_ENABLE + SHOW_MAP(_SOUL) +#endif +#ifdef NIRO_LAYER_ENABLE + SHOW_MAP(_NIRO) +#endif +#ifdef ASSET_LAYER_ENABLE + SHOW_MAP(_ASSET) +#endif +#ifdef WHORF_LAYER_ENABLE + SHOW_MAP(_WHORF) +#endif +#ifdef WHORF6_LAYER_ENABLE + SHOW_MAP(_WHORF6) +#endif + +#ifdef BEPO_LAYER_ENABLE + SHOW_MAP(_BEPO) +#endif + +#ifdef OPTIMOT_LAYER_ENABLE + SHOW_MAP(_OPTIMOT) +#endif + +#ifdef OPTIMOT_COMPACT_LAYER_ENABLE + SHOW_MAP(_OPTIMOT_COMPACT) +#endif + +#ifdef BEAKL19bis_LAYER_ENABLE + SHOW_MAP(_BEAKL19bis) +#endif + + } + + } else { + + switch (lyr) { +#ifdef TOPROWS_LAYER_ENABLE + LCASE(_TOPROWS) +# ifdef TOPROWS_BKL_NUMS +# ifdef TOPROWS_MOD + CARTE_TOPROWS_MOD +# else +# ifdef TOPROWS_BKL_19_NUMS + CARTE_TOPROWS_BKL19 +# else + CARTE_TOPROWS +# endif +# endif +# else // not beakl nums. + CARTE_RAISE +# endif + break; +#endif + + + case _NAV: +#ifdef NAV_FULL_LOCK_MODS + CARTE_NAVA +#endif +#ifdef NAV_FULL + CARTE_NAV +#endif +#ifdef NAV_NO_MOUSE + CARTE_NAVnm +#endif +#ifdef NAV_MIRYOKU + CARTE_NAV_miryoku +#endif + break; + +#ifdef MOUSE_LAYER_ENABLE + case _NAVm: +# ifdef NAV_MOUSE_MIRYOKU + CARTE_NAVm_miryoku +# else + CARTE_NAVm +# endif + break; +#endif + +#ifdef MEDIA_LAYER_ENABLE + SHOW_MAP_S(_MEDIA) +#endif + SHOW_MAP_S(_LAYERS) + +#ifdef SYMBOL_LAYER_ENABLE + LCASE(_SYMB) +# ifdef SYMBOL_BEAKL + CARTE_SYMB_BEAKL +# endif +# ifdef SYMBOL_BEAKL_EXT + CARTE_SYMB_BEAKLA +# endif +# ifdef SYMBOL_BEAKL_EXT_VI + CARTE_SYMB_BEAKLB +# endif +# ifdef SYMBOL_BEAKL_C + CARTE_SYMB_BEAKLC +# endif +# ifdef SYMBOL_MIRYOKU + CARTE_SYMB_MIRYOKU +# endif +# ifdef SYMBOL_BEAKL_WI + CARTE_SYMB_BEAKL_WI +# endif +# ifdef SYMBOL_BEAKL_WI + CARTE_SYMB_NEO +# endif + break; +#endif + +#ifdef KEYAD_LAYER_ENABLE + LCASE(_KEYPAD) +#ifdef KEYPAD_BEAKL +#ifdef KEYPAD_BEAKL_WI + CARTE_KP_BKL_WI +#endif +#ifdef KEYPAD_MODS + CARTE_KP_BKL_MODS +#endif +#if !defined(KEYPAD_MODS) && !defined(KEYPAD_BEAKL_WI) + CARTE_KP_BKL_FUNC +#endif +#ifdef KEYPAD_MIRYOKU + CARTE_KP_MIRYOKU +#endif + +#else // not beakl. +#ifdef KEYPAD_RIGHT +#ifdef KEYPAD_MODS + CARTE_MODS_KP +#else + CARTE_FP_KP +#endif + +#else // not keypad right. +#ifdef KEYPAD_MODS + CARTE_KP_MODS +#else + CARTE_KP_FP // the final default. +#endif +#endif // end not keypad right. +#endif // end not beakl + break; +#endif // end keypad. + +#ifdef MORTE_LAYER_ENABLE + SHOW_MAP(_MORTE) +#endif + +#ifdef ACCENTS_MORTE_LAYER_ENABLE + SHOW_MAP(_ACCENTS_MORTE) +#endif + +#ifdef ACCENTS_LAYER_ENABLE + SHOW_MAP(_CARTE_ACCENTS) +#endif + } + } +} +#endif diff --git a/users/ericgebhart/oled/oled_layers.c b/users/ericgebhart/oled/oled_layers.c new file mode 100644 index 0000000000..57424d1d6c --- /dev/null +++ b/users/ericgebhart/oled/oled_layers.c @@ -0,0 +1,252 @@ +/* + Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include "ericgebhart.h" +#include <stdio.h> + +#ifdef OLED_CUSTOM_ENABLE + +void oled_render_default_layer_state(void) { + //oled_write_P(PSTR("Layout: "), false); + uint16_t layer = get_highest_layer(default_layer_state); + char layer_str[8]; + snprintf(layer_str, sizeof(layer_str), "%u ",layer); + oled_write(layer_str , false); + switch (layer) { +#ifdef DVORAK_LAYER_ENABLE + WRITE_STR_LAYER(_DVORAK, "Dvorak") +#endif +#ifdef DVORAK_RLC_IU_LAYER_ENABLE + WRITE_STR_LAYER(_DVORAK_RLC_IU_, "Dvorak-rlc") +#endif +#ifdef BOO_LAYER_ENABLE + WRITE_STR_LAYER(_BOO, "Boo") +#endif +#ifdef CAPEWELL_DVORAK_LAYER_ENABLE + WRITE_STR_LAYER(_CAPEWELL_DVORAK, "Capewell Dvorak") +#endif +#ifdef AHEI_LAYER_ENABLE + WRITE_STR_LAYER(_AHEI, "Ahei") +#endif + +#ifdef QWERTY_LAYER_ENABLE + WRITE_STR_LAYER(_QWERTY, "Qwerty") +#endif +#ifdef WORKMAN_LAYER_ENABLE + WRITE_STR_LAYER(_WORKMAN, "Workman") +#endif +#ifdef NORMAN_LAYER_ENABLE + WRITE_STR_LAYER(_NORMAN, "Norman") +#endif + +#ifdef COLEMAK_LAYER_ENABLE + WRITE_STR_LAYER(_COLEMAK, "Colemak") +#endif +#ifdef COLEMAK_DH_LAYER_ENABLE + WRITE_STR_LAYER(_COLEMAK_DH, "Colemak") +#endif +#ifdef HALMAK_LAYER_ENABLE + WRITE_STR_LAYER(_HALMAK, "Halmak") +#endif +#ifdef MINIMAK_LAYER_ENABLE + WRITE_STR_LAYER(_MINIMAK, "Minimak") +#endif +#ifdef MINIMAK_8_LAYER_ENABLE + WRITE_STR_LAYER(_MINIMAK_8, "Minimak 8") +#endif +#ifdef MINIMAK_12_LAYER_ENABLE + WRITE_STR_LAYER(_MINIMAK_12, "Minimak 12") +#endif + +#ifdef BEAKL15_LAYER_ENABLE + WRITE_STR_LAYER(_BEAKL15, "Beakl") +#endif +#ifdef BEAKL19_LAYER_ENABLE + WRITE_STR_LAYER(_BEAKL19, "Beakl19") +#endif +#ifdef BEAKL27_LAYER_ENABLE + WRITE_STR_LAYER(_BEAKL27, "Beakl27") +#endif +#ifdef BEAKLWI_LAYER_ENABLE + WRITE_STR_LAYER(_BEAKLWI, "BeaklWi") +#endif + +#ifdef CARPALX_QFMLWY_LAYER_ENABLE + WRITE_STR_LAYER(_CARPALX_QFMLWY, "Carpalx qfmlwy") +#endif + +#ifdef CARPALX_QGMLWB_LAYER_ENABLE + WRITE_STR_LAYER(_CARPALX_QGMLWB, "Carpalx qgmlwb") +#endif + +#ifdef CARPALX_QGMLWY_LAYER_ENABLE + WRITE_STR_LAYER(_CARPALX_QGMLWY, "Carpalx qgmlwy") +#endif + +#ifdef HD_NEU_LAYER_ENABLE + WRITE_STR_LAYER(_HD_NEU, "HD Neu") +#endif +#ifdef HD_NEU_NARROW_LAYER_ENABLE + WRITE_STR_LAYER(_HD_NEU_NARROW, "HD Neu N") +#endif +#ifdef HD_TITANIUM_LAYER_ENABLE + WRITE_STR_LAYER(_HD_TITANIUM, "HD Titanium") +#endif +#ifdef HD_GOLD_LAYER_ENABLE + WRITE_STR_LAYER(_HD_GOLD, "HD Gold") +#endif +#ifdef HD_SILVER_LAYER_ENABLE + WRITE_STR_LAYER(_HD_SILVER, "HD Silver") +#endif +#ifdef HD_PLATINUM_LAYER_ENABLE + WRITE_STR_LAYER(_HD_PLATINUM, "HD Platinum") +#endif +#ifdef HD_BRONZE_LAYER_ENABLE + WRITE_STR_LAYER(_HD_BRONZE, "HD Bronze") +#endif +#ifdef HD_ELAN_LAYER_ENABLE + WRITE_STR_LAYER(_HD_ELAN, "HD Elan") +#endif +#ifdef HD_DASH_LAYER_ENABLE + WRITE_STR_LAYER(_HD_DASH, "HD Dash") +#endif +#ifdef HD_REF_LAYER_ENABLE + WRITE_STR_LAYER(_HD_REF, "HD Ref") +#endif + +#ifdef MTGAP_LAYER_ENABLE + WRITE_STR_LAYER(_MTGAP, "Mtgap") +#endif +#ifdef CTGAP_LAYER_ENABLE + WRITE_STR_LAYER(_CTGAP, "Ctgap") +#endif +#ifdef APT_LAYER_ENABLE + WRITE_STR_LAYER(_APT, "Apt") +#endif +#ifdef CANARY_LAYER_ENABLE + WRITE_STR_LAYER(_CANARY, "Canary") +#endif + +#ifdef MALTRON_LAYER_ENABLE + WRITE_STR_LAYER(_MALTRON, "Maltron") +#endif +#ifdef EUCALYN_LAYER_ENABLE + WRITE_STR_LAYER(_EUCALYN, "Eucalyn") +#endif +#ifdef RSTHD_LAYER_ENABLE + WRITE_STR_LAYER(_RSTHD, "Rsthd") +#endif +#ifdef HAND_UP_LAYER_ENABLE + WRITE_STR_LAYER(_HANDS_UP, "Hands up") +#endif +#ifdef WHITE_LAYER_ENABLE + WRITE_STR_LAYER(_WHITE, "White") +#endif +#ifdef ISRT_LAYER_ENABLE + WRITE_STR_LAYER(_ISRT, "Isrt") +#endif +#ifdef SOUL_LAYER_ENABLE + WRITE_STR_LAYER(_SOUL, "Soul") +#endif +#ifdef NIRO_LAYER_ENABLE + WRITE_STR_LAYER(_NIRO, "Niro") +#endif +#ifdef ASSET_LAYER_ENABLE + WRITE_STR_LAYER(_ASSET, "Asset") +#endif +#ifdef WHORF_LAYER_ENABLE + WRITE_STR_LAYER(_WHORF, "Whorf") +#endif +#ifdef WHORF6_LAYER_ENABLE + WRITE_STR_LAYER(_WHORF6, "Whorf 6") +#endif + +#ifdef OPTIMOT_LAYER_ENABLE + WRITE_STR_LAYER(_OPTIMOT, "Optimot") +#endif +#ifdef OPTIMOT_COMPACT_LAYER_ENABLE + WRITE_STR_LAYER(_OPTIMOT_COMPACT, "Optimot") +#endif +#ifdef BEAKL19bis_LAYER_ENABLE + WRITE_STR_LAYER(_BEAKL19bis, "Beakl19bis") +#endif +#ifdef BEPO_LAYER_ENABLE // Bepo only works on bepo. + WRITE_STR_LAYER(_BEPO, "Bepo") +#endif + } +} + +void oled_render_layer_state(void) { + uint16_t layer = get_highest_layer(layer_state); + char layer_str[8]; + snprintf(layer_str, sizeof(layer_str), "%u ",layer); + oled_write_P(PSTR(""), false); + if (layer > 0) + oled_write(layer_str , false); + + switch (layer) { + // language variant layers. +#ifdef TOPROWS_LAYER_ENABLE + WRITE_STR_LAYER(_TOPROWS, "TopRows"); +#endif + +#ifdef SYMBOL_LAYER_ENABLE + WRITE_STR_LAYER(_SYMB, "Symbols"); +#endif + +#ifdef KEYPAD_LAYER_ENABLE + WRITE_STR_LAYER(_KEYPAD, "Keypad"); +#endif + + // single case, BP or no suffix. +#ifdef ACCENTS_MORTE_LAYER_ENABLE + WRITE_STR_LAYER(_ACCENTS_MORTE, "Accents Morte"); +#endif +#ifdef ACCENTS_LAYER_ENABLE + WRITE_STR_LAYER(_ACCENTS, "Accents"); +#endif +#ifdef MORTE_LAYER_ENABLE + WRITE_STR_LAYER(_MORTE, "Morte"); +#endif + + + // language agnostic layers. +#ifdef NAV_LAYER_ENABLE + WRITE_STR_CASE(_NAV, "Navigation"); + WRITE_STR_CASE(_NAVm, "Mouse"); +#endif +#ifdef MEDIA_LAYER_ENABLE + WRITE_STR_CASE(_MEDIA, "Media"); +#endif +#ifdef FUNC_LAYER_ENABLE + WRITE_STR_CASE(_FUN, "Func"); +#endif + + WRITE_STR_CASE(_LAYERS, "Layers"); + +#ifdef RGB_LAYER_ENABLE + WRITE_STR_CASE(_RGB, "RGB"); +#endif +#ifdef ADJUST_LAYER_ENABLE + WRITE_STR_CASE(_ADJUST, "Adjust"); +#endif +#ifdef COMBO_REF_LAYER_ENABLE + WRITE_STR_CASE(_COMBO_REF, "COMBO Ref"); +#endif + + } +} +#endif diff --git a/users/ericgebhart/oled/oled_stuff.c b/users/ericgebhart/oled/oled_stuff.c new file mode 100755 index 0000000000..a73b5b174d --- /dev/null +++ b/users/ericgebhart/oled/oled_stuff.c @@ -0,0 +1,192 @@ +/* + Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include "ericgebhart.h" +#include <string.h> +#include <stdio.h> + +#ifdef OLED_CUSTOM_ENABLE + +extern uint32_t current_locale; + +void oled_render_locale(void) { + // oled_write_P(PSTR("Layout: "), false); + switch (current_locale) { + WRITE_STR_CASE(LOCALE_DEFAULT, DEFAULT_LANG_NAME) +#ifdef SECOND_LOCALE + WRITE_STR_CASE(LOCALE_TWO, SECOND_LOCALE_NAME) +#endif + } +} + +void oled_render_keylock_status(uint8_t led_usb_state) { + oled_write_P(PSTR(" Lock:"), false); + oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK)); + oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK)); + oled_write_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); +} + +void oled_render_mod_status(uint8_t modifiers) { + oled_write_P(PSTR("Mods:"), false); + oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT)); + oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL)); + oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT)); + oled_write_P(PSTR("G"), (modifiers & MOD_MASK_GUI)); +} + +void oled_render_mod_lock_status(){ + oled_render_mod_status(get_mods() | get_oneshot_mods()); + oled_render_keylock_status(host_keyboard_leds()); +} + + +#ifdef KEYLOGGER_ENABLE +char mkeylog_str[22] = {}; + +const char mcode_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', + '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; + + +void oled_render_keylog(void) { + oled_write_ln(mkeylog_str, false); +} + + +void add_keylog(uint16_t keycode, keyrecord_t *record) { + char name = ' '; + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || + (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { + keycode = keycode & 0xFF; + } + if (keycode < 60) { + name = mcode_to_name[keycode]; + } + + // update keylog + memset(mkeylog_str, ' ', sizeof(mkeylog_str) - 1); + snprintf(mkeylog_str, sizeof(mkeylog_str), "%dx%d, k%2d : %c", + record->event.key.row, record->event.key.col, + keycode, name); +} +#endif + +__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; } + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + + // for the big screen. +#ifdef OLED_DISPLAY_128X64 + return OLED_ROTATION_180; +#endif + // rotate the slave side of the corne to be bottom side in. + if (!is_keyboard_master()) { + return OLED_ROTATION_180; + } + + return oled_init_keymap(rotation); +} + +/* oled_rotation_t oled_init_user(oled_rotation_t rotation) { */ +/* memset(mkeylog_str, ' ', sizeof(mkeylog_str) - 1); */ +/* if (is_keyboard_master()) { */ +/* return OLED_ROTATION_270; */ +/* } else { */ +/* return OLED_ROTATION_180; */ +/* } */ +/* } */ + + +void render_bootmagic_status(bool status) { + /* Show Ctrl-Gui Swap options */ + static const char PROGMEM logo[][2][3] = { + {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, + {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, + }; + if (status) { + oled_write_ln_P(logo[0][0], false); + oled_write_ln_P(logo[0][1], false); + } else { + oled_write_ln_P(logo[1][0], false); + oled_write_ln_P(logo[1][1], false); + } +} + + +__attribute__((weak)) void oled_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); +} + + +bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { +#ifdef KEYLOGGER_ENABLE + if (record->event.pressed) { + //oled_timer = timer_read32(); + add_keylog(keycode, record); + //add_keylog(keycode); + } +#endif + return true; +} + +bool oled_task_user(void) { + //oled_clear(); + if (is_keyboard_master()) { + oled_render_mod_lock_status(); + oled_advance_page(false); + oled_render_default_layer_state(); + oled_render_locale(); + oled_write_ln_P(PSTR(" "), false); + oled_render_layer_state(); + oled_write_ln_P(PSTR(" "), false); +#ifdef OLED_DISPLAY_128X64 + oled_render_layer_map(); +#endif +#ifdef KEYLOGGER_ENABLE + oled_render_keylog(); +#endif + + // slave side display. + } else { + oled_clear(); +#ifdef OLED_LOGO_ENABLE + oled_render_logo(); +#endif + oled_render_default_layer_state(); + oled_render_locale(); + oled_write_ln_P(PSTR(" "), false); +#ifdef SPLIT_LAYER_STATE_ENABLE + oled_render_layer_state(); + oled_render_layer_map(); +#endif + } + return(false); + +} +#endif + +/* oled_render_keylock_status(host_keyboard_leds()); */ +/* oled_render_mod_status(get_mods() | get_oneshot_mods()); */ diff --git a/users/ericgebhart/oled/oled_stuff.h b/users/ericgebhart/oled/oled_stuff.h new file mode 100755 index 0000000000..7824ec7d84 --- /dev/null +++ b/users/ericgebhart/oled/oled_stuff.h @@ -0,0 +1,61 @@ +#pragma once +/* + Copyright 2018-2022 Eric Gebhart <e.a.gebhart@gmail.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifdef OLED_CUSTOM_ENABLE + +#include "quantum.h" +//#include "oled_driver.h" + +void oled_render_mod_lock_status(void); +void oled_driver_render_logo(void); +bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); +void oled_render_layer_map(void); +void oled_render_default_layer_state(void); +void oled_render_layer_state(void); + +#define WRITE_STR_CASE(CASE, STRING) \ + case CASE: \ + oled_write_P(PSTR(STRING), false); \ + break; \ + +// kinda hacky for the moment. +// assume bepo is enabled. +#define WRITE_STR_LAYER(CASE, STRING) \ + LCASE(CASE) \ + oled_write_P(PSTR(STRING), false); \ + break; + +// make maps for the oled. code doc. +#define carte_de_map(ROW1, ROW2, ROW3) \ + oled_write_ln_P(PSTR(ROW1), false); \ + oled_write_ln_P(PSTR(ROW2), false); \ + oled_write_ln_P(PSTR(ROW3), false); + +// generate Case for all locales for this map. +#define SHOW_MAP(LAYER) \ + LCASE(LAYER) \ + CAT(CARTE, LAYER) \ + break; + +// a single case, for single locale layers. +#define SHOW_MAP_S(LAYER) \ + case LAYER: \ + CAT(CARTE, LAYER) \ + break; + +#endif |