From e3a21348c3879c11072c7c42d3b4d04b022f4fe2 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 16 Oct 2019 13:11:22 -0700 Subject: [Keymap] Drashna's Hardware Features Experimentations (#6920) * Change RGBLight pin for Planck Light Move it to A0, so that the SPI? pins are available for BT hackery * Add QMK DFU bootloader info * Add Solenoid * Disable annoying white LED on bottom * Enable Solenoid on Corne * Remove bounds for animations * Increase debounce for Ergodox EZ to reduce repeat key issues * Set swap hands key to be a hold-tap key This way, it's not ANNOYING and doesn't swap the hands inteniontally * Move MT Alt in Corne keymap * Re-Add fine tuned control of secrets * Squash mods to single row * Add LRA settings to haptic feedback settings for Rev6 * Fix issue with non-Planck EZ keymaps * Add 40 Percent Nano with Analog Joystick * Add Collide39 keymap * Fix OLED printing to be more flavorful * Fix up Iris GamePad and come cleanup * Expand OLED char map further * Add modded characters to keylogger * Here be dragons Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Fix up rules for community layouts * Some more OLED tweaks * Add mod mask check function * Change QMK DFU Audio pin to be correct * Use manual STM config instead of CTPC for Collide 39 --- keyboards/crkbd/keymaps/drashna/config.h | 10 +++++-- keyboards/crkbd/keymaps/drashna/keymap.c | 51 ++++++++++++++++++++++---------- keyboards/crkbd/keymaps/drashna/rules.mk | 1 + 3 files changed, 43 insertions(+), 19 deletions(-) (limited to 'keyboards/crkbd/keymaps/drashna') diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/keyboards/crkbd/keymaps/drashna/config.h index d35f723dac..26af029573 100644 --- a/keyboards/crkbd/keymaps/drashna/config.h +++ b/keyboards/crkbd/keymaps/drashna/config.h @@ -41,7 +41,7 @@ along with this program. If not, see . # define RGBLIGHT_HUE_STEP 8 # define RGBLIGHT_SAT_STEP 8 # define RGBLIGHT_VAL_STEP 5 -# define RGBLIGHT_LIMIT_VAL 150 +# define RGBLIGHT_LIMIT_VAL 120 #endif #ifdef RGB_MATRIX_ENABLE @@ -51,7 +51,7 @@ along with this program. If not, see . # define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended // # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) // # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 # define RGB_MATRIX_HUE_STEP 8 # define RGB_MATRIX_SAT_STEP 8 # define RGB_MATRIX_VAL_STEP 5 @@ -60,7 +60,11 @@ along with this program. If not, see . #ifdef AUDIO_ENABLE # define B6_AUDIO -// #define NO_MUSIC_MODE +# define NO_MUSIC_MODE +#endif + +#ifdef HAPTIC_ENABLE +# define SOLENOID_PIN B7 #endif #undef PRODUCT diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c index 36a5f5dd33..cd84f0d919 100644 --- a/keyboards/crkbd/keymaps/drashna/keymap.c +++ b/keyboards/crkbd/keymaps/drashna/keymap.c @@ -12,7 +12,25 @@ extern rgblight_config_t rgblight_config; static uint32_t oled_timer = 0; static char keylog_str[6] = {}; static uint16_t log_timer = 0; -static const char code_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', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; +static const char PROGMEM code_to_name[0xFF] = { +// 0 1 2 3 4 5 6 7 8 9 A B c D E F + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x + '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x + ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x + ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx + 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx +}; void add_keylog(uint16_t keycode); #endif @@ -27,7 +45,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; ) \ LAYOUT_wrapper( \ KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ - KC_TAB, ALT_T(K11), K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ + 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 \ ) @@ -107,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET, VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST, MG_NKRO, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL, - _______, KC_NUKE, _______, _______, TG_MODS, _______ + HPT_TOG, KC_NUKE, _______, _______, TG_MODS, HPT_FBK ) }; // clang-format on @@ -131,16 +149,18 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; } void add_keylog(uint16_t keycode) { - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { keycode = keycode & 0xFF; + } else if (keycode > 0xFF) { + keycode = 0; } for (uint8_t i = 4; i > 0; --i) { keylog_str[i] = keylog_str[i - 1]; } - if (keycode < 60) { - keylog_str[0] = code_to_name[keycode]; + if (keycode < (sizeof(code_to_name) / sizeof(char))) { + keylog_str[0] = pgm_read_byte(&code_to_name[keycode]); } log_timer = timer_read(); @@ -148,7 +168,7 @@ void add_keylog(uint16_t keycode) { void update_log(void) { if (timer_elapsed(log_timer) > 750) { - add_keylog(0); + //add_keylog(0); } } @@ -197,19 +217,18 @@ void render_layer_state(void) { void render_keylock_status(uint8_t led_usb_state) { oled_write_P(PSTR("Lock:"), false); oled_write_P(PSTR(" "), false); - oled_write_P(PSTR("NUM "), led_usb_state & (1 << USB_LED_NUM_LOCK)); - oled_write_P(PSTR(" "), false); - oled_write_P(PSTR("CAPS"), led_usb_state & (1 << USB_LED_CAPS_LOCK)); - oled_write_P(PSTR(" "), false); - oled_write_P(PSTR("SCRL"), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); + 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_ln_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); } void render_mod_status(uint8_t modifiers) { oled_write_P(PSTR("Mods:"), false); - oled_write_P(PSTR(" SHFT"), (modifiers & MOD_MASK_SHIFT)); - oled_write_P(PSTR(" CTRL"), (modifiers & MOD_MASK_CTRL)); - oled_write_P(PSTR(" ALT "), (modifiers & MOD_MASK_ALT)); - oled_write_P(PSTR(" GUI "), (modifiers & MOD_MASK_GUI)); + oled_write_P(PSTR(" "), 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 render_bootmagic_status(void) { diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk index af34045971..492c17e20f 100644 --- a/keyboards/crkbd/keymaps/drashna/rules.mk +++ b/keyboards/crkbd/keymaps/drashna/rules.mk @@ -18,6 +18,7 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing RGB_MATRIX_ENABLE = WS2812 +HAPTIC_ENABLE = SOLENOID # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -- cgit v1.2.3