forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Keymap] Drashna's Hardware Features Experimentations (qmk#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
- Loading branch information
Showing
23 changed files
with
382 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POINTING_DEVICE_ENABLE = yes | ||
RGBLIGHT_ENABLE = no | ||
CONSOLE_ENABLE = no | ||
|
||
BOOTLOADER = qmk-dfu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @drashna's keymap for the C39 | ||
|
||
HERE BE DRAGONS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.