mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-23 17:06:52 +06:00
c66df16644
* Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
313 lines
13 KiB
C
313 lines
13 KiB
C
/* Copyright 2018 Josh Turner (/u/tdl-jturner)
|
|
*
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include QMK_KEYBOARD_H
|
|
|
|
enum xd75_layers {
|
|
_QWERTY,
|
|
_COLEMAK,
|
|
_LYMD,
|
|
_LYFK,
|
|
_LYMED,
|
|
_LYNUM,
|
|
_LYNAV,
|
|
_LYMOS,
|
|
_LYSYS,
|
|
_LYLT
|
|
};
|
|
|
|
enum xd75_keycodes {
|
|
HELP = SAFE_RANGE,
|
|
KC_BSDEL,
|
|
KC_FBSLH,
|
|
KC_DOTQ,
|
|
KC_CPIPE,
|
|
COLEMAK,
|
|
QWERTY,
|
|
KC_LYDEF
|
|
};
|
|
|
|
//Tap Dance Declarations
|
|
enum {
|
|
TD_LOCK_SLEEP,
|
|
TD_ABK,
|
|
TD_BRC,
|
|
TD_CBR,
|
|
};
|
|
|
|
//Tap Dance Definitions
|
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
|
//Tap once for Esc, twice for Caps Lock
|
|
[TD_LOCK_SLEEP] = ACTION_TAP_DANCE_DOUBLE(LGUI(KC_L), KC_SLEP),
|
|
[TD_ABK] = ACTION_TAP_DANCE_DOUBLE(KC_LABK,KC_RABK),
|
|
[TD_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC,KC_RBRC),
|
|
[TD_CBR] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR,KC_RCBR)
|
|
// Other declarations would go here, separated by commas, if you have them
|
|
};
|
|
|
|
//remaps for pretty layouts
|
|
#define ________ KC_TRNS
|
|
#define ___XX___ KC_NO
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
//QWERY - Base Layer
|
|
[_QWERTY] = LAYOUT_ortho_5x15(
|
|
KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 ,________ ,________,________, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,KC_MINUS,
|
|
KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T ,________ ,________,________, KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_BSDEL, //Custom shift Codes. Backspace ^ Delete
|
|
LT(_LYMD,KC_ESC), KC_A , KC_S , KC_D , KC_F , KC_G ,________ ,________,________, KC_H , KC_J , KC_K , KC_L ,KC_SCLN ,KC_QUOT,
|
|
KC_LSPO, KC_Z , KC_X , KC_C , KC_V , KC_B ,________ ,________,________, KC_N , KC_M ,KC_CPIPE,KC_DOTQ ,KC_FBSLH,KC_RSPC, // Custom Shift Codes. ,^| .^? /^|
|
|
KC_MEH ,KC_LCTL ,KC_LGUI ,KC_LALT ,MO(_LYNUM), KC_SPC ,________ ,________,________, KC_ENT ,MO(_LYNAV),TD(TD_CBR) ,TD(TD_BRC),TD(TD_ABK),TD(TD_LOCK_SLEEP)
|
|
|
|
),
|
|
|
|
//_COLEMAK - Colemak Layout - Identical to qwerty layer except for the layout changes
|
|
[_COLEMAK] = LAYOUT_ortho_5x15(
|
|
KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 ,________ ,________,________, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,KC_MINUS,
|
|
KC_TAB , KC_Q , KC_W , KC_F , KC_P , KC_G ,________ ,________,________, KC_J , KC_L , KC_U , KC_Y ,KC_SCLN ,KC_BSDEL, //Custom shift Codes. Backspace ^ Delete
|
|
LT(_LYMD,KC_ESC), KC_A , KC_R , KC_S , KC_T , KC_D ,________ ,________,________, KC_H , KC_N , KC_E , KC_I , KC_O ,KC_QUOT,
|
|
KC_LSPO, KC_Z , KC_X , KC_C , KC_V , KC_B ,________ ,________,________, KC_K , KC_M ,KC_CPIPE,KC_DOTQ ,KC_FBSLH,KC_RSPC, // Custom Shift Codes. ,^| .^? /^|
|
|
KC_MEH ,KC_LCTL ,KC_LGUI ,KC_LALT ,MO(_LYNUM), KC_SPC ,________ ,________,________, KC_ENT ,MO(_LYNAV),TD(TD_CBR) ,TD(TD_BRC),TD(TD_ABK),TD(TD_LOCK_SLEEP)
|
|
|
|
),
|
|
|
|
// Decision Layer
|
|
[_LYMD] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________ ,________ ,________ ,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
________,MO(_LYFK) ,MO(_LYMED),________ ,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,________,
|
|
________,MO(_LYNUM),MO(_LYNAV),________ ,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
________,MO(_LYMOS),MO(_LYSYS),MO(_LYLT) ,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
________,________ ,________ ,________ ,________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___
|
|
),
|
|
|
|
//F Keys
|
|
[_LYFK] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_F7 ,KC_F8 ,KC_F9 ,KC_F12 ,________,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_F4 ,KC_F5 ,KC_F6 ,KC_F11 ,___XX___,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_F1 ,KC_F2 ,KC_F3 ,KC_F10 ,___XX___,
|
|
________,________,________,________,________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___
|
|
),
|
|
//Media Keys
|
|
[_LYMED] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,KC_VOLU ,___XX___,___XX___,________,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_MPRV ,KC_MUTE ,KC_MNXT ,___XX___,___XX___,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,KC_VOLD ,___XX___,KC_MSTP ,___XX___,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_MPLY ,___XX___,___XX___,___XX___,___XX___
|
|
),
|
|
//Num Keys
|
|
[_LYNUM] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_PEQL ,KC_PSLS ,KC_PAST ,KC_PMNS ,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_7 ,KC_8 ,KC_9 ,KC_MINUS,________,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_4 ,KC_5 ,KC_6 ,KC_PPLS ,KC_PSLS,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_1 ,KC_2 ,KC_3 ,KC_PENT ,KC_PAST,
|
|
________,________,________,________,________,________,________,________,________,________,KC_0 ,KC_0 ,KC_PDOT ,KC_PEQL ,___XX___
|
|
),
|
|
//Navigation Keys
|
|
[_LYNAV] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_HOME ,KC_UP ,KC_PGUP ,KC_PSCR ,________,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_LEFT ,KC_F5 ,KC_RIGHT,KC_SLCK ,___XX___,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_END ,KC_DOWN ,KC_PGDN ,KC_PAUS ,___XX___,
|
|
________,________,________,________,________,________,________,________,________,________,________,KC_INS ,KC_DEL ,___XX___,___XX___
|
|
),
|
|
//Mouse Keys
|
|
[_LYMOS] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,KC_MS_U ,KC_WH_U ,KC_ACL2 ,________,
|
|
_______,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,KC_MS_L ,KC_ACL0 ,KC_MS_R ,KC_ACL1 ,___XX___,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,KC_MS_D ,KC_WH_D ,KC_BTN2 ,___XX___,
|
|
________,________,________,________,________,________,________,________,________,________,KC_BTN1 ,KC_BTN3 ,KC_BTN4 ,___XX___,___XX___
|
|
),
|
|
//Systen Keys
|
|
[_LYSYS] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,________,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,QWERTY ,COLEMAK ,___XX___,RESET,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
________,________,________,________,________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___
|
|
),
|
|
|
|
// Light Control
|
|
[_LYLT] =
|
|
LAYOUT_ortho_5x15(
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,___XX___,
|
|
KC_LYDEF,________,________,________,________,________,___XX___,___XX___,___XX___,RGB_HUD ,RGB_HUI ,RGB_SAD ,RGB_SAI ,RGB_VAD ,RGB_VAI,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,RGB_TOG ,RGB_RMOD,RGB_MOD ,___XX___,___XX___,___XX___,
|
|
________,________,________,________,________,________,___XX___,___XX___,___XX___,BL_TOGG ,BL_DEC ,BL_INC ,BL_BRTG ,___XX___,___XX___,
|
|
________,________,________,________,________,________,________,________,________,________,___XX___,___XX___,___XX___,___XX___,___XX___
|
|
)
|
|
};
|
|
|
|
//Define layer colors
|
|
#define rgblight_setrgb_user_base() rgblight_sethsv(325,255,255)
|
|
#define rgblight_setrgb_user_LYFK() rgblight_sethsv_red()
|
|
#define rgblight_setrgb_user_LYMED() rgblight_sethsv_blue()
|
|
#define rgblight_setrgb_user_LYNUM() rgblight_sethsv_purple()
|
|
#define rgblight_setrgb_user_LYNAV() rgblight_sethsv_cyan()
|
|
#define rgblight_setrgb_user_LYMOS() rgblight_sethsv_orange()
|
|
#define rgblight_setrgb_user_LYSYS() rgblight_sethsv_green()
|
|
#define rgblight_setrgb_user_LYLT() rgblight_sethsv_yellow()
|
|
#define rgblight_setrgb_user_LYMD() rgblight_sethsv_white()
|
|
|
|
//initialize rgb
|
|
void matrix_init_user(void) {
|
|
rgblight_enable();
|
|
rgblight_mode(1);
|
|
rgblight_setrgb_user_base();
|
|
}
|
|
|
|
//Set a color based on the layer
|
|
uint32_t layer_state_set_user(uint32_t state) {
|
|
switch(biton32(state)) {
|
|
case _LYFK:
|
|
rgblight_setrgb_user_LYFK();
|
|
break;
|
|
case _LYMED:
|
|
rgblight_setrgb_user_LYMED();
|
|
break;
|
|
case _LYNUM:
|
|
rgblight_setrgb_user_LYNUM();
|
|
break;
|
|
case _LYNAV:
|
|
rgblight_setrgb_user_LYNAV();
|
|
break;
|
|
case _LYMOS:
|
|
rgblight_setrgb_user_LYMOS();
|
|
break;
|
|
case _LYSYS:
|
|
rgblight_setrgb_user_LYSYS();
|
|
break;
|
|
case _LYLT:
|
|
rgblight_setrgb_user_LYLT();
|
|
break;
|
|
case _LYMD:
|
|
rgblight_setrgb_user_LYMD();
|
|
break;
|
|
default:
|
|
rgblight_setrgb_user_base();
|
|
break;
|
|
}
|
|
return state;
|
|
}
|
|
|
|
|
|
//Const for shift
|
|
const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch(keycode) {
|
|
case KC_LYDEF:
|
|
layer_clear();
|
|
return false;
|
|
break;
|
|
case QWERTY:
|
|
if (record->event.pressed) {
|
|
set_single_persistent_default_layer(_QWERTY);
|
|
}
|
|
return false;
|
|
break;
|
|
case COLEMAK:
|
|
if (record->event.pressed) {
|
|
set_single_persistent_default_layer(_COLEMAK);
|
|
}
|
|
return false;
|
|
break;
|
|
case KC_BSDEL:
|
|
if (record->event.pressed) {
|
|
if (keyboard_report->mods & shift) {
|
|
if (keyboard_report->mods & MOD_BIT(KC_LSFT)) {
|
|
unregister_code(KC_LSHIFT);
|
|
}
|
|
else {
|
|
unregister_code(KC_RSHIFT);
|
|
}
|
|
register_code(KC_DEL);
|
|
}
|
|
else {
|
|
register_code(KC_BSPC);
|
|
}
|
|
}
|
|
else {
|
|
unregister_code(KC_DEL);
|
|
unregister_code (KC_BSPC);
|
|
}
|
|
return false;
|
|
break;
|
|
case KC_FBSLH:
|
|
if (record->event.pressed) {
|
|
if (keyboard_report->mods & shift) {
|
|
if (keyboard_report->mods & MOD_BIT(KC_LSFT)) {
|
|
unregister_code(KC_LSHIFT);
|
|
}
|
|
else {
|
|
unregister_code(KC_RSHIFT);
|
|
}
|
|
register_code(KC_BSLASH);
|
|
}
|
|
else {
|
|
register_code(KC_SLSH);
|
|
}
|
|
}
|
|
else {
|
|
unregister_code(KC_BSLASH);
|
|
unregister_code (KC_SLSH);
|
|
}
|
|
return false;
|
|
break;
|
|
case KC_DOTQ:
|
|
if (record->event.pressed) {
|
|
if (keyboard_report->mods & shift) {
|
|
register_code(KC_SLSH); // shifted slash = ?
|
|
}
|
|
else {
|
|
register_code(KC_DOT);
|
|
}
|
|
}
|
|
else {
|
|
unregister_code(KC_SLSH); // shifted slash = ?
|
|
unregister_code (KC_DOT);
|
|
}
|
|
return false;
|
|
break;
|
|
case KC_CPIPE:
|
|
if (record->event.pressed) {
|
|
if (keyboard_report->mods & shift) {
|
|
register_code(KC_BSLS);
|
|
}
|
|
else {
|
|
register_code(KC_COMM);
|
|
}
|
|
}
|
|
else {
|
|
unregister_code(KC_BSLS);
|
|
unregister_code (KC_COMM);
|
|
}
|
|
return false;
|
|
break;
|
|
}
|
|
return true;
|
|
};
|