forked from mirrors/qmk_firmware
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
bc41d37baf
9 changed files with 213 additions and 190 deletions
|
@ -78,6 +78,43 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
#endif // COLEMAK_LAYER_ENABLE
|
#endif // COLEMAK_LAYER_ENABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(ENCODER_ENABLE) && !defined(ENCODER_DEFAULTACTIONS_ENABLE) // Encoder Functionality when not using userspace defaults
|
||||||
|
void encoder_action_rgbhue(bool clockwise) {
|
||||||
|
if (clockwise)
|
||||||
|
rgblight_increase_hue_noeeprom();
|
||||||
|
else
|
||||||
|
rgblight_decrease_hue_noeeprom();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
uint8_t mods_state = get_mods();
|
||||||
|
if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
||||||
|
encoder_action_layerchange(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, Page up/dn
|
||||||
|
unregister_mods(MOD_BIT(KC_RSFT));
|
||||||
|
encoder_action_navpage(clockwise);
|
||||||
|
register_mods(MOD_BIT(KC_RSFT));
|
||||||
|
} else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word
|
||||||
|
encoder_action_navword(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_RCTL)) { // if holding Right Ctrl, change rgb hue/colour
|
||||||
|
encoder_action_rgbhue(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track
|
||||||
|
encoder_action_mediatrack(clockwise);
|
||||||
|
} else {
|
||||||
|
switch(get_highest_layer(layer_state)) {
|
||||||
|
case _FN1:
|
||||||
|
#ifdef IDLE_TIMEOUT_ENABLE
|
||||||
|
timeout_update_threshold(clockwise);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
encoder_action_volume(clockwise); // Otherwise it just changes volume
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif // ENCODER_ENABLE && !ENCODER_DEFAULTACTIONS_ENABLE
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
// Capslock, Scroll lock and Numlock indicator on Left side lights.
|
// Capslock, Scroll lock and Numlock indicator on Left side lights.
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
- holding Left shift, change layers
|
- holding Left shift, change layers
|
||||||
- holding right shift, Navigate page up/down
|
- holding right shift, Navigate page up/down
|
||||||
- holding Left Ctrl, navigate prev/next word
|
- holding Left Ctrl, navigate prev/next word
|
||||||
|
- holding Right Ctrl, changes RGB hue/colour
|
||||||
- holding Left Alt, change media prev/next track
|
- holding Left Alt, change media prev/next track
|
||||||
- default is change volume
|
- default is change volume
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,6 @@ BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite
|
||||||
TD_LSFT_CAPSLOCK_ENABLE = yes
|
TD_LSFT_CAPSLOCK_ENABLE = yes
|
||||||
IDLE_TIMEOUT_ENABLE = yes
|
IDLE_TIMEOUT_ENABLE = yes
|
||||||
STARTUP_NUMLOCK_ON = yes
|
STARTUP_NUMLOCK_ON = yes
|
||||||
ENCODER_DEFAULTACTIONS_ENABLE = yes
|
ENCODER_DEFAULTACTIONS_ENABLE = no
|
||||||
|
|
||||||
COLEMAK_LAYER_ENABLE = yes #Enable Colemak layer / set to no to disable
|
COLEMAK_LAYER_ENABLE = yes #Enable Colemak layer / set to no to disable
|
||||||
|
|
|
@ -57,46 +57,31 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE // Encoder Functionality
|
#ifdef ENCODER_ENABLE // Encoder Functionality
|
||||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
switch (index)
|
uint8_t mods_state = get_mods();
|
||||||
{
|
switch (index) {
|
||||||
case 0: // first encoder (Left Macro set)
|
case 0: // first encoder (Left Macro set)
|
||||||
if (clockwise) {
|
encoder_action_navpage(clockwise);
|
||||||
tap_code(KC_PGDN);
|
break;
|
||||||
} else {
|
|
||||||
tap_code(KC_PGUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
default: // other encoder (Top right)
|
default: // other encoder (Top right)
|
||||||
if ( clockwise ) {
|
if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding Left shift, change layers
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, Page up
|
encoder_action_layerchange(clockwise);
|
||||||
unregister_mods(MOD_BIT(KC_LSFT));
|
} else if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding Right shift, Page up
|
||||||
register_code(KC_PGDN);
|
unregister_mods(MOD_BIT(KC_RSFT));
|
||||||
register_mods(MOD_BIT(KC_LSFT));
|
encoder_action_navpage(clockwise);
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
|
register_mods(MOD_BIT(KC_RSFT));
|
||||||
tap_code16(LCTL(KC_RGHT));
|
} else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next track
|
encoder_action_navword(clockwise);
|
||||||
tap_code(KC_MEDIA_NEXT_TRACK);
|
} else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track
|
||||||
|
encoder_action_mediatrack(clockwise);
|
||||||
} else {
|
} else {
|
||||||
tap_code(KC_VOLU); // Otherwise it just changes volume
|
encoder_action_volume(clockwise); // Otherwise it just changes volume
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
|
|
||||||
unregister_mods(MOD_BIT(KC_LSFT));
|
|
||||||
register_code(KC_PGUP);
|
|
||||||
register_mods(MOD_BIT(KC_LSFT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
|
|
||||||
tap_code16(LCTL(KC_LEFT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media previous track
|
|
||||||
tap_code(KC_MEDIA_PREV_TRACK);
|
|
||||||
} else {
|
|
||||||
tap_code(KC_VOLD);
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
|
@ -106,63 +106,48 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE // Encoder Functionality
|
#ifdef ENCODER_ENABLE // Encoder Functionality
|
||||||
uint8_t selected_layer = 0;
|
void encoder_action_selectkey(bool clockwise) {
|
||||||
|
if ( clockwise ) {
|
||||||
|
if ( selectedkey_idx < MAX_KEYSELECTION-1) {
|
||||||
|
selectedkey_idx ++;
|
||||||
|
} else {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
} else if ( !clockwise ) {
|
||||||
|
if ( selectedkey_idx > 0){
|
||||||
|
selectedkey_idx --;
|
||||||
|
} else {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set_selectedkey(selectedkey_idx);
|
||||||
|
}
|
||||||
|
|
||||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
oled_clear();
|
oled_clear();
|
||||||
oled_render();
|
oled_render();
|
||||||
#endif
|
#endif
|
||||||
|
uint8_t mods_state = get_mods();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: // This is the only encoder right now, keeping for consistency
|
case 0: // This is the only encoder right now, keeping for consistency
|
||||||
switch(get_highest_layer(layer_state)){ // special handling per layer
|
switch(get_highest_layer(layer_state)){ // special handling per layer
|
||||||
case _FN1: // on Fn layer select what the encoder does when pressed
|
case _FN1: // on Fn layer select what the encoder does when pressed
|
||||||
if (!keyboard_report->mods) {
|
if (!mods_state) {
|
||||||
if ( clockwise ) {
|
encoder_action_selectkey(clockwise);
|
||||||
if ( selectedkey_idx < MAX_KEYSELECTION-1) {
|
|
||||||
selectedkey_idx ++;
|
|
||||||
} else {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
} else if ( !clockwise ) {
|
|
||||||
if ( selectedkey_idx > 0){
|
|
||||||
selectedkey_idx --;
|
|
||||||
} else {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set_selectedkey(selectedkey_idx);
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// continue to default
|
// continue to default
|
||||||
}
|
}
|
||||||
default: // all other layers
|
default: // all other layers
|
||||||
if ( clockwise ) {
|
if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
encoder_action_layerchange(clockwise);
|
||||||
if(selected_layer < 3) {
|
} else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word
|
||||||
selected_layer ++;
|
encoder_action_navword(clockwise);
|
||||||
layer_move(selected_layer);
|
} else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track
|
||||||
}
|
encoder_action_mediatrack(clockwise);
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
|
} else {
|
||||||
tap_code16(LCTL(KC_RGHT));
|
encoder_action_volume(clockwise); // Otherwise it just changes volume
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next track
|
|
||||||
tap_code(KC_MEDIA_NEXT_TRACK);
|
|
||||||
} else {
|
|
||||||
tap_code(KC_VOLU); // Otherwise it just changes volume
|
|
||||||
}
|
|
||||||
} else if ( !clockwise ) {
|
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
|
|
||||||
if (selected_layer > 0) {
|
|
||||||
selected_layer --;
|
|
||||||
layer_move(selected_layer);
|
|
||||||
}
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
|
|
||||||
tap_code16(LCTL(KC_LEFT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media previous track
|
|
||||||
tap_code(KC_MEDIA_PREV_TRACK);
|
|
||||||
} else {
|
|
||||||
tap_code(KC_VOLD);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +190,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
void oled_task_user(void) {
|
void oled_task_user(void) {
|
||||||
|
|
||||||
if ( IS_HOST_LED_OFF(USB_LED_NUM_LOCK) && IS_HOST_LED_OFF(USB_LED_CAPS_LOCK) && selected_layer == 0 && get_highest_layer(layer_state) == 0 ) {
|
if ( IS_HOST_LED_OFF(USB_LED_NUM_LOCK) && IS_HOST_LED_OFF(USB_LED_CAPS_LOCK) && get_selected_layer() == 0 && get_highest_layer(layer_state) == 0 ) {
|
||||||
render_name();
|
render_name();
|
||||||
clear_screen = true;
|
clear_screen = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -217,7 +202,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
render_logo();
|
render_logo();
|
||||||
oled_set_cursor(8,2);
|
oled_set_cursor(8,2);
|
||||||
char fn_str[12];
|
char fn_str[12];
|
||||||
switch(selected_layer){
|
switch(get_selected_layer()){
|
||||||
case 0:
|
case 0:
|
||||||
oled_write_P(PSTR("BASE"), false);
|
oled_write_P(PSTR("BASE"), false);
|
||||||
break;
|
break;
|
||||||
|
@ -237,7 +222,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
oled_write_P(keymap_config.no_gui ? PSTR(" WL") : PSTR(" "), false);
|
oled_write_P(keymap_config.no_gui ? PSTR(" WL") : PSTR(" "), false);
|
||||||
oled_set_cursor(8,3);
|
oled_set_cursor(8,3);
|
||||||
if (get_highest_layer(layer_state) == selected_layer) {
|
if (get_highest_layer(layer_state) == get_selected_layer()) {
|
||||||
oled_write_P(PSTR(" "), false);
|
oled_write_P(PSTR(" "), false);
|
||||||
} else {
|
} else {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
|
|
|
@ -144,67 +144,52 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE // Encoder Functionality
|
#ifdef ENCODER_ENABLE // Encoder Functionality
|
||||||
uint8_t selected_layer = 0;
|
void encoder_action_selectkey(bool clockwise) {
|
||||||
|
if ( clockwise ) {
|
||||||
|
if ( selectedkey_idx < MAX_KEYSELECTION-1) {
|
||||||
|
selectedkey_idx ++;
|
||||||
|
} else {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
} else if ( !clockwise ) {
|
||||||
|
if ( selectedkey_idx > 0){
|
||||||
|
selectedkey_idx --;
|
||||||
|
} else {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set_selectedkey(selectedkey_idx);
|
||||||
|
}
|
||||||
|
|
||||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
oled_clear();
|
oled_clear();
|
||||||
oled_render();
|
oled_render();
|
||||||
#endif
|
#endif
|
||||||
|
uint8_t mods_state = get_mods();
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0: // This is the only encoder right now, keeping for consistency
|
case 0: // This is the only encoder right now, keeping for consistency
|
||||||
switch(get_highest_layer(layer_state)){ // special handling per layer
|
switch(get_highest_layer(layer_state)){ // special handling per layer
|
||||||
case _FN1: // on Fn layer select what the encoder does when pressed
|
case _FN1: // on Fn layer select what the encoder does when pressed
|
||||||
if (!keyboard_report->mods) {
|
if (!mods_state) {
|
||||||
if ( clockwise ) {
|
encoder_action_selectkey(clockwise);
|
||||||
if ( selectedkey_idx < MAX_KEYSELECTION-1) {
|
|
||||||
selectedkey_idx ++;
|
|
||||||
} else {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
} else if ( !clockwise ) {
|
|
||||||
if ( selectedkey_idx > 0){
|
|
||||||
selectedkey_idx --;
|
|
||||||
} else {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set_selectedkey(selectedkey_idx);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
// continue to default
|
|
||||||
}
|
|
||||||
default: // all other layers
|
|
||||||
if ( clockwise ) {
|
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_RSFT) ) { // If you are holding Right Shift, encoder changes layers
|
|
||||||
if(selected_layer < (DYNAMIC_KEYMAP_LAYER_COUNT-1)) {
|
|
||||||
selected_layer ++;
|
|
||||||
layer_move(selected_layer);
|
|
||||||
}
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_RCTL)) { // if holding Right Ctrl, navigate next word
|
|
||||||
tap_code16(LCTL(KC_RGHT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_RALT)) { // if holding Right Alt, change media next track
|
|
||||||
tap_code(KC_MEDIA_NEXT_TRACK);
|
|
||||||
} else {
|
|
||||||
tap_code(KC_VOLU); // Otherwise it just changes volume
|
|
||||||
}
|
|
||||||
} else if ( !clockwise ) {
|
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_RSFT) ) {
|
|
||||||
if (selected_layer > 0) {
|
|
||||||
selected_layer --;
|
|
||||||
layer_move(selected_layer);
|
|
||||||
}
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_RCTL)) { // if holding Right Ctrl, navigate previous word
|
|
||||||
tap_code16(LCTL(KC_LEFT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_RALT)) { // if holding Right Alt, change media previous track
|
|
||||||
tap_code(KC_MEDIA_PREV_TRACK);
|
|
||||||
} else {
|
|
||||||
tap_code(KC_VOLD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
// continue to default
|
||||||
|
}
|
||||||
|
default: // all other layers
|
||||||
|
if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, encoder changes layers
|
||||||
|
encoder_action_layerchange(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_RCTL)) { // if holding Right Ctrl, navigate next/prev word
|
||||||
|
encoder_action_navword(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_RALT)) { // if holding Right Alt, change media next/prev track
|
||||||
|
encoder_action_mediatrack(clockwise);
|
||||||
|
} else {
|
||||||
|
encoder_action_volume(clockwise); // Otherwise it just changes volume
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +217,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
render_logo();
|
render_logo();
|
||||||
oled_set_cursor(8,2);
|
oled_set_cursor(8,2);
|
||||||
switch(selected_layer){
|
switch(get_selected_layer()){
|
||||||
case _BASE:
|
case _BASE:
|
||||||
oled_write_P(PSTR("BASE"), false);
|
oled_write_P(PSTR("BASE"), false);
|
||||||
break;
|
break;
|
||||||
|
@ -257,7 +242,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
oled_write_P(keymap_config.no_gui ? PSTR(" WL") : PSTR(" "), false);
|
oled_write_P(keymap_config.no_gui ? PSTR(" WL") : PSTR(" "), false);
|
||||||
oled_set_cursor(8,3);
|
oled_set_cursor(8,3);
|
||||||
if (get_highest_layer(layer_state) == selected_layer) {
|
if (get_highest_layer(layer_state) == get_selected_layer()) {
|
||||||
oled_write_P(PSTR(" "), false);
|
oled_write_P(PSTR(" "), false);
|
||||||
} else {
|
} else {
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#endif // IDLE_TIMEOUT_ENABLE
|
#endif // IDLE_TIMEOUT_ENABLE
|
||||||
|
|
||||||
|
|
||||||
#if defined(ENCODER_ENABLE) && defined(ENCODER_DEFAULTACTIONS_ENABLE) // Encoder Functionality
|
#ifdef ENCODER_ENABLE
|
||||||
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
||||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 4 //default in case this is not already defined elsewhere
|
#define DYNAMIC_KEYMAP_LAYER_COUNT 4 //default in case this is not already defined elsewhere
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,67 +112,86 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define ENCODER_DEFAULTACTIONS_INDEX 0 // can select encoder index if there are multiple encoders
|
#define ENCODER_DEFAULTACTIONS_INDEX 0 // can select encoder index if there are multiple encoders
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t selected_layer = 0;
|
void encoder_action_volume(bool clockwise) {
|
||||||
|
if (clockwise)
|
||||||
|
tap_code(KC_VOLU);
|
||||||
|
else
|
||||||
|
tap_code(KC_VOLD);
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; }
|
void encoder_action_mediatrack(bool clockwise) {
|
||||||
|
if (clockwise)
|
||||||
|
tap_code(KC_MEDIA_NEXT_TRACK);
|
||||||
|
else
|
||||||
|
tap_code(KC_MEDIA_PREV_TRACK);
|
||||||
|
}
|
||||||
|
|
||||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
void encoder_action_navword(bool clockwise) {
|
||||||
if (!encoder_update_keymap(index, clockwise)) { return false; }
|
if (clockwise)
|
||||||
if (index != ENCODER_DEFAULTACTIONS_INDEX) {return true;} // exit if the index doesn't match
|
tap_code16(LCTL(KC_RGHT));
|
||||||
if ( clockwise ) {
|
else
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
tap_code16(LCTL(KC_LEFT));
|
||||||
if(selected_layer < (DYNAMIC_KEYMAP_LAYER_COUNT - 1)) {
|
}
|
||||||
selected_layer ++;
|
|
||||||
layer_move(selected_layer);
|
void encoder_action_navpage(bool clockwise) {
|
||||||
}
|
if (clockwise)
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, Page up
|
tap_code16(KC_PGUP);
|
||||||
unregister_mods(MOD_BIT(KC_RSFT));
|
else
|
||||||
register_code(KC_PGDN);
|
tap_code16(KC_PGDN);
|
||||||
register_mods(MOD_BIT(KC_RSFT));
|
}
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
|
|
||||||
tap_code16(LCTL(KC_RGHT));
|
// LAYER HANDLING
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next track
|
uint8_t selected_layer = 0;
|
||||||
tap_code(KC_MEDIA_NEXT_TRACK);
|
|
||||||
} else {
|
uint8_t get_selected_layer(void) {
|
||||||
switch (selected_layer) {
|
return selected_layer;
|
||||||
case _FN1:
|
}
|
||||||
#ifdef IDLE_TIMEOUT_ENABLE
|
|
||||||
timeout_update_threshold(true);
|
void encoder_action_layerchange(bool clockwise) {
|
||||||
#endif
|
if (clockwise) {
|
||||||
break;
|
if(selected_layer < (DYNAMIC_KEYMAP_LAYER_COUNT - 1)) {
|
||||||
default:
|
selected_layer ++;
|
||||||
tap_code(KC_VOLU); // Otherwise it just changes volume
|
layer_move(selected_layer);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
|
if (selected_layer > 0) {
|
||||||
if (selected_layer > 0) {
|
selected_layer --;
|
||||||
selected_layer --;
|
layer_move(selected_layer);
|
||||||
layer_move(selected_layer);
|
|
||||||
}
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_RSFT) ) {
|
|
||||||
unregister_mods(MOD_BIT(KC_RSFT));
|
|
||||||
register_code(KC_PGUP);
|
|
||||||
register_mods(MOD_BIT(KC_RSFT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
|
|
||||||
tap_code16(LCTL(KC_LEFT));
|
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media previous track
|
|
||||||
tap_code(KC_MEDIA_PREV_TRACK);
|
|
||||||
} else {
|
|
||||||
switch (selected_layer) {
|
|
||||||
case _FN1:
|
|
||||||
#ifdef IDLE_TIMEOUT_ENABLE
|
|
||||||
timeout_update_threshold(false);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tap_code(KC_VOLD);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif // ENCODER_ENABLE
|
||||||
|
|
||||||
|
#if defined(ENCODER_ENABLE) && defined(ENCODER_DEFAULTACTIONS_ENABLE) // Encoder Functionality
|
||||||
|
|
||||||
|
__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; }
|
||||||
|
|
||||||
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_keymap(index, clockwise)) { return false; }
|
||||||
|
if (index != ENCODER_DEFAULTACTIONS_INDEX) {return true;} // exit if the index doesn't match
|
||||||
|
uint8_t mods_state = get_mods();
|
||||||
|
if (mods_state & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
||||||
|
encoder_action_layerchange(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_RSFT) ) { // If you are holding R shift, Page up/dn
|
||||||
|
unregister_mods(MOD_BIT(KC_RSFT));
|
||||||
|
encoder_action_navpage(clockwise);
|
||||||
|
register_mods(MOD_BIT(KC_RSFT));
|
||||||
|
} else if (mods_state & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next/prev word
|
||||||
|
encoder_action_navword(clockwise);
|
||||||
|
} else if (mods_state & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next/prev track
|
||||||
|
encoder_action_mediatrack(clockwise);
|
||||||
|
} else {
|
||||||
|
switch(get_highest_layer(layer_state)) {
|
||||||
|
case _FN1:
|
||||||
|
#ifdef IDLE_TIMEOUT_ENABLE
|
||||||
|
timeout_update_threshold(clockwise);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
encoder_action_volume(clockwise); // Otherwise it just changes volume
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // ENCODER_ENABLE
|
#endif // ENCODER_ENABLE
|
||||||
|
|
|
@ -58,6 +58,18 @@ enum custom_user_keycodes {
|
||||||
#endif // TD_LSFT_CAPSLOCK_ENABLE
|
#endif // TD_LSFT_CAPSLOCK_ENABLE
|
||||||
|
|
||||||
|
|
||||||
|
// ENCODER ACTIONS
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
void encoder_action_volume(bool clockwise);
|
||||||
|
void encoder_action_mediatrack(bool clockwise);
|
||||||
|
void encoder_action_navword(bool clockwise);
|
||||||
|
void encoder_action_navpage(bool clockwise);
|
||||||
|
|
||||||
|
uint8_t get_selected_layer(void);
|
||||||
|
void encoder_action_layerchange(bool clockwise);
|
||||||
|
#endif // ENCODER_ENABLE
|
||||||
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
//RGB custom colours
|
//RGB custom colours
|
||||||
#define RGB_GODSPEED 0x00, 0xE4, 0xFF // colour for matching keycaps
|
#define RGB_GODSPEED 0x00, 0xE4, 0xFF // colour for matching keycaps
|
||||||
|
|
|
@ -65,11 +65,10 @@ KEYMAP LEVEL ADDITIONAL PROCESSING FUNCTIONS
|
||||||
void keyboard_post_init_keymap(void)
|
void keyboard_post_init_keymap(void)
|
||||||
|
|
||||||
LIST OF COMPATIBLE KEYMAPS
|
LIST OF COMPATIBLE KEYMAPS
|
||||||
- gmmk/pro
|
|
||||||
- gmmk/pro/ansi
|
- gmmk/pro/ansi
|
||||||
- keebio/quefrency/rev3
|
- keebio/quefrency/rev3
|
||||||
- mechwild/mercutio
|
- mechwild/mercutio
|
||||||
- mechwild/murphpad (*)
|
- mechwild/murphpad
|
||||||
- mechwild/OBE (*)
|
- mechwild/OBE (*)
|
||||||
- nopunin10did/kastenwagen (*)
|
- nopunin10did/kastenwagen (*)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue