From 7a08b9d374dfcf9d872738af44b231862064b96f Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 22 Jan 2021 08:23:03 -0800 Subject: [PATCH] [Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master --- .../5x6_right_trackball/5x6_right_trackball.c | 4 +- .../5x6_right_trackball/config.h | 4 + .../keymaps/default/config.h | 7 +- .../keymaps/default/keymap.c | 48 +---- .../keymaps/default/rules.mk | 4 + .../keymaps/drashna/config.h | 14 ++ .../keymaps/drashna/keymap.c | 3 +- .../keymaps/drashna/rules.mk | 11 +- .../5x6_right_trackball/pointer_transport.c | 164 ++++++++++++++++-- keyboards/kyria/keymaps/drashna/config.h | 4 - keyboards/kyria/keymaps/drashna/rules.mk | 4 +- keyboards/moonlander/keymaps/drashna/keymap.c | 37 ++-- .../ploopyco/mouse/keymaps/drashna/config.h | 24 +++ .../ploopyco/mouse/keymaps/drashna/keymap.c | 34 ++++ .../ploopyco/mouse/keymaps/drashna/rules.mk | 4 + layouts/community/ergodox/drashna/config.h | 1 - layouts/community/ergodox/drashna/keymap.c | 61 ++++--- .../community/ergodox/drashna/visualizer.c | 77 ++++++++ layouts/community/ortho_4x12/drashna/config.h | 2 + layouts/community/ortho_4x12/drashna/keymap.c | 56 +++--- .../community/split_3x6_3/drashna/config.h | 36 +++- .../community/split_3x6_3/drashna/halconf.h | 22 +++ .../community/split_3x6_3/drashna/keymap.c | 83 ++++----- .../community/split_3x6_3/drashna/mcuconf.h | 32 ++++ .../community/split_3x6_3/drashna/rules.mk | 10 +- .../community/split_3x6_3/drashna/ssd1306.c | 0 users/drashna/config.h | 16 +- users/drashna/drashna.c | 28 ++- users/drashna/drashna.h | 5 +- users/drashna/oled_stuff.c | 31 ++-- users/drashna/process_records.c | 7 +- users/drashna/process_records.h | 2 +- users/drashna/rgb_matrix_stuff.c | 6 +- users/drashna/rgb_matrix_stuff.h | 2 +- users/drashna/rgb_stuff.c | 6 +- users/drashna/wrappers.h | 9 + 36 files changed, 588 insertions(+), 270 deletions(-) create mode 100644 keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk create mode 100644 keyboards/ploopyco/mouse/keymaps/drashna/config.h create mode 100644 keyboards/ploopyco/mouse/keymaps/drashna/keymap.c create mode 100644 keyboards/ploopyco/mouse/keymaps/drashna/rules.mk create mode 100644 layouts/community/ergodox/drashna/visualizer.c create mode 100644 layouts/community/split_3x6_3/drashna/halconf.h create mode 100644 layouts/community/split_3x6_3/drashna/mcuconf.h create mode 100644 layouts/community/split_3x6_3/drashna/ssd1306.c diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c index c40e4173da..d931fd940d 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/5x6_right_trackball.c @@ -142,7 +142,7 @@ void pointing_device_init(void) { trackball_set_cpi(dpi_array[keyboard_config.dpi_config]); } -static bool has_mouse_report_changed(report_mouse_t new, report_mouse_t old) { +static bool has_report_changed(report_mouse_t new, report_mouse_t old) { return (new.buttons != old.buttons) || (new.x && new.x != old.x) || (new.y && new.y != old.y) || @@ -186,7 +186,7 @@ void pointing_device_send(void) { mouseReport.x = 0; mouseReport.y = 0; process_mouse_user(&mouseReport, x, y); - if (has_mouse_report_changed(mouseReport, old_report)) { + if (has_report_changed(mouseReport, old_report)) { host_mouse_send(&mouseReport); } } else { diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h index 147f126006..6d89314a2c 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/config.h @@ -65,3 +65,7 @@ along with this program. If not, see . #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 #define DYNAMIC_KEYMAP_LAYER_COUNT 16 + +/* serial.c configuration for split keyboard */ +#undef SOFT_SERIAL_PIN +#define SOFT_SERIAL_PIN D2 diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h index 4e35d4c4fc..5bad6bcab3 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/config.h @@ -19,9 +19,4 @@ #pragma once -#define USE_SERIAL - -#define MASTER_LEFT -// #define MASTER_RIGHT -//#define EE_HANDS -// Rows are doubled-up +#include "../drashna/config.h" diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c index 7550b1fd8a..037f59af85 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/keymap.c @@ -14,50 +14,4 @@ * along with this program. If not, see . */ -#include QMK_KEYBOARD_H - - -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 - -#define RAISE MO(_RAISE) -#define LOWER MO(_LOWER) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - [_QWERTY] = LAYOUT_5x6_right_trackball( - KC_ESC , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,KC_BSPC, - KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_MINS, - KC_LSFT, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_QUOT, - KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_BSLASH, - KC_LBRC,KC_RBRC, KC_EQL, - RAISE,KC_SPC, LOWER, - KC_TAB,KC_HOME, KC_END, KC_DEL, - KC_BSPC, KC_GRV, KC_LGUI, KC_LALT - ), - - [_LOWER] = LAYOUT_5x6_right_trackball( - - 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_LBRC, KC_RBRC, KC_P7 , KC_P8 , KC_P9 ,_______,KC_PLUS, - _______,KC_HOME,KC_PGUP,KC_PGDN,KC_END ,KC_LPRN, KC_RPRN, KC_P4 , KC_P5 , KC_P6 ,KC_MINS,KC_PIPE, - _______,_______,_______,_______,_______,_______, _______, KC_P1 , KC_P2 , KC_P3 ,KC_EQL ,KC_UNDS, - _______,KC_PSCR, KC_P0, - _______,_______, _______, - _______,_______, _______,_______, - _______,_______, _______,_______ - - ), - - [_RAISE] = LAYOUT_5x6_right_trackball( - KC_F12 , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 , - _______,_______,_______,_______,_______,KC_LBRC, KC_RBRC,_______,KC_NLCK,KC_INS ,KC_SLCK,KC_MUTE, - _______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU, - _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_VOLD, - _______,_______, _______, - _______,_______, _______, - _______,_______, _______,_______, - _______,_______, _______,_______ - ), -}; +// placeholder diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk new file mode 100644 index 0000000000..457cda5b0a --- /dev/null +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/default/rules.mk @@ -0,0 +1,4 @@ +USER_NAME := drashna +SRC += ../drashna/keymap.c + +include $(KEYBOARD_PATH_1)/keymaps/drashna/rules.mk diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h index 78dff38967..73bf32b25e 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/config.h @@ -17,6 +17,8 @@ #pragma once // #define USE_I2C +#define SELECT_SOFT_SERIAL_SPEED 0 +#define SERIAL_USE_MULTI_TRANSACTION #define EE_HANDS #define TRACKBALL_DPI_OPTIONS \ @@ -24,5 +26,17 @@ #define RGBLIGHT_EFFECT_TWINKLE_LIFE 50 #define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1/63 +#define RGBLIGHT_MAX_BRIGHTNESS 100 + +#undef DEBOUNCE +#define DEBOUNCE 10 #define SOLENOID_PIN F1 +#define SOLENOID_DEFAULT_DWELL 8 + +#define OLED_DISPLAY_128X64 +#define OLED_TIMEOUT 0 +#define OLED_BRIGHTNESS 100 +#define SPLIT_MODS_ENABLE + +#define MK_KINETIC_SPEED diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c index ca9733b6e3..f8803edb9c 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/keymap.c @@ -17,7 +17,6 @@ #include "drashna.h" #define TG_DBLO TG(_DIABLO) -#define _MOUSE _MEDIA // clang-format off @@ -172,7 +171,7 @@ void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { } void matrix_scan_keymap(void) { - if (timer_elapsed(mouse_timer) > 750 && layer_state_is(_MOUSE) && !mouse_keycode_tracker) { + if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker) { layer_off(_MOUSE); } } diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk index 2e3e9607c0..be584e8c4d 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/keymaps/drashna/rules.mk @@ -1,2 +1,9 @@ -RGBLIGHT_STARTUP_ANIMATION = yes -HAPTIC_ENABLE = SOLENOID +RGBLIGHT_STARTUP_ANIMATION = yes +HAPTIC_ENABLE = SOLENOID +COMMAND_ENABLE = no +AUDIO_ENABLE = yes +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes +OLED_DRIVER_ENABLE = yes + +# DEBOUNCE_TYPE = sym_eager_pk diff --git a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c index 003468c828..20216a21dd 100644 --- a/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c +++ b/keyboards/handwired/dactyl_manuform/5x6_right_trackball/pointer_transport.c @@ -41,6 +41,10 @@ static uint16_t device_cpi = 0; static int8_t split_mouse_x = 0, split_mouse_y = 0; #endif +#ifdef OLED_DRIVER_ENABLE +# include "oled_driver.h" +#endif + #if defined(USE_I2C) # include "i2c_master.h" @@ -48,7 +52,16 @@ static int8_t split_mouse_x = 0, split_mouse_y = 0; typedef struct _I2C_slave_buffer_t { matrix_row_t smatrix[ROWS_PER_HAND]; - uint8_t backlight_level; +# ifdef SPLIT_MODS_ENABLE + uint8_t real_mods; + uint8_t weak_mods; +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods; +# endif +# endif +# ifdef BACKLIGHT_ENABLE + uint8_t backlight_level; +# endif # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) rgblight_syncinfo_t rgblight_sync; # endif @@ -58,9 +71,12 @@ typedef struct _I2C_slave_buffer_t { # ifdef WPM_ENABLE uint8_t current_wpm; # endif - int8_t mouse_x; - int8_t mouse_y; - uint16_t device_cpi; + int8_t mouse_x; + int8_t mouse_y; + uint16_t device_cpi; + bool oled_on; + layer_state_t t_layer_state; + layer_state_t t_default_layer_state; } I2C_slave_buffer_t; static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; @@ -68,11 +84,19 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re # define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) # define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, mmatrix) +# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) +# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) +# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) +# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) # define I2C_MOUSE_X_START offsetof(I2C_slave_buffer_t, mouse_x) # define I2C_MOUSE_Y_START offsetof(I2C_slave_buffer_t, mouse_y) # define I2C_MOUSE_DPI_START offsetof(I2C_slave_buffer_t, device_cpi) +# define I2C_OLED_ON_START offsetof(I2C_slave_buffent, oled_on) +# define I2C_LAYER_STATE_START offsetof(I2C_slave_buffent, t_layer_state) +# define I2C_DEFAULT_LAYER_STATE_START offsetof(I2C_slave_buffent, t_default_layer_state) + # define TIMEOUT 100 # ifndef SLAVE_I2C_ADDRESS @@ -127,13 +151,58 @@ bool transport_master(matrix_row_t matrix[]) { pointing_device_set_report(temp_report); if (device_cpi != i2c_buffer->device_cpi) { - if(i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_DPI_START, (void *)&device_cpi, sizeof(device_cpi), TIMEOUT) >= 0) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_DPI_START, (void *)&device_cpi, sizeof(device_cpi), TIMEOUT) >= 0) { i2c_buffer->device_cpi = device_cpi } } } # endif +# ifdef SPLIT_MODS_ENABLE + uint8_t real_mods = get_mods(); + if (real_mods != i2c_buffer->real_mods) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_REAL_MODS_START, (void *)&real_mods, sizeof(real_mods), TIMEOUT) >= 0) { + i2c_buffer->real_mods = real_mods; + } + } + + uint8_t weak_mods = get_weak_mods(); + if (weak_mods != i2c_buffer->weak_mods) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WEAK_MODS_START, (void *)&weak_mods, sizeof(weak_mods), TIMEOUT) >= 0) { + i2c_buffer->weak_mods = weak_mods; + } + } + +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods = get_oneshot_mods(); + if (oneshot_mods != i2c_buffer->oneshot_mods) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_ONESHOT_MODS_START, (void *)&oneshot_mods, sizeof(oneshot_mods), TIMEOUT) >= 0) { + i2c_buffer->oneshot_mods = oneshot_mods; + } + } +# endif +# endif + + if (layer_state != i2c_buffer->t_layer_state) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&layer_state, sizeof(layer_state), TIMEOUT) >= 0) { + i2c_buffer->t_layer_state = layer_state; + } + } + + if (default_layer_state != i2c_buffer->t_default_layer_state) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_DEFAULT_LAYER_STATE_START, (void *)&default_layer_state, sizeof(default_layer_state), TIMEOUT) >= 0) { + i2c_buffer->t_default_layer_state = default_layer_state; + } + } + +# ifdef OLED_DRIVER_ENABLE + if (is_oled_on() != i2c_buffer->oled_on) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&is_oled_on(), sizeof(bool), TIMEOUT) >= 0) { + i2c_buffer->oled_on = is_oled_on(); + } + } +# endif + return true; } @@ -176,6 +245,29 @@ void transport_slave(matrix_row_t matrix[]) { } # endif + +# ifdef SPLIT_MODS_ENABLE + set_mods(i2c_buffer->real_mods); + set_weak_mods(i2c_buffer->weak_mods); +# ifndef NO_ACTION_ONESHOT + set_oneshot_mods(i2c_buffer->oneshot_mods); +# endif +# endif + + if (layer_state != i2c_buffer->t_layer_state) { + layer_state_set(i2c_buffer->t_layer_state); + } + if (default_layer_state != i2c_buffer->t_default_layer_state) { + default_layer_state_set(i2c_buffer->t_default_layer_state); + } + +# ifdef OLED_DRIVER_ENABLE + if (i2c_buffer->oled_on) { + oled_on(); + } else { + oled_off(); + } +# endif } void transport_master_init(void) { i2c_init(); } @@ -190,20 +282,33 @@ typedef struct _Serial_s2m_buffer_t { // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack matrix_row_t smatrix[ROWS_PER_HAND]; # ifdef ENCODER_ENABLE - uint8_t encoder_state[NUMBER_OF_ENCODERS]; + uint8_t encoder_state[NUMBER_OF_ENCODERS]; # endif - int8_t mouse_x; - int8_t mouse_y; + int8_t mouse_x; + int8_t mouse_y; } Serial_s2m_buffer_t; typedef struct _Serial_m2s_buffer_t { +# ifdef SPLIT_MODS_ENABLE + uint8_t real_mods; + uint8_t weak_mods; +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods; +# endif +# endif +# ifndef DISABLE_SYNC_TIMER + uint32_t sync_timer; +# endif # ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; + uint8_t backlight_level; # endif # ifdef WPM_ENABLE - uint8_t current_wpm; + uint8_t current_wpm; # endif - uint16_t device_cpi; + uint16_t device_cpi; + bool oled_on; + layer_state_t t_layer_state; + layer_state_t t_default_layer_state; } Serial_m2s_buffer_t; # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) @@ -308,7 +413,15 @@ bool transport_master(matrix_row_t matrix[]) { # ifdef WPM_ENABLE // Write wpm to slave - serial_m2s_buffer.current_wpm = get_current_wpm(); + serial_m2s_buffer.current_wpm = get_current_wpm(); +# endif + +# ifdef SPLIT_MODS_ENABLE + serial_m2s_buffer.real_mods = get_mods(); + serial_m2s_buffer.weak_mods = get_weak_mods(); +# ifndef NO_ACTION_ONESHOT + serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); +# endif # endif # ifdef POINTING_DEVICE_ENABLE @@ -321,6 +434,12 @@ bool transport_master(matrix_row_t matrix[]) { } # endif + serial_m2s_buffer.t_layer_state = layer_state; + serial_m2s_buffer.t_default_layer_state = default_layer_state; +# ifdef OLED_DRIVER_ENABLE + serial_m2s_buffer.oled_on = is_oled_on(); +# endif + return true; } @@ -344,6 +463,14 @@ void transport_slave(matrix_row_t matrix[]) { set_current_wpm(serial_m2s_buffer.current_wpm); # endif +# ifdef SPLIT_MODS_ENABLE + set_mods(serial_m2s_buffer.real_mods); + set_weak_mods(serial_m2s_buffer.weak_mods); +# ifndef NO_ACTION_ONESHOT + set_oneshot_mods(serial_m2s_buffer.oneshot_mods); +# endif +# endif + # ifdef POINTING_DEVICE_ENABLE if (!is_keyboard_left()) { static uint16_t cpi; @@ -354,7 +481,20 @@ void transport_slave(matrix_row_t matrix[]) { serial_s2m_buffer.mouse_x = split_mouse_x; serial_s2m_buffer.mouse_y = split_mouse_y; } +# endif + if (layer_state != serial_m2s_buffer.t_layer_state) { + layer_state_set(serial_m2s_buffer.t_layer_state); + } + if (default_layer_state != serial_m2s_buffer.t_default_layer_state) { + default_layer_set(serial_m2s_buffer.t_default_layer_state); + } +# ifdef OLED_DRIVER_ENABLE + if (serial_m2s_buffer.oled_on) { + oled_on(); + } else { + oled_off(); + } # endif } diff --git a/keyboards/kyria/keymaps/drashna/config.h b/keyboards/kyria/keymaps/drashna/config.h index 1af947e736..d5fcf90889 100644 --- a/keyboards/kyria/keymaps/drashna/config.h +++ b/keyboards/kyria/keymaps/drashna/config.h @@ -35,8 +35,4 @@ # define RGBLIGHT_LAYERS #endif -// If you are using an Elite C rev3 on the slave side, uncomment the lines below: -#define SPLIT_USB_DETECT -#define SPLIT_USB_TIMEOUT 1000 - #define KEYLOGGER_LENGTH 10 diff --git a/keyboards/kyria/keymaps/drashna/rules.mk b/keyboards/kyria/keymaps/drashna/rules.mk index e11a114837..756c044fa4 100644 --- a/keyboards/kyria/keymaps/drashna/rules.mk +++ b/keyboards/kyria/keymaps/drashna/rules.mk @@ -18,6 +18,6 @@ FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches BOOTLOADER = atmel-dfu -SPLIT_TRANSPORT = mirror +# SPLIT_TRANSPORT = mirror -TAP_DANCE_ENABLE = yes +# TAP_DANCE_ENABLE = yes diff --git a/keyboards/moonlander/keymaps/drashna/keymap.c b/keyboards/moonlander/keymaps/drashna/keymap.c index 7daa5248f3..a12be12eae 100644 --- a/keyboards/moonlander/keymaps/drashna/keymap.c +++ b/keyboards/moonlander/keymaps/drashna/keymap.c @@ -196,14 +196,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { } #ifdef RGB_MATRIX_ENABLE -# ifndef RGB_MATRIX_INDICATOR_SET_COLOR -# define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) rgb_matrix_set_color(i, r, g, b) -void rgb_matrix_indicators_user(void) { - #else void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { -# endif - if (g_suspend_state || !rgb_matrix_config.enable) return; - if (layer_state_is(_GAMEPAD)) { RGB_MATRIX_INDICATOR_SET_COLOR(11, 0x00, 0xFF, 0x00); // Q RGB_MATRIX_INDICATOR_SET_COLOR(16, 0x00, 0xFF, 0xFF); // W @@ -214,51 +207,51 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { RGB_MATRIX_INDICATOR_SET_COLOR(22, 0x00, 0xFF, 0xFF); // D RGB_MATRIX_INDICATOR_SET_COLOR(27, 0x7A, 0x00, 0xFF); // F - RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 10 : 15), 0xFF, 0xFF, 0xFF); // 1 - RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 15 : 10), 0x00, 0xFF, 0x00); // 2 + RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 15 : 10), 0xFF, 0xFF, 0xFF); // 1 + RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 10 : 15), 0x00, 0xFF, 0x00); // 2 RGB_MATRIX_INDICATOR_SET_COLOR(20, 0x7A, 0x00, 0xFF); // 3 } if (userspace_config.rgb_layer_change) { switch (get_highest_layer(layer_state|default_layer_state)) { case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CYAN, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_MAGENTA, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GOLDENROD, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CORAL, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_PINK, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_BLUE, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max); break; case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; } } diff --git a/keyboards/ploopyco/mouse/keymaps/drashna/config.h b/keyboards/ploopyco/mouse/keymaps/drashna/config.h new file mode 100644 index 0000000000..5bc704fec1 --- /dev/null +++ b/keyboards/ploopyco/mouse/keymaps/drashna/config.h @@ -0,0 +1,24 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * Copyright 2019 Sunjun Kim + * Copyright 2020 Ploopy Corporation + * + * 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 . + */ + +#pragma once + +#undef RGBLIGHT_LIMIT_VAL +#define RGBLIGHT_LIMIT_VAL 255 +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_SLEEP diff --git a/keyboards/ploopyco/mouse/keymaps/drashna/keymap.c b/keyboards/ploopyco/mouse/keymaps/drashna/keymap.c new file mode 100644 index 0000000000..68b846f7ba --- /dev/null +++ b/keyboards/ploopyco/mouse/keymaps/drashna/keymap.c @@ -0,0 +1,34 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * Copyright 2019 Sunjun Kim + * Copyright 2020 Ploopy Corporation + * + * 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 . + */ +#include QMK_KEYBOARD_H + +// safe range starts at `PLOOPY_SAFE_RANGE` instead. + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT(/* Base */ + C(KC_C), KC_BTN1, KC_BTN3, KC_BTN2, MO(1), KC_BTN4, KC_BTN5, DPI_CONFIG), + [1] = LAYOUT(/* Base */ + RGB_HUI, RGB_MOD, RGB_TOG, RGB_RMOD, MO(1), KC_VOLU, KC_VOLD, RESET) + +}; + +void eeconkfig_init_user(void) { + rgblight_enable(); + rgblight_mode(RGBLIGHT_MODE_TWINKLE+5); + rgblight_sethsv(HSV_MAGENTA); +} diff --git a/keyboards/ploopyco/mouse/keymaps/drashna/rules.mk b/keyboards/ploopyco/mouse/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..4e7eebe341 --- /dev/null +++ b/keyboards/ploopyco/mouse/keymaps/drashna/rules.mk @@ -0,0 +1,4 @@ +USER_NAME := not_drashna + +RGBLIGHT_ENABLE = yes +CONSOLE_ENABLE = no diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index a595a93c43..4ccba8f04b 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -42,7 +42,6 @@ # undef RGB_MATRIX_LED_FLUSH_LIMIT # if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) # define RGBLIGHT_LIMIT_VAL 100 -# undef RGBLIGHT_SLEEP # endif #endif diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 5f1c0c8a09..fb5bcc6bd7 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -446,70 +446,65 @@ void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } -void rgb_matrix_indicators_user(void) { - if (g_suspend_state || !rgb_matrix_config.enable) return; +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { if (layer_state_is(_GAMEPAD)) { - rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q - rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W - rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E - rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R - rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A - rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S - rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D - rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F + RGB_MATRIX_INDICATOR_SET_COLOR(32, 0x00, 0xFF, 0x00); // Q + RGB_MATRIX_INDICATOR_SET_COLOR(31, 0x00, 0xFF, 0xFF); // W + RGB_MATRIX_INDICATOR_SET_COLOR(30, 0xFF, 0x00, 0x00); // E + RGB_MATRIX_INDICATOR_SET_COLOR(29, 0xFF, 0x80, 0x00); // R + RGB_MATRIX_INDICATOR_SET_COLOR(37, 0x00, 0xFF, 0xFF); // A + RGB_MATRIX_INDICATOR_SET_COLOR(36, 0x00, 0xFF, 0xFF); // S + RGB_MATRIX_INDICATOR_SET_COLOR(35, 0x00, 0xFF, 0xFF); // D + RGB_MATRIX_INDICATOR_SET_COLOR(34, 0x7A, 0x00, 0xFF); // F - rgb_matrix_set_color(userspace_config.swapped_numbers ? 27 : 26, 0xFF, 0xFF, 0xFF); // 1 - rgb_matrix_set_color(userspace_config.swapped_numbers ? 26 : 27, 0x00, 0xFF, 0x00); // 2 - rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 + RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 26 : 27), 0xFF, 0xFF, 0xFF); // 1 + RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 27 : 26), 0x00, 0xFF, 0x00); // 2 + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0x7A, 0x00, 0xFF); // 3 } -# if defined(RGBLIGHT_ENABLE) - if (!userspace_config.rgb_layer_change) -# else - if (userspace_config.rgb_layer_change) -# endif - { + + if (userspace_config.rgb_layer_change) { bool mods_enabled = IS_LAYER_ON(_MODS); switch (get_highest_layer(layer_state|default_layer_state)) { case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max); break; case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; } } @@ -517,6 +512,7 @@ void rgb_matrix_indicators_user(void) { #endif // RGB_MATRIX_INIT +#ifdef TAPPING_TERM_PER_KEY uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { if (mod_config(keycode & 0xf) & MOD_MASK_ALT) { @@ -525,3 +521,4 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { } return TAPPING_TERM; } +#endif diff --git a/layouts/community/ergodox/drashna/visualizer.c b/layouts/community/ergodox/drashna/visualizer.c new file mode 100644 index 0000000000..6b1c3ff498 --- /dev/null +++ b/layouts/community/ergodox/drashna/visualizer.c @@ -0,0 +1,77 @@ +/* +Copyright 2017 Fred Sundvik + +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 . +*/ + +#include "./simple_visualizer.h" +#include "util.h" +#include "drashna.h" +#include "rgblight_list.h" + +#define LCD_COLOR_wrapper(...) LCD_COLOR(__VA_ARGS__) +// This function should be implemented by the keymap visualizer +// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing +// that the simple_visualizer assumes that you are updating +// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is +// stopped. This can be done by either double buffering it or by using constant strings +static void get_visualizer_layer_and_color(visualizer_state_t* state) { + + switch(get_highest_layer(state->status.layer|default_layer_state)) { + case _LOWER: + state->layer_text = "Lower"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_GREEN); + break; + case _RAISE: + state->layer_text = "Raise"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_YELLOW); + break; + case _ADJUST: + state->layer_text = "Adjust"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); + break; + case _MACROS: + state->layer_text = "Macros"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); + break; + case _MEDIA: + state->layer_text = "Media"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_CHARTREUSE); + break; + case _GAMEPAD: + state->layer_text = "Game"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); + break; + case _QWERTY: + state->layer_text = "QWERTY"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_CYAN); + break; + case _WORKMAN: + state->layer_text = "Workman"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_GOLDENROD); + break; + case _DVORAK: + state->layer_text = "Dvorak"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_SPRINGGREEN); + break; + case _COLEMAK: + state->layer_text = "Colemak"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_MAGENTA); + break; break; + default: + state->layer_text = "NONE"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); + break; + } +} diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 6a99fcda01..4a1d1babe2 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -77,6 +77,8 @@ # define PRODUCT Drashna Hacked Planck EZ # endif #endif +#undef NO_USB_STARTUP_CHECK + #define EEPROM_I2C_RM24C512C diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 8070a7d35e..d0df7f5c37 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -16,9 +16,6 @@ #include "drashna.h" -#ifdef RGBLIGHT_ENABLE -extern rgblight_config_t rgblight_config; -#endif #ifdef BACKLIGHT_ENABLE enum planck_keycodes { @@ -231,7 +228,8 @@ void suspend_wakeup_init_keymap(void) { } // clang-format on -void rgb_matrix_indicators_user(void) { + +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { uint8_t this_mod = get_mods(); uint8_t this_led = host_keyboard_leds(); uint8_t this_osm = get_oneshot_mods(); @@ -240,8 +238,6 @@ void rgb_matrix_indicators_user(void) { is_ez = true; # endif - if (g_suspend_state || !rgb_matrix_config.enable) return; - # if defined(RGBLIGHT_ENABLE) if (!userspace_config.rgb_layer_change) # else @@ -250,46 +246,46 @@ void rgb_matrix_indicators_user(void) { { switch (get_highest_layer(layer_state)) { case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max); break; case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; default: { bool mods_enabled = IS_LAYER_ON(_MODS); switch (get_highest_layer(default_layer_state)) { case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; } break; @@ -299,35 +295,35 @@ void rgb_matrix_indicators_user(void) { switch (get_highest_layer(default_layer_state)) { case _QWERTY: - rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0xFF); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0x00, 0xFF, 0xFF); break; case _COLEMAK: - rgb_matrix_set_color(is_ez ? 41 : 42, 0xFF, 0x00, 0xFF); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0xFF, 0x00, 0xFF); break; case _DVORAK: - rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0x00, 0xFF, 0x00); break; case _WORKMAN: - rgb_matrix_set_color(is_ez ? 41 : 42, 0xD9, 0xA5, 0x21); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0xD9, 0xA5, 0x21); break; } if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { if (!layer_state_cmp(layer_state, _ADJUST)) { - rgb_matrix_set_color(24, 0x00, 0xFF, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0x00, 0xFF, 0x00); } - rgb_matrix_set_color(36, 0x00, 0xFF, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(36, 0x00, 0xFF, 0x00); } if ((this_mod | this_osm) & MOD_MASK_CTRL) { - rgb_matrix_set_color(25, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(34, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(37, 0xFF, 0x00, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0xFF, 0x00, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(34, 0xFF, 0x00, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(37, 0xFF, 0x00, 0x00); } if ((this_mod | this_osm) & MOD_MASK_GUI) { - rgb_matrix_set_color(39, 0xFF, 0xD9, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(39, 0xFF, 0xD9, 0x00); } if ((this_mod | this_osm) & MOD_MASK_ALT) { - rgb_matrix_set_color(38, 0x00, 0x00, 0xFF); + RGB_MATRIX_INDICATOR_SET_COLOR(38, 0x00, 0x00, 0xFF); } } diff --git a/layouts/community/split_3x6_3/drashna/config.h b/layouts/community/split_3x6_3/drashna/config.h index 7db51fb6e9..b9b1d073d6 100644 --- a/layouts/community/split_3x6_3/drashna/config.h +++ b/layouts/community/split_3x6_3/drashna/config.h @@ -19,14 +19,11 @@ /* Select hand configuration */ // #define MASTER_LEFT -// #define MASTER_RIGHT -#define EE_HANDS - +#define MASTER_RIGHT +// #define EE_HAND #undef USE_I2C #undef SSD1306OLED -#define USE_SERIAL_PD2 - // #define TAPPING_FORCE_HOLD // #define TAPPING_TERM 100 @@ -41,6 +38,10 @@ #endif #ifdef RGB_MATRIX_ENABLE +# ifdef CONVERT_TO_PROTON_C +# undef RGB_DI_PIN +# define RGB_DI_PIN PAL_LINE(GPIOA, 3) +# endif # 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 @@ -54,6 +55,24 @@ # define RGB_MATRIX_SPD_STEP 10 #endif +#ifdef CONVERT_TO_PROTON_C +# define WS2812_PWM_DRIVER PWMD15 // default: PWMD2 +# define WS2812_PWM_CHANNEL 2 // default: 2 +# define WS2812_PWM_PAL_MODE 9 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 +# define WS2812_DMA_STREAM STM32_DMA1_STREAM5 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMA_CHANNEL 5 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM15_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. + +# undef SOFT_SERIAL_PIN +# define SOFT_SERIAL_PIN D3 +# define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 +# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 + + +// #define INIT_EE_HANDS_LEFT +// #define INIT_EE_HANDS_RIGHT +#endif + #ifdef AUDIO_ENABLE # define B6_AUDIO # define NO_MUSIC_MODE @@ -64,8 +83,11 @@ #endif #undef PRODUCT -#define PRODUCT Drashna Hacked Corne Keyboard - +#ifdef CONVERT_TO_PROTON_C +# define PRODUCT Drashna Hacked ARM Corne Keyboard +#else +# define PRODUCT Drashna Hacked Corne Keyboard +#endif #define OLED_FONT_H "layouts/community/split_3x6_3/drashna/glcdfont.c" // #define OLED_FONT_WIDTH 5 // #define OLED_FONT_HEIGHT 7 diff --git a/layouts/community/split_3x6_3/drashna/halconf.h b/layouts/community/split_3x6_3/drashna/halconf.h new file mode 100644 index 0000000000..b099320b30 --- /dev/null +++ b/layouts/community/split_3x6_3/drashna/halconf.h @@ -0,0 +1,22 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * 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 3 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 . + */ +#pragma once + +// #define HAL_USE_DAC TRUE +#define HAL_USE_PWM TRUE +#define HAL_USE_SERIAL TRUE + +#include_next diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c index e53d053973..513cc7f7dc 100644 --- a/layouts/community/split_3x6_3/drashna/keymap.c +++ b/layouts/community/split_3x6_3/drashna/keymap.c @@ -16,11 +16,6 @@ #include "drashna.h" -#ifdef RGBLIGHT_ENABLE -// Following line allows macro to read current RGB settings -extern rgblight_config_t rgblight_config; -#endif - enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; /* @@ -31,6 +26,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; * of use. K## is a placeholder to pass through the individual keycodes */ +// clang-format off #define LAYOUT_split_3x6_3_base( \ K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ @@ -40,7 +36,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ - KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI \ + RGB_MOD, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI \ ) #define LAYOUT_split_3x6_3_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__) @@ -123,31 +119,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { -#ifndef SPLIT_KEYBOARD - if (keycode == RESET && !is_master) { - return false; - } -#endif - } - return true; -} - #ifdef OLED_DRIVER_ENABLE oled_rotation_t oled_init_user(oled_rotation_t rotation) { -# ifndef SPLIT_KEYBOARD - if (is_master) { -# endif + if (is_keyboard_master()) { return OLED_ROTATION_270; -# ifndef SPLIT_KEYBOARD - } else { + } else { return rotation; } -# endif } #endif +#ifdef TAPPING_TERM_PER_KEY uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case ALT_T(KC_A): @@ -156,75 +138,74 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; } } +#endif + + +void matrix_slave_scan_user(void) { +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_task(); +#endif +} #ifdef RGB_MATRIX_ENABLE - void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } -void check_default_layer(uint8_t mode, uint8_t type) { +void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { switch (get_highest_layer(default_layer_state)) { case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_CYAN, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_MAGENTA, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_GOLDENROD, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_CORAL, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_YELLOW, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_PINK, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_BLUE, mode, rgb_matrix_config.speed, type, led_min, led_max); break; } } -void rgb_matrix_indicators_user(void) { - if (userspace_config.rgb_layer_change && -# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - !g_suspend_state && -# endif -# if defined(RGBLIGHT_ENABLE) - (!rgblight_config.enable && rgb_matrix_config.enable) -# else - rgb_matrix_config.enable -# endif - ) { +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (!is_keyboard_master()) return; + if (userspace_config.rgb_layer_change) { switch (get_highest_layer(layer_state)) { case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); + rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); break; case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); + rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); break; case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); + rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); break; case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); + rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); break; case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW); + rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); break; default: { - check_default_layer(IS_LAYER_ON(_MODS), LED_FLAG_UNDERGLOW); + check_default_layer(IS_LAYER_ON(_MODS), LED_FLAG_UNDERGLOW, led_min, led_max); break; } } - check_default_layer(0, LED_FLAG_MODIFIER); + check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max); } } #endif diff --git a/layouts/community/split_3x6_3/drashna/mcuconf.h b/layouts/community/split_3x6_3/drashna/mcuconf.h new file mode 100644 index 0000000000..429e4e1cdd --- /dev/null +++ b/layouts/community/split_3x6_3/drashna/mcuconf.h @@ -0,0 +1,32 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * 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 3 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 . + */ +#pragma once + +#include_next + +// #undef STM32_HSE_ENABLED +// #define STM32_HSE_ENABLED FALSE +#undef STM32_GPT_USE_TIM15 +#define STM32_GPT_USE_TIM15 FALSE + +#undef STM32_PWM_USE_TIM15 +#define STM32_PWM_USE_TIM15 TRUE + +#undef STM32_SERIAL_USE_USART1 +#define STM32_SERIAL_USE_USART1 TRUE + +#undef STM32_PWM_TIM15_IRQ_PRIORITY +#define STM32_PWM_TIM15_IRQ_PRIORITY 16 diff --git a/layouts/community/split_3x6_3/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk index 46f543f4e8..5358cb0ac8 100644 --- a/layouts/community/split_3x6_3/drashna/rules.mk +++ b/layouts/community/split_3x6_3/drashna/rules.mk @@ -3,7 +3,7 @@ # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = no # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) @@ -20,9 +20,15 @@ SWAP_HANDS_ENABLE = no # Enable one-hand typing # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -ifeq ($(strip $(KEYBOARD)), crkbd/rev1) +ifeq ($(strip $(KEYBOARD)), crkbd/rev1/common) OLED_DRIVER_ENABLE = yes RGB_MATRIX_ENABLE = yes HAPTIC_ENABLE = SOLENOID BOOTLOADER = qmk-dfu endif + +ifeq ($(strip $(CTPC)), yes) + HAPTIC_ENABLE = no + WS2812_DRIVER = pwm + SERIAL_DRIVER = usart +endif diff --git a/layouts/community/split_3x6_3/drashna/ssd1306.c b/layouts/community/split_3x6_3/drashna/ssd1306.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/users/drashna/config.h b/users/drashna/config.h index 9fc65e5c90..8837ca0a56 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -22,6 +22,10 @@ /* Set Polling rate to 1000Hz */ #define USB_POLLING_INTERVAL_MS 1 +#if defined(SPLIT_KEYBOAD) +# define SPLIT_MODS_ENABLE +#endif + #ifdef AUDIO_ENABLE # define AUDIO_CLICKY @@ -40,9 +44,9 @@ #endif // !AUDIO_ENABLE #ifdef RGBLIGHT_ENABLE -# undef RGBLIGHT_ANIMATIONS +# define RGBLIGHT_SLEEP # if defined(__AVR__) && !defined(__AVR_AT90USB1286__) -# define RGBLIGHT_SLEEP +# undef RGBLIGHT_ANIMATIONS # define RGBLIGHT_EFFECT_BREATHING # define RGBLIGHT_EFFECT_SNAKE # define RGBLIGHT_EFFECT_KNIGHT @@ -101,6 +105,14 @@ # endif // AVR #endif // RGB_MATRIX_ENABLE +#ifdef OLED_DRIVER_ENABLE +# ifdef SPLIT_KEYBOARD +# define OLED_UPDATE_INTERVAL 60 +# else +# define OLED_UPDATE_INTERVAL 15 +# endif +#endif + #ifndef ONESHOT_TAP_TOGGLE # define ONESHOT_TAP_TOGGLE 2 #endif // !ONESHOT_TAP_TOGGLE diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index ec6484621d..95c9d2f625 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -49,21 +49,6 @@ bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this return false; } -void bootmagic_lite(void) { - matrix_scan(); -#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0 - wait_ms(DEBOUNCING_DELAY * 2); -#elif defined(DEBOUNCE) && DEBOUNCE > 0 - wait_ms(DEBOUNCE * 2); -#else - wait_ms(30); -#endif - matrix_scan(); - if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) { - bootloader_jump(); - } -} - __attribute__((weak)) void keyboard_pre_init_keymap(void) {} void keyboard_pre_init_user(void) { @@ -75,6 +60,7 @@ void keyboard_pre_init_user(void) { // customization of the keymap. Use _keymap instead of _user // functions in the keymaps __attribute__((weak)) void matrix_init_keymap(void) {} +__attribute__((weak)) void matrix_init_secret(void) {} // Call user matrix init, set default RGB colors and then // call the keymap's init function @@ -86,6 +72,8 @@ void matrix_init_user(void) { DDRB &= ~(1 << 0); PORTB &= ~(1 << 0); #endif + + matrix_init_secret(); matrix_init_keymap(); } @@ -103,7 +91,9 @@ void keyboard_post_init_user(void) { __attribute__((weak)) void shutdown_keymap(void) {} +#ifdef RGB_MATRIX_ENABLE void rgb_matrix_update_pwm_buffers(void); +#endif void shutdown_user(void) { #ifdef RGBLIGHT_ENABLE @@ -129,6 +119,8 @@ void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } __attribute__((weak)) void matrix_scan_keymap(void) {} +__attribute__((weak)) void matrix_scan_secret(void) {} + // No global matrix scan code, so just run keymap's matrix // scan function void matrix_scan_user(void) { @@ -149,6 +141,8 @@ void matrix_scan_user(void) { matrix_scan_rgb_matrix(); #endif + matrix_scan_secret(); + matrix_scan_keymap(); } @@ -157,6 +151,8 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) // on layer change, no matter where the change was initiated // Then runs keymap's layer change check layer_state_t layer_state_set_user(layer_state_t state) { + if (!is_keyboard_master()) { return state; } + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); #if defined(RGBLIGHT_ENABLE) state = layer_state_set_rgb_light(state); @@ -168,6 +164,8 @@ __attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t // Runs state check and changes underglow color and animation layer_state_t default_layer_state_set_user(layer_state_t state) { + if (!is_keyboard_master()) { return state; } + state = default_layer_state_set_keymap(state); #if 0 # if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 772005a034..35d11101d6 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -17,7 +17,6 @@ #pragma once #include QMK_KEYBOARD_H -#include "version.h" #include "eeprom.h" #include "wrappers.h" #include "process_records.h" @@ -58,13 +57,17 @@ enum userspace_layers { _ADJUST, }; +#define _MOUSE _MACROS + bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed); bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); void matrix_init_keymap(void); +void matrix_init_secret(void); void shutdown_keymap(void); void suspend_power_down_keymap(void); void suspend_wakeup_init_keymap(void); void matrix_scan_keymap(void); +void matrix_scan_secret(void); layer_state_t layer_state_set_keymap(layer_state_t state); layer_state_t default_layer_state_set_keymap(layer_state_t state); void led_set_keymap(uint8_t usb_led); diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index 46288aad2f..30eb068f77 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c @@ -16,8 +16,6 @@ #include "drashna.h" -extern uint8_t is_master; - #ifndef KEYLOGGER_LENGTH // # ifdef OLED_DISPLAY_128X64 # define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH)) @@ -187,11 +185,11 @@ void render_bootmagic_status(void) { }; bool is_bootmagic_on; - #ifdef OLED_DISPLAY_128X64 +#ifdef OLED_DISPLAY_128X64 is_bootmagic_on = !keymap_config.swap_lctl_lgui; - #else +#else is_bootmagic_on = keymap_config.swap_lctl_lgui; - #endif +#endif oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false); #ifdef OLED_DISPLAY_128X64 @@ -259,21 +257,20 @@ void render_status_secondary(void) { #if !defined(SPLIT_TRANSPORT_MIRROR) || defined(OLED_DISPLAY_128X64) oled_driver_render_logo(); #endif -#ifdef SPLIT_TRANSPORT_MIRROR /* Show Keyboard Layout */ render_default_layer_state(); render_layer_state(); render_mod_status(get_mods() | get_oneshot_mods()); render_keylogger_status(); -#endif } // clang-format on void render_status_main(void) { + oled_driver_render_logo(); /* Show Keyboard Layout */ render_default_layer_state(); - render_keylock_status(host_keyboard_leds()); + // render_keylock_status(host_keyboard_leds()); render_bootmagic_status(); render_user_status(); @@ -281,19 +278,15 @@ void render_status_main(void) { } void oled_task_user(void) { - if (timer_elapsed32(oled_timer) > 30000) { - oled_off(); - return; - } -#ifndef SPLIT_KEYBOARD - else { - oled_on(); - } -#endif - update_log(); - if (is_master) { + if (is_keyboard_master()) { + if (timer_elapsed32(oled_timer) > 30000) { + oled_off(); + return; + } else { + oled_on(); + } render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) } else { render_status_secondary(); diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 19bdef73f1..14fda92dea 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -15,6 +15,7 @@ */ #include "drashna.h" +#include "version.h" uint16_t copy_paste_timer; @@ -27,11 +28,7 @@ __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t bool process_record_user(uint16_t keycode, keyrecord_t *record) { // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE -# if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2) - xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed); -# else - xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); -# endif + uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); #endif // KEYLOGGER_ENABLE #ifdef OLED_DRIVER_ENABLE process_record_user_oled(keycode, record); diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index d41be962df..e59e2242ef 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h @@ -17,7 +17,7 @@ #pragma once #include "drashna.h" -#if defined(KEYMAP_SAFE_RANGE) +#if defined(KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball) # define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE #else # define PLACEHOLDER_SAFE_RANGE SAFE_RANGE diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c index 52e2612340..573cc7bc9d 100644 --- a/users/drashna/rgb_matrix_stuff.c +++ b/users/drashna/rgb_matrix_stuff.c @@ -26,7 +26,7 @@ static uint32_t hypno_timer; # define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN #endif -void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type) { +void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) { HSV hsv = {hue, sat, val}; if (hsv.v > rgb_matrix_get_val()) { hsv.v = rgb_matrix_get_val(); @@ -40,7 +40,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode RGB rgb = hsv_to_rgb(hsv); for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } } break; @@ -50,7 +50,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode RGB rgb = hsv_to_rgb(hsv); for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { - rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } } break; diff --git a/users/drashna/rgb_matrix_stuff.h b/users/drashna/rgb_matrix_stuff.h index 592f9c9e63..b86f2f6514 100644 --- a/users/drashna/rgb_matrix_stuff.h +++ b/users/drashna/rgb_matrix_stuff.h @@ -22,4 +22,4 @@ void keyboard_post_init_rgb_matrix(void); void matrix_scan_rgb_matrix(void); void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); -void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type); +void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max); diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index d98f7cc2f8..b67f707b65 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -178,7 +178,11 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) { uint8_t mode = layer_state_cmp(state,_MODS) ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT; switch (get_highest_layer(state|default_layer_state)) { case _MACROS: - rgblight_set_hsv_and_mode(HSV_ORANGE, userspace_config.is_overwatch ? RGBLIGHT_MODE_SNAKE + 2 : RGBLIGHT_MODE_SNAKE + 3); +# ifdef RGBLIGHT_EFFECT_TWINKLE + rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_TWINKLE + 5); +# else + rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3); +# endif break; case _MEDIA: rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1); diff --git a/users/drashna/wrappers.h b/users/drashna/wrappers.h index ed4022aaab..d135f44af3 100644 --- a/users/drashna/wrappers.h +++ b/users/drashna/wrappers.h @@ -162,6 +162,15 @@ NOTE: These are all the same length. If you do a search/replace #define _________________WHITE_L3__________________ KC_X, KC_R, KC_F, KC_DOT, KC_Z +#define _________________HALMAK_L1_________________ KC_W, KC_L, KC_R, KC_B, KC_Z +#define _________________HALMAK_L2_________________ KC_S, KC_H, KC_N, KC_T, KC_COMM +#define _________________HALMAK_L3_________________ KC_F, KC_M, KC_V, KC_V, KC_SLASH + +#define _________________HALMAK_R1_________________ KC_SCLN, KC_Q, KC_U, KC_D, KC_J +#define _________________HALMAK_R2_________________ KC_DOT, KC_A, KC_E, KC_O, KC_I +#define _________________HALMAK_R3_________________ KC_G, KC_P, KC_X, KC_K, KC_Y + + #define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 #define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 #define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5