diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-06-27 16:38:28 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-06-27 16:38:28 +0200 |
commit | 98b9909429aea0869f7a6f2f44ab386a4a3ff094 (patch) | |
tree | e1080a61bb89a75edc70818489f8044adf597c48 /keyboards/hadron/ver3 | |
parent | b610965fd6d851484025166fb255078b1c809261 (diff) | |
parent | fa3dd373b4925734d9843ae6014349069ffec353 (diff) | |
download | qmk_firmware-98b9909429aea0869f7a6f2f44ab386a4a3ff094.tar.gz qmk_firmware-98b9909429aea0869f7a6f2f44ab386a4a3ff094.zip |
Merge branch 'master' into taamas
Diffstat (limited to 'keyboards/hadron/ver3')
-rw-r--r-- | keyboards/hadron/ver3/config.h | 19 | ||||
-rw-r--r-- | keyboards/hadron/ver3/keymaps/default/config.h | 1 | ||||
-rw-r--r-- | keyboards/hadron/ver3/keymaps/default/keymap.c | 74 | ||||
-rw-r--r-- | keyboards/hadron/ver3/keymaps/readme.md | 24 | ||||
-rw-r--r-- | keyboards/hadron/ver3/rules.mk | 15 | ||||
-rw-r--r-- | keyboards/hadron/ver3/ver3.c | 224 |
6 files changed, 98 insertions, 259 deletions
diff --git a/keyboards/hadron/ver3/config.h b/keyboards/hadron/ver3/config.h index 574dc6b016..c61cc9a1e0 100644 --- a/keyboards/hadron/ver3/config.h +++ b/keyboards/hadron/ver3/config.h @@ -15,8 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef REV3_CONFIG_H -#define REV3_CONFIG_H +#pragma once /* USB Device descriptor parameter */ #define DEVICE_VER 0x0003 @@ -70,16 +69,8 @@ #define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f #endif -//configure qwiic micro_oled driver for the 128x32 oled -#ifdef QWIIC_MICRO_OLED_ENABLE - -#undef I2C_ADDRESS_SA0_1 -#define I2C_ADDRESS_SA0_1 0b0111100 -#define LCDWIDTH 128 -#define LCDHEIGHT 32 -#define micro_oled_rotate_180 - -#endif +// configure oled driver for the 128x32 oled +#define OLED_UPDATE_INTERVAL 33 // ~30fps /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ // #define DEBOUNCE 6 @@ -125,8 +116,6 @@ //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION /* Haptic Driver initialization settings * Feedback Control Settings */ @@ -186,5 +175,3 @@ // #define RGB_MATRIX_KEYPRESSES #define SOLENOID_PIN A14 - -#endif diff --git a/keyboards/hadron/ver3/keymaps/default/config.h b/keyboards/hadron/ver3/keymaps/default/config.h deleted file mode 100644 index 6f70f09bee..0000000000 --- a/keyboards/hadron/ver3/keymaps/default/config.h +++ /dev/null @@ -1 +0,0 @@ -#pragma once diff --git a/keyboards/hadron/ver3/keymaps/default/keymap.c b/keyboards/hadron/ver3/keymaps/default/keymap.c index cec43e95d4..3eb0e59fc5 100644 --- a/keyboards/hadron/ver3/keymaps/default/keymap.c +++ b/keyboards/hadron/ver3/keymaps/default/keymap.c @@ -9,8 +9,8 @@ #define _DVORAK 2 #define _LOWER 3 #define _RAISE 4 -#define _MOUSECURSOR 8 -#define _ADJUST 16 +#define _MOUSECURSOR 5 +#define _ADJUST 6 enum preonic_keycodes { QWERTY = SAFE_RANGE, @@ -55,11 +55,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------------------------------------------------------------------' */ [_QWERTY] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, \ - KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, + KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT ), /* Colemak @@ -76,11 +76,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------------------------------------------------------------------' */ [_COLEMAK] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ - KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ - KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, \ - KC_GRV, KC_CAPS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, + KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, + KC_GRV, KC_CAPS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), /* Dvorak @@ -97,11 +97,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------------------------------------------------------------------' */ [_DVORAK] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ - KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ - KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, \ - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, \ - KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, + KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT ), /* Lower @@ -118,11 +118,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------------------------------------------------------------------' */ [_LOWER] = LAYOUT( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), /* Raise @@ -139,11 +139,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------------------------------------------------------------------' */ [_RAISE] = LAYOUT( - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ - _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, + _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), /* Mouse Layer (semi-col) @@ -161,11 +161,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_MOUSECURSOR] = LAYOUT( - KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \ - _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \ + KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, + _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ ), /* Adjust (Lower + Raise) @@ -182,11 +182,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------------------------------------------------------------------------------------------' */ [_ADJUST] = LAYOUT( - RESET, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST , _______, _______, _______, _______, _______, EEP_RST, \ - _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ - _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_RST, CK_DOWN, CK_UP, CK_TOGG\ + QK_BOOT, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST , _______, _______, _______, _______, _______, EEP_RST, + _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_RST, CK_DOWN, CK_UP, CK_TOGG ) diff --git a/keyboards/hadron/ver3/keymaps/readme.md b/keyboards/hadron/ver3/keymaps/readme.md deleted file mode 100644 index 66bf06b711..0000000000 --- a/keyboards/hadron/ver3/keymaps/readme.md +++ /dev/null @@ -1,24 +0,0 @@ -# How to add your own keymap - -Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: - - _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] - -\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements - -and contain the following files: - -* `keymap.c` -* `readme.md` *recommended* -* `config.h` *optional*, found automatically when compiling -* `Makefile` *optional*, found automatically when compling - -When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: - - * **folder_name** description - -# List of Hadron keymaps - -* **default** default Hadron layout -* **ishtob** ishtob's Hadron layout -* **sebaslayout** sebaslayout's Hadron layout
\ No newline at end of file diff --git a/keyboards/hadron/ver3/rules.mk b/keyboards/hadron/ver3/rules.mk index f3cc14b17d..da70b2a9bf 100644 --- a/keyboards/hadron/ver3/rules.mk +++ b/keyboards/hadron/ver3/rules.mk @@ -6,22 +6,21 @@ BOARD = QMK_PROTON_C BOOTLOADER = stm32-dfu # Build Options -# comment out to disable the options. +# change yes to no to disable # BACKLIGHT_ENABLE = no -BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover -CUSTOM_MATRIX = no # Custom matrix file +NKRO_ENABLE = yes # Enable N-Key Rollover AUDIO_ENABLE = yes RGBLIGHT_ENABLE = yes RGB_MATRIX_ENABLE = no # once arm_rgb is implemented RGB_MATRIX_DRIVER = WS2812 -HAPTIC_ENABLE += DRV2605L -QWIIC_ENABLE = yes -QWIIC_DRIVERS += MICRO_OLED +HAPTIC_ENABLE = yes +HAPTIC_DRIVER = DRV2605L +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 ENCODER_ENABLER = yes diff --git a/keyboards/hadron/ver3/ver3.c b/keyboards/hadron/ver3/ver3.c index 0664bf4b0e..4c5a2e0c9a 100644 --- a/keyboards/hadron/ver3/ver3.c +++ b/keyboards/hadron/ver3/ver3.c @@ -14,9 +14,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ver3.h" -#include "qwiic.h" -#include "action_layer.h" -#include "haptic.h" #ifdef RGB_MATRIX_ENABLE @@ -36,185 +33,66 @@ led_config_t g_led_config = { { #endif -uint8_t *o_fb; +#ifdef OLED_ENABLE +oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return OLED_ROTATION_180; } -uint16_t counterst = 0; - - - -#ifdef QWIIC_MICRO_OLED_ENABLE - -/* screen off after this many milliseconds */ -#include "timer.h" -#define ScreenOffInterval 60000 /* milliseconds */ -static uint16_t last_flush; - -volatile uint8_t led_numlock = false; -volatile uint8_t led_capslock = false; -volatile uint8_t led_scrolllock = false; - -static uint8_t layer; -static bool queue_for_send = false; -static uint8_t encoder_value = 32; - -__attribute__ ((weak)) -void draw_ui(void) { - clear_buffer(); - last_flush = timer_read(); - send_command(DISPLAYON); - -/* Layer indicator is 41 x 10 pixels */ -#define LAYER_INDICATOR_X 5 -#define LAYER_INDICATOR_Y 0 - - draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0); - draw_rect_filled_soft(LAYER_INDICATOR_X + 32, LAYER_INDICATOR_Y + 1, 9, 9, PIXEL_ON, NORM); - draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0); - -/* Matrix display is 19 x 9 pixels */ +bool oled_task_kb(void) { + if (!oled_task_user()) { + return false; + } + oled_write_P(PSTR("LAYER"), false); + oled_advance_char(); + oled_write_char(get_highest_layer(layer_state) + 0x30, true); + + led_t led_state = host_keyboard_led_state(); + oled_set_cursor(18, 0); + oled_write_P(PSTR("NUM"), led_state.num_lock); + oled_set_cursor(18, 1); + oled_write_P(PSTR("CAP"), led_state.caps_lock); + oled_set_cursor(18, 2); + oled_write_P(PSTR("SCR"), led_state.scroll_lock); + + uint8_t mod_state = get_mods(); + oled_set_cursor(10, 3); + oled_write_P(PSTR("S"), mod_state & MOD_MASK_SHIFT); + oled_advance_char(); + oled_write_P(PSTR("C"), mod_state & MOD_MASK_CTRL); + oled_advance_char(); + oled_write_P(PSTR("A"), mod_state & MOD_MASK_ALT); + oled_advance_char(); + oled_write_P(PSTR("G"), mod_state & MOD_MASK_GUI); + oled_advance_char(); + +/* Matrix display is 12 x 12 pixels */ #define MATRIX_DISPLAY_X 5 #define MATRIX_DISPLAY_Y 18 - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - for (uint8_t y = 0; y < MATRIX_COLS; y++) { - draw_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2,(matrix_get_row(x) & (1 << y)) > 0, NORM); - } - } - draw_rect_soft(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y, 19, 9, PIXEL_ON, NORM); - /* hadron oled location on thumbnail */ - draw_rect_filled_soft(MATRIX_DISPLAY_X + 14, MATRIX_DISPLAY_Y + 2, 3, 1, PIXEL_ON, NORM); -/* - draw_rect_soft(0, 13, 64, 6, PIXEL_ON, NORM); - draw_line_vert(encoder_value, 13, 6, PIXEL_ON, NORM); - -*/ + // matrix + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + for (uint8_t y = 0; y < MATRIX_COLS; y++) { + bool on = (matrix_get_row(x) & (1 << y)) > 0; -/* Mod display is 41 x 16 pixels */ -#define MOD_DISPLAY_X 30 -#define MOD_DISPLAY_Y 18 + // force on for oled location + if((x == 0) && (y >= (MATRIX_COLS - 3))) on = 1; - uint8_t mods = get_mods(); - if (mods & MOD_LSFT) { - draw_rect_filled_soft(MOD_DISPLAY_X + 0, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); - draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_OFF, NORM, 0); - } else { - draw_string(MOD_DISPLAY_X + 3, MOD_DISPLAY_Y + 2, "S", PIXEL_ON, NORM, 0); - } - if (mods & MOD_LCTL) { - draw_rect_filled_soft(MOD_DISPLAY_X + 10, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); - draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_OFF, NORM, 0); - } else { - draw_string(MOD_DISPLAY_X + 13, MOD_DISPLAY_Y + 2, "C", PIXEL_ON, NORM, 0); - } - if (mods & MOD_LALT) { - draw_rect_filled_soft(MOD_DISPLAY_X + 20, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); - draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_OFF, NORM, 0); - } else { - draw_string(MOD_DISPLAY_X + 23, MOD_DISPLAY_Y + 2, "A", PIXEL_ON, NORM, 0); - } - if (mods & MOD_LGUI) { - draw_rect_filled_soft(MOD_DISPLAY_X + 30, MOD_DISPLAY_Y, 5 + (1 * 6), 11, PIXEL_ON, NORM); - draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_OFF, NORM, 0); - } else { - draw_string(MOD_DISPLAY_X + 33, MOD_DISPLAY_Y + 2, "G", PIXEL_ON, NORM, 0); - } - -/* Lock display is 23 x 32 */ -#define LOCK_DISPLAY_X 100 -#define LOCK_DISPLAY_Y 0 - - if (led_numlock == true) { - draw_rect_filled_soft(LOCK_DISPLAY_X, LOCK_DISPLAY_Y, 5 + (3 * 6), 9, PIXEL_ON, NORM); - draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_OFF, NORM, 0); - } else if (led_numlock == false) { - draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 1, "NUM", PIXEL_ON, NORM, 0); - } - if (led_capslock == true) { - draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 11, 5 + (3 * 6), 9, PIXEL_ON, NORM); - draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_OFF, NORM, 0); - } else if (led_capslock == false) { - draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 11 +1, "CAP", PIXEL_ON, NORM, 0); - } - - if (led_scrolllock == true) { - draw_rect_filled_soft(LOCK_DISPLAY_X + 0, LOCK_DISPLAY_Y + 22, 5 + (3 * 6), 9, PIXEL_ON, NORM); - draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_OFF, NORM, 0); - } else if (led_scrolllock == false) { - draw_string(LOCK_DISPLAY_X + 3, LOCK_DISPLAY_Y + 22 +1, "SCR", PIXEL_ON, NORM, 0); - } - send_buffer(); -} - -void read_host_led_state(void) { - uint8_t leds = host_keyboard_leds(); - if (leds & (1 << USB_LED_NUM_LOCK)) { - if (led_numlock == false){ - led_numlock = true;} - } else { - if (led_numlock == true){ - led_numlock = false;} + oled_write_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2, on); + } } - if (leds & (1 << USB_LED_CAPS_LOCK)) { - if (led_capslock == false){ - led_capslock = true;} - } else { - if (led_capslock == true){ - led_capslock = false;} + + // outline + for (uint8_t x = 0; x < 19; x++) { + oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true); + oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 9, true); } - if (leds & (1 << USB_LED_SCROLL_LOCK)) { - if (led_scrolllock == false){ - led_scrolllock = true;} - } else { - if (led_scrolllock == true){ - led_scrolllock = false;} + for (uint8_t y = 0; y < 9; y++) { + oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true); + oled_write_pixel(MATRIX_DISPLAY_X + 19, MATRIX_DISPLAY_Y+y, true); } -} - -uint32_t layer_state_set_kb(uint32_t state) { - state = layer_state_set_user(state); - layer = biton32(state); - queue_for_send = true; - return state; -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - queue_for_send = true; - return process_record_user(keycode, record); -} - -bool encoder_update_user(uint8_t index, bool clockwise); -bool encoder_update_kb(uint8_t index, bool clockwise) { - if (!encoder_update_user(index, clockwise)) return false; - encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64; - queue_for_send = true; - return true; -} - -#endif - -void matrix_init_kb(void) { - queue_for_send = true; - matrix_init_user(); + // bodge for layer number left hand side + for (uint8_t y = 0; y < 8; y++) { + oled_write_pixel(35, 0 + y, true); + } + return false; } - -void matrix_scan_kb(void) { -if (queue_for_send) { -#ifdef QWIIC_MICRO_OLED_ENABLE - read_host_led_state(); - draw_ui(); #endif - queue_for_send = false; - } -#ifdef QWIIC_MICRO_OLED_ENABLE - if (timer_elapsed(last_flush) > ScreenOffInterval) { - send_command(DISPLAYOFF); /* 0xAE */ - } -#endif - if (counterst == 0) { - //testPatternFB(o_fb); - } - counterst = (counterst + 1) % 1024; - //rgblight_task(); - matrix_scan_user(); -} |