From e3a21348c3879c11072c7c42d3b4d04b022f4fe2 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 16 Oct 2019 13:11:22 -0700 Subject: [PATCH] [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 --- .../nano/keymaps/drashna/keymap.c | 111 ++++++++++++++++++ .../nano/keymaps/drashna/rules.mk | 5 + keyboards/c39/keymaps/drashna/config.h | 7 ++ keyboards/c39/keymaps/drashna/keymap.c | 45 +++++++ keyboards/c39/keymaps/drashna/readme.md | 3 + keyboards/c39/keymaps/drashna/rules.mk | 18 +++ keyboards/crkbd/keymaps/drashna/config.h | 10 +- keyboards/crkbd/keymaps/drashna/keymap.c | 51 +++++--- keyboards/crkbd/keymaps/drashna/rules.mk | 1 + .../keebio/iris/keymaps/drashna/keymap.c | 4 +- .../keebio/iris/keymaps/drashna_lp/config.h | 13 +- layouts/community/ergodox/drashna/config.h | 2 +- layouts/community/ergodox/drashna/rules.mk | 6 +- .../community/ergodox/drashna_glow/config.h | 3 + .../community/ergodox/drashna_glow/rules.mk | 6 +- layouts/community/ortho_4x12/drashna/config.h | 65 +++++++++- layouts/community/ortho_4x12/drashna/keymap.c | 7 +- layouts/community/ortho_4x12/drashna/rules.mk | 39 +++--- layouts/community/ortho_5x12/drashna/rules.mk | 12 +- users/drashna/drashna.c | 7 ++ users/drashna/drashna.h | 1 + users/drashna/process_records.h | 38 +++--- users/drashna/rules.mk | 13 +- 23 files changed, 382 insertions(+), 85 deletions(-) create mode 100644 keyboards/40percentclub/nano/keymaps/drashna/keymap.c create mode 100644 keyboards/40percentclub/nano/keymaps/drashna/rules.mk create mode 100755 keyboards/c39/keymaps/drashna/config.h create mode 100755 keyboards/c39/keymaps/drashna/keymap.c create mode 100755 keyboards/c39/keymaps/drashna/readme.md create mode 100644 keyboards/c39/keymaps/drashna/rules.mk diff --git a/keyboards/40percentclub/nano/keymaps/drashna/keymap.c b/keyboards/40percentclub/nano/keymaps/drashna/keymap.c new file mode 100644 index 0000000000..6c5b974572 --- /dev/null +++ b/keyboards/40percentclub/nano/keymaps/drashna/keymap.c @@ -0,0 +1,111 @@ +#include QMK_KEYBOARD_H +#include "drashna.h" +#include "analog.c" +#include "pointing_device.h" +#include "pincontrol.h" + + +#define KC_X0 LT(_FN, KC_ESC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_VOLU, KC_MPLY, KC_MPRV, RESET, + KC_VOLD, KC_MUTE, KC_MNXT, RESET + ), + +}; + +// Joystick +// Set Pins +uint8_t xPin = 8; // VRx / /B4 +uint8_t yPin = 7; // VRy // B5 +uint8_t swPin = E6; // SW + +// Set Parameters +uint16_t minAxisValue = 0; +uint16_t maxAxisValue = 1023; + +uint8_t maxCursorSpeed = 2; +uint8_t precisionSpeed = 1; +uint8_t speedRegulator = 20; // Lower Values Create Faster Movement + +int8_t xPolarity = 1; +int8_t yPolarity = 1; + +uint8_t cursorTimeout = 10; + +int16_t xOrigin, yOrigin; + +uint16_t lastCursor = 0; + +int16_t axisCoordinate(uint8_t pin, uint16_t origin) { + int8_t direction; + int16_t distanceFromOrigin; + int16_t range; + + int16_t position = analogRead(pin); + + if (origin == position) { + return 0; + } else if (origin > position) { + distanceFromOrigin = origin - position; + range = origin - minAxisValue; + direction = -1; + } else { + distanceFromOrigin = position - origin; + range = maxAxisValue - origin; + direction = 1; + } + + float percent = (float)distanceFromOrigin / range; + int16_t coordinate = (int16_t)(percent * 100); + if (coordinate < 0) { + return 0; + } else if (coordinate > 100) { + return 100 * direction; + } else { + return coordinate * direction; + } +} + +int8_t axisToMouseComponent(uint8_t pin, int16_t origin, uint8_t maxSpeed, int8_t polarity) { + int coordinate = axisCoordinate(pin, origin); + if (coordinate == 0) { + return 0; + } else { + float percent = (float)coordinate / 100; + if (keyboard_report->mods & MOD_BIT(KC_LSFT)) { + return percent * precisionSpeed * polarity * (abs(coordinate) / speedRegulator); + } else { + return percent * maxCursorSpeed * polarity * (abs(coordinate) / speedRegulator); + } + } +} + +void pointing_device_task(void) { + report_mouse_t report = pointing_device_get_report(); + + // todo read as one vector + if (timer_elapsed(lastCursor) > cursorTimeout) { + lastCursor = timer_read(); + report.x = axisToMouseComponent(xPin, xOrigin, maxCursorSpeed, xPolarity); + report.y = axisToMouseComponent(yPin, yOrigin, maxCursorSpeed, yPolarity); + } + // + if (!readPin(swPin)) { + report.buttons |= MOUSE_BTN1; + } else { + report.buttons &= ~MOUSE_BTN1; + } + + pointing_device_set_report(report); + pointing_device_send(); +} + +void matrix_init_keymap(void) { + // init pin? Is needed? + setPinInputHigh(swPin); + // Account for drift + xOrigin = analogRead(xPin); + yOrigin = analogRead(yPin); +} diff --git a/keyboards/40percentclub/nano/keymaps/drashna/rules.mk b/keyboards/40percentclub/nano/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..06110a0a2e --- /dev/null +++ b/keyboards/40percentclub/nano/keymaps/drashna/rules.mk @@ -0,0 +1,5 @@ +POINTING_DEVICE_ENABLE = yes +RGBLIGHT_ENABLE = no +CONSOLE_ENABLE = no + +BOOTLOADER = qmk-dfu diff --git a/keyboards/c39/keymaps/drashna/config.h b/keyboards/c39/keymaps/drashna/config.h new file mode 100755 index 0000000000..361f68a78e --- /dev/null +++ b/keyboards/c39/keymaps/drashna/config.h @@ -0,0 +1,7 @@ +#pragma once + +// place overrides here +#undef MATRIX_COL_PINS +#define MATRIX_COL_PINS { A3, A2, A1, A0, B13, B14, B15, B9, B3, B2, B4, A10, A9 } +#undef MATRIX_ROW_PINS +#define MATRIX_ROW_PINS { B7, B1, B0 } diff --git a/keyboards/c39/keymaps/drashna/keymap.c b/keyboards/c39/keymaps/drashna/keymap.c new file mode 100755 index 0000000000..9de75190d0 --- /dev/null +++ b/keyboards/c39/keymaps/drashna/keymap.c @@ -0,0 +1,45 @@ +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _FN1 1 + +// Defines for task manager and such +#define CALTDEL LCTL(LALT(KC_DEL)) +#define TSKMGR LCTL(LSFT(KC_ESC)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,----------------------------------------------------------------------------. ,-------------. + * | Q | W | E | R | T | Bksp | Y | U | I | O | P | | M1 | M2 | + * |------+------+------+------+------+------+------+------+------+------+------+ |------+------| + * | A | S | D | F | G | Enter| H | J | K | L | ; | | M3 | M4 | + * |------+------+------+------+------+------+------+------+------+------+------+ |------+------| + * | Z | X | C | V | B | FN1 | N | M | , | . | / | | M5 | M6 | + * `----------------------------------------------------------------------------' `-------------' + */ +[_QWERTY] = LAYOUT( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_1, KC_2, + KC_A, KC_S, KC_D, KC_F, KC_G, MT(MOD_LSFT, KC_ENT), KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_3, KC_4, + KC_Z, KC_X, KC_C, KC_V, KC_B, LT(_FN1, KC_SPC), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_5, KC_6 +), + +/* FN1 + * ,----------------------------------------------------------------------------. ,-------------. + * | 1 | 2 | 3 | 4 | 5 | Bksp | 6 | 7 | 8 | 9 | 0 | | M1 | M2 | + * |------+------+------+------+------+------+------+------+------+------+------+ |------+------| + * | 4 | 5 | 6 | + | | Enter| | | | | | | M3 | M4 | + * |------+------+------+------+------+------+------+------+------+------+------+ |------+------| + * | 7 | 8 | 9 | 0 | | FN1 | | | | | | | M5 | M6 | + * `----------------------------------------------------------------------------' `-------------' + */ +[_FN1] = LAYOUT( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_BSPC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_1, KC_2, + KC_4, KC_5, KC_6, KC_PLUS, _______, KC_ENT, _______, _______, _______, _______, _______, KC_3, KC_4, + KC_7, KC_8, KC_9, KC_0, _______, _______, _______, _______, _______, _______, _______, KC_5, KC_6 +), +}; diff --git a/keyboards/c39/keymaps/drashna/readme.md b/keyboards/c39/keymaps/drashna/readme.md new file mode 100755 index 0000000000..a8efbaa5fe --- /dev/null +++ b/keyboards/c39/keymaps/drashna/readme.md @@ -0,0 +1,3 @@ +# @drashna's keymap for the C39 + +HERE BE DRAGONS diff --git a/keyboards/c39/keymaps/drashna/rules.mk b/keyboards/c39/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..ae0cc9efee --- /dev/null +++ b/keyboards/c39/keymaps/drashna/rules.mk @@ -0,0 +1,18 @@ +MCU = STM32F303 +BOOTLOADER = + +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI controls +UNICODE_ENABLE = yes # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = yes # Audio output on port C6 +RGBLIGHT_ENABLE = no # RGB Enable / Disable 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 diff --git a/keyboards/keebio/iris/keymaps/drashna/keymap.c b/keyboards/keebio/iris/keymaps/drashna/keymap.c index 28783dd8af..de19f7ca08 100644 --- a/keyboards/keebio/iris/keymaps/drashna/keymap.c +++ b/keyboards/keebio/iris/keymaps/drashna/keymap.c @@ -77,11 +77,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_GAMEPAD] = LAYOUT_wrapper( - KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_P, _______, _______, _______, _______, _______, _______, + KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, _______, _______, _______, _______, _______, _______, KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, TG_GAME, _______, _______, _______, _______, _______, _______, _______, - LOWER, KC_V, KC_SPC, _______, _______, _______ + KC_GRV, KC_V, KC_SPC, _______, _______, _______ ), diff --git a/keyboards/keebio/iris/keymaps/drashna_lp/config.h b/keyboards/keebio/iris/keymaps/drashna_lp/config.h index d59890b46a..5370d88ed4 100644 --- a/keyboards/keebio/iris/keymaps/drashna_lp/config.h +++ b/keyboards/keebio/iris/keymaps/drashna_lp/config.h @@ -21,15 +21,16 @@ along with this program. If not, see . #include "../drashna/config.h" #ifdef RGBLIGHT_ENABLE -# undef RGBLED_NUM -# define RGBLED_NUM 16 // Number of LEDs -# undef RGBLED_SPLIT -# define RGBLED_SPLIT { 8, 8 } +# undef RGBLED_NUM +# define RGBLED_NUM 16 // Number of LEDs +# undef RGBLED_SPLIT +# define RGBLED_SPLIT \ + { 8, 8 } #endif #undef PRODUCT #ifdef KEYBOARD_keebio_iris_rev2 -# define PRODUCT Drashna Hacked Iris LP Rev.2 (Backlit) +# define PRODUCT Drashna Hacked Iris LP Rev .2(Backlit) #endif #undef SHFT_LED1 @@ -46,3 +47,5 @@ along with this program. If not, see . #define ALT_LED1 7 #undef GUI_LED1 #define GUI_LED1 8 + +#define DRASHNA_LP diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index 0ccf10c31c..4943832990 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -13,6 +13,6 @@ #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Shine #undef DEBOUNCE -#define DEBOUNCE 15 +#define DEBOUNCE 30 #define TAPPING_TERM_PER_KEY diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk index f14353f4c6..f9f9ea2bab 100644 --- a/layouts/community/ergodox/drashna/rules.mk +++ b/layouts/community/ergodox/drashna/rules.mk @@ -2,9 +2,9 @@ TAP_DANCE_ENABLE = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend COMMAND_ENABLE = no # Commands for debug and configuration SPACE_CADET_ENABLE = no -ifneq (,$(findstring ergodox_ez,$(KEYBOARD))) - RGBLIGHT_ENABLE = yes - RGB_MATRIX_ENABLE = no +ifeq ($(strip $(KEYBOARD)), ergodox_ez) + RGBLIGHT_ENABLE = yes + RGB_MATRIX_ENABLE = no endif CONSOLE_ENABLE = no BOOTMAGIC_ENABLE = yes diff --git a/layouts/community/ergodox/drashna_glow/config.h b/layouts/community/ergodox/drashna_glow/config.h index 28bed20e08..6431cb4ff8 100644 --- a/layouts/community/ergodox/drashna_glow/config.h +++ b/layouts/community/ergodox/drashna_glow/config.h @@ -4,3 +4,6 @@ #undef PRODUCT #define PRODUCT DrashnaDox - Hacked ErgoDox EZ Glow + +#undef RGB_MATRIX_LED_PROCESS_LIMIT +#undef RGB_MATRIX_LED_FLUSH_LIMIT diff --git a/layouts/community/ergodox/drashna_glow/rules.mk b/layouts/community/ergodox/drashna_glow/rules.mk index e1da86443f..45addc7c22 100644 --- a/layouts/community/ergodox/drashna_glow/rules.mk +++ b/layouts/community/ergodox/drashna_glow/rules.mk @@ -6,8 +6,8 @@ SRC += $(CORRECTED_LAYOUT)/keymap.c -include $(CORRECTED_LAYOUT)/rules.mk -ifneq (,$(findstring ergodox_ez,$(KEYBOARD))) - RGBLIGHT_ENABLE = no - RGB_MATRIX_ENABLE = yes +ifeq ($(strip $(KEYBOARD)), ergodox_ez) + RGBLIGHT_ENABLE = no + RGB_MATRIX_ENABLE = yes # TAP_DANCE_ENABLE = no endif diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 9f3d2b82d6..d8ac5e6d11 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -1,7 +1,7 @@ #pragma once #if defined(RGBLIGHT_ENABLE) && !defined(RGBLED_NUM) -# define RGB_DI_PIN B3 +# define RGB_DI_PIN A0 # define RGBLED_NUM 13 // Number of LEDs # define RGBLIGHT_ANIMATIONS # define RGBLIGHT_HUE_STEP 12 @@ -17,10 +17,12 @@ #ifdef RGB_MATRIX_ENABLE # define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) // #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS // #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects // #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 # define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended +# undef RGB_MATRIX_LED_PROCESS_LIMIT +# undef RGB_MATRIX_LED_FLUSH_LIMIT #endif #if defined(KEYBOARD_lets_split_rev2) @@ -32,7 +34,17 @@ #if !defined(KEYBOARD_planck_light) # ifdef RGBLIGHT_ENABLE # define NO_MUSIC_MODE -# endif // RGBLIGHT_ENABLE +# endif // RGBLIGHT_ENABLE +#else +# undef QMK_ESC_OUTPUT +# define QMK_ESC_OUTPUT E6 // usually COL +# undef QMK_ESC_INPUT +# define QMK_ESC_INPUT B0 // usually ROW +# undef QMK_LED +# define QMK_LED D6 +# undef QMK_SPEAKER +# define QMK_SPEAKER B5 +# define SOLENOID_PIN A1 #endif // KEYBOARD_planck_light #if defined(KEYBOARD_planck) @@ -69,3 +81,50 @@ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ +#define FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ +#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ + +/* default 3V ERM vibration motor voltage and library*/ +#if FB_ERM_LRA == 0 +#define RATED_VOLTAGE 3 +#define V_RMS 2.3 +#define V_PEAK 3.30 +/* Library Selection */ +#define LIB_SELECTION 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ + +/* default 2V LRA voltage and library */ +#elif FB_ERM_LRA == 1 +#define RATED_VOLTAGE 2 +#define V_RMS 2.0 +#define V_PEAK 2.85 +#define F_LRA 200 +/* Library Selection */ +#define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ + +#endif + +/* Control 1 register settings */ +#define DRIVE_TIME 25 +#define AC_COUPLE 0 +#define STARTUP_BOOST 1 + +/* Control 2 Settings */ +#define BIDIR_INPUT 1 +#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ +#define SAMPLE_TIME 3 +#define BLANKING_TIME 1 +#define IDISS_TIME 1 + +/* Control 3 settings */ +#define NG_THRESH 2 +#define ERM_OPEN_LOOP 1 +#define SUPPLY_COMP_DIS 0 +#define DATA_FORMAT_RTO 0 +#define LRA_DRIVE_MODE 0 +#define N_PWM_ANALOG 0 +#define LRA_OPEN_LOOP 0 +/* Control 4 settings */ +#define ZC_DET_TIME 0 +#define AUTO_CAL_TIME 3 diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 26f611c088..1c894c7649 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -24,7 +24,9 @@ extern rgblight_config_t rgblight_config; #ifdef BACKLIGHT_ENABLE enum planck_keycodes { BACKLIT = NEW_SAFE_RANGE, + TH_LVL, }; + #else # define BACKLIT OSM(MOD_LSFT) enum planck_keycodes { @@ -134,7 +136,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RST, VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST, TH_LVL, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL, - _______, _______, _______, _______, _______, KC_NUKE, _______, _______, _______, _______, _______, TG_MODS + HPT_TOG, _______, _______, _______, _______, KC_NUKE, _______, _______, _______, _______, _______, TG_MODS ) }; @@ -298,6 +300,9 @@ void rgb_matrix_indicators_user(void) { } void matrix_init_keymap(void) { +# ifdef KEYBOARD_planck_light + writePinLow(D6); +# endif // rgblight_mode(RGB_MATRIX_MULTISPLASH); } #else // RGB_MATRIX_INIT diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk index 55f3acd70e..d4726b7a84 100644 --- a/layouts/community/ortho_4x12/drashna/rules.mk +++ b/layouts/community/ortho_4x12/drashna/rules.mk @@ -7,29 +7,30 @@ TAP_DANCE_ENABLE = no AUDIO_ENABLE = yes SPACE_CADET_ENABLE = no -ifeq (,$(findstring planck/rev6,$(KEYBOARD))) # Make sure it's NOT the Planck Rev6 - RGBLIGHT_ENABLE = yes - INDICATOR_LIGHTS = yes - RGBLIGHT_TWINKLE = yes - RGBLIGHT_STARTUP_ANIMATION = yes +ifneq ($(strip $(KEYBOARD)), planck/rev6) + RGBLIGHT_ENABLE = yes + INDICATOR_LIGHTS = yes + RGBLIGHT_TWINKLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes endif -ifneq (,$(findstring planck/light,$(KEYBOARD))) # Make sure it IS the Planck Light - RGB_MATRIX_ENABLE = yes - RGBLIGHT_ENABLE = no - RGBLIGHT_STARTUP_ANIMATION = no +ifeq ($(strip $(KEYBOARD)), planck/light) + RGB_MATRIX_ENABLE = yes + RGBLIGHT_ENABLE = no + RGBLIGHT_STARTUP_ANIMATION = no + HAPTIC_ENABLE += SOLENOID endif -ifneq (,$(findstring planck/ez,$(KEYBOARD))) # Make sure it IS the Planck Light - RGBLIGHT_ENABLE = no - # SERIAL_LINK_ENABLE = yes - ENCODER_ENABLE = yes - RGB_MATRIX_ENABLE = IS31FL3737 - INDICATOR_LIGHTS = yes - RGBLIGHT_TWINKLE = yes - RGBLIGHT_STARTUP_ANIMATION = yes +ifeq ($(strip $(KEYBOARD)), planck/ez) + RGBLIGHT_ENABLE = no + # SERIAL_LINK_ENABLE = yes + ENCODER_ENABLE = yes + RGB_MATRIX_ENABLE = IS31FL3737 + INDICATOR_LIGHTS = yes + RGBLIGHT_TWINKLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes endif ifeq ($(strip $(PROTOCOL)), VUSB) -NKRO_ENABLE = no + NKRO_ENABLE = no else -NKRO_ENABLE = yes + NKRO_ENABLE = yes endif diff --git a/layouts/community/ortho_5x12/drashna/rules.mk b/layouts/community/ortho_5x12/drashna/rules.mk index 0606f3e522..75affedd12 100644 --- a/layouts/community/ortho_5x12/drashna/rules.mk +++ b/layouts/community/ortho_5x12/drashna/rules.mk @@ -5,12 +5,12 @@ CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = no # Commands for debug and configuration TAP_DANCE_ENABLE = no AUDIO_ENABLE = yes -ifneq (,$(findstring fractal,$(KEYBOARD))) # Make sure it IS the Planck Light - RGB_MATRIX_ENABLE = no - AUDIO_ENABLE = yes - RGBLIGHT_ENABLE = yes - RGBLIGHT_TWINKLE = yes - BOOTLOADER = qmk-dfu +ifeq ($(strip $(KEYBOARD)), fractal) + RGB_MATRIX_ENABLE = no + AUDIO_ENABLE = yes + RGBLIGHT_ENABLE = yes + RGBLIGHT_TWINKLE = yes + BOOTLOADER = qmk-dfu endif ifeq ($(strip $(PROTOCOL)), VUSB) diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 6a436e0af0..b48d837d00 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -219,3 +219,10 @@ void eeconfig_init_user(void) { eeconfig_init_keymap(); keyboard_init(); } + +bool hasAllBitsInMask(uint8_t value, uint8_t mask) { + value &= 0xF; + mask &= 0xF; + + return (value & mask) == mask; +} diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index e3edf81124..0ccb7614fa 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -60,6 +60,7 @@ 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); void eeconfig_init_keymap(void); +bool hasAllBitsInMask(uint8_t value, uint8_t mask); typedef union { uint32_t raw; diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index 0ae468a04e..cb7ec3ec40 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h @@ -14,21 +14,21 @@ enum userspace_custom_keycodes { KC_DVORAK, // Sets default layer to DVORAK KC_WORKMAN, // Sets default layer to WORKMAN KC_DIABLO_CLEAR, // Clears all Diablo Timers - KC_MAKE, // Run keyboard's customized make command - KC_RGB_T, // Toggles RGB Layer Indication mode - RGB_IDL, // RGB Idling animations - KC_SECRET_1, // test1 - KC_SECRET_2, // test2 - KC_SECRET_3, // test3 - KC_SECRET_4, // test4 - KC_SECRET_5, // test5 - KC_CCCV, // Hold to copy, tap to paste - KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! - UC_FLIP, // (ಠ痊ಠ)┻━┻ - UC_TABL, // ┬─┬ノ( º _ ºノ) - UC_SHRG, // ¯\_(ツ)_/¯ - UC_DISA, // ಠ_ಠ - NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes + KC_MAKE, // Run keyboard's customized make command + KC_RGB_T, // Toggles RGB Layer Indication mode + RGB_IDL, // RGB Idling animations + KC_SECRET_1, // test1 + KC_SECRET_2, // test2 + KC_SECRET_3, // test3 + KC_SECRET_4, // test4 + KC_SECRET_5, // test5 + KC_CCCV, // Hold to copy, tap to paste + KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! + UC_FLIP, // (ಠ痊ಠ)┻━┻ + UC_TABL, // ┬─┬ノ( º _ ºノ) + UC_SHRG, // ¯\_(ツ)_/¯ + UC_DISA, // ಠ_ಠ + NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes }; bool process_record_secrets(uint16_t keycode, keyrecord_t *record); @@ -57,9 +57,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define KC_RST KC_RESET #ifdef SWAP_HANDS_ENABLE -# define KC_C1R3 SH_TT +# define KC_C1R3 SH_T(KC_TAB) +#elif defined(DRASHNA_LP) +# define KC_C1R3 TG(_GAMEPAD) #else // SWAP_HANDS_ENABLE -# define KC_C1R3 KC_BSPC +# define KC_C1R3 KC_TAB #endif // SWAP_HANDS_ENABLE #define BK_LWER LT(_LOWER, KC_BSPC) @@ -79,7 +81,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define OS_RCTL OSM(MOD_RCTL) #define OS_LALT OSM(MOD_LALT) #define OS_RALT OSM(MOD_RALT) -#define OS_MEH OSM(MOD_MEH) +#define OS_MEH OSM(MOD_MEH) #define OS_HYPR OSM(MOD_HYPR) #define ALT_APP ALT_T(KC_APP) diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 7b77a51d96..1b5a863850 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -4,8 +4,13 @@ SRC += drashna.c \ LINK_TIME_OPTIMIZATION_ENABLE = yes SPACE_CADET_ENABLE = no -ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") - SRC += secrets.c +ifneq ($(strip $(NO_SECRETS)), yes) + ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") + SRC += secrets.c + endif + ifeq ($(strip $(NO_SECRETS)), lite) + OPT_DEFS += -DNO_SECRETS + endif endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) @@ -14,9 +19,7 @@ endif -ifeq ($(strip $(NO_SECRETS)), yes) - OPT_DEFS += -DNO_SECRETS -endif + ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += rgb_stuff.c