1
0
Fork 0

VIA compile fixes (#13054)

This commit is contained in:
Xelus22 2021-06-01 14:56:23 +10:00 committed by GitHub
parent 6bafefa886
commit 5a06813b10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 106 additions and 68 deletions

View file

@ -1,2 +1,4 @@
RGB_MATRIX_ENABLE = yes # Enable RGB matrix RGB_MATRIX_ENABLE = yes # Enable RGB matrix
RGB_MATRIX_DRIVER = WS2812 # Set Driver to WS2812 RGB_MATRIX_DRIVER = WS2812 # Set Driver to WS2812
LTO_ENABLE = yes

View file

@ -1,2 +1,4 @@
RGB_MATRIX_ENABLE = yes # Enable RGB matrix RGB_MATRIX_ENABLE = yes # Enable RGB matrix
RGB_MATRIX_DRIVER = WS2812 # Set Driver to WS2812 RGB_MATRIX_DRIVER = WS2812 # Set Driver to WS2812
LTO_ENABLE = yes

View file

@ -1,18 +1,18 @@
/* Copyright 2020 MT<704340378@qq.com> /* Copyright 2020 MT<704340378@qq.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
@ -44,8 +44,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BL_DEC, BL_TOGG, BL_INC, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
}; };
void rgb_matrix_indicators_user(void) { void rgb_matrix_indicators_user(void) {
if (!g_suspend_state && layer_state_is(1)) { if (layer_state_is(1)) {
rgb_matrix_set_color(77,0xFF, 0x80, 0x00); rgb_matrix_set_color(77,0xFF, 0x80, 0x00);
} }
if (host_keyboard_led_state().caps_lock) { if (host_keyboard_led_state().caps_lock) {

View file

@ -18,29 +18,29 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_RH_ANY( [0] = LAYOUT_rh_any(
KC_ESC ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_F6 , KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR,KC_SLCK,KC_INS ,KC_DEL ,KC_HOME,KC_END ,KC_PGUP,KC_PGDN, KC_ESC ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_F6 , KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 ,KC_PSCR,KC_SLCK,KC_INS ,KC_DEL ,KC_HOME,KC_END ,KC_PGUP,KC_PGDN,
KC_GRV ,KC_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C_P1 ,KC_P2 ,KC_P3 ,KC_PENT,
KC_LCTL,KC_LGUI, KC_LALT,KC_MENU,KC_SPC , KC_SPC , KC_ALGR, KC_RGUI,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT, KC_P0 ,KC_P0 ,KC_PDOT,KC_PENT), KC_LCTL,KC_LGUI, KC_LALT,KC_MENU,KC_SPC , KC_SPC , KC_ALGR, KC_RGUI,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT, KC_P0 ,KC_P0 ,KC_PDOT,KC_PENT),
[1] = LAYOUT_RH_ANY( [1] = LAYOUT_rh_any(
RESET ,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RESET ,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______,_______,_______,RESET ,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,RESET ,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______, _______,_______,_______, _______, _______, _______,_______,_______,_______,_______, _______,_______,_______,_______), _______,_______, _______,_______,_______, _______, _______, _______,_______,_______,_______,_______, _______,_______,_______,_______),
[2] = LAYOUT_RH_ANY( [2] = LAYOUT_rh_any(
_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______, _______,_______,_______, _______, _______, _______,_______,_______,_______,_______, _______,_______,_______,_______), _______,_______, _______,_______,_______, _______, _______, _______,_______,_______,_______,_______, _______,_______,_______,_______),
}; };

View file

@ -56,3 +56,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS KC_TRNS, KC_TRNS
), ),
}; };
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (get_highest_layer(layer_state) == 0) {
uint16_t mapped_code = 0;
if (clockwise) {
mapped_code = handle_encoder_cw();
} else {
mapped_code = handle_encoder_ccw();
}
if (mapped_code != 0) {
tap_code16(mapped_code);
}
} else {
if (clockwise) {
if (oled_mode == OLED_MODE_CALC) {
handle_encoder_cw();
} else if (oled_mode == OLED_MODE_DEFAULT) {
change_encoder_mode(false);
}
} else {
if (oled_mode == OLED_MODE_CALC) {
handle_encoder_ccw();
} else if (oled_mode == OLED_MODE_DEFAULT) {
change_encoder_mode(true);
}
}
}
}
return true;
}

View file

@ -51,3 +51,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS KC_TRNS, KC_TRNS
), ),
}; };
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (get_highest_layer(layer_state) == 0) {
uint16_t mapped_code = 0;
if (clockwise) {
mapped_code = handle_encoder_cw();
} else {
mapped_code = handle_encoder_ccw();
}
if (mapped_code != 0) {
tap_code16(mapped_code);
}
} else {
if (clockwise) {
if (oled_mode == OLED_MODE_CALC) {
handle_encoder_cw();
} else if (oled_mode == OLED_MODE_DEFAULT) {
change_encoder_mode(false);
}
} else {
if (oled_mode == OLED_MODE_CALC) {
handle_encoder_ccw();
} else if (oled_mode == OLED_MODE_DEFAULT) {
change_encoder_mode(true);
}
}
}
}
return true;
}

View file

@ -73,36 +73,7 @@ bool led_update_kb(led_t led_state) {
return true; return true;
} }
__attribute__ ((weak)) void encoder_update_user(uint8_t index, bool clockwise) { bool encoder_update_kb(uint8_t index, bool clockwise) {
if (index == 0) { if (!encoder_update_user(index, clockwise)) { return false; }
if (get_highest_layer(layer_state) == 0) { return true;
uint16_t mapped_code = 0;
if (clockwise) {
mapped_code = handle_encoder_cw();
} else {
mapped_code = handle_encoder_ccw();
}
if (mapped_code != 0) {
tap_code16(mapped_code);
}
} else {
if (clockwise) {
if (oled_mode == OLED_MODE_CALC) {
handle_encoder_cw();
} else if (oled_mode == OLED_MODE_DEFAULT) {
change_encoder_mode(false);
}
} else {
if (oled_mode == OLED_MODE_CALC) {
handle_encoder_ccw();
} else if (oled_mode == OLED_MODE_DEFAULT) {
change_encoder_mode(true);
}
}
}
}
}
void encoder_update_kb(uint8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
} }