From 5a06813b105277998b80771f094059047916f4e4 Mon Sep 17 00:00:00 2001
From: Xelus22 <17491233+Xelus22@users.noreply.github.com>
Date: Tue, 1 Jun 2021 14:56:23 +1000
Subject: [PATCH] VIA compile fixes (#13054)
---
.../capsunlocked/cu80/v2_ansi/rgb/rules.mk | 2 +
.../capsunlocked/cu80/v2_iso/rgb/rules.mk | 2 +
keyboards/mt64rgb/keymaps/via/keymap.c | 31 +++++++-------
.../jabberwocky/keymaps/via/keymap.c | 42 +++++++++----------
keyboards/rubi/keymaps/default/keymap.c | 31 ++++++++++++++
keyboards/rubi/keymaps/via/keymap.c | 31 ++++++++++++++
keyboards/rubi/rubi.c | 35 ++--------------
7 files changed, 106 insertions(+), 68 deletions(-)
diff --git a/keyboards/capsunlocked/cu80/v2_ansi/rgb/rules.mk b/keyboards/capsunlocked/cu80/v2_ansi/rgb/rules.mk
index ed84f1d8cd..d213c84de3 100644
--- a/keyboards/capsunlocked/cu80/v2_ansi/rgb/rules.mk
+++ b/keyboards/capsunlocked/cu80/v2_ansi/rgb/rules.mk
@@ -1,2 +1,4 @@
RGB_MATRIX_ENABLE = yes # Enable RGB matrix
RGB_MATRIX_DRIVER = WS2812 # Set Driver to WS2812
+
+LTO_ENABLE = yes
diff --git a/keyboards/capsunlocked/cu80/v2_iso/rgb/rules.mk b/keyboards/capsunlocked/cu80/v2_iso/rgb/rules.mk
index ed84f1d8cd..d213c84de3 100644
--- a/keyboards/capsunlocked/cu80/v2_iso/rgb/rules.mk
+++ b/keyboards/capsunlocked/cu80/v2_iso/rgb/rules.mk
@@ -1,2 +1,4 @@
RGB_MATRIX_ENABLE = yes # Enable RGB matrix
RGB_MATRIX_DRIVER = WS2812 # Set Driver to WS2812
+
+LTO_ENABLE = yes
diff --git a/keyboards/mt64rgb/keymaps/via/keymap.c b/keyboards/mt64rgb/keymaps/via/keymap.c
index a182e1a6a2..7a9a2c1441 100644
--- a/keyboards/mt64rgb/keymaps/via/keymap.c
+++ b/keyboards/mt64rgb/keymaps/via/keymap.c
@@ -1,18 +1,18 @@
/* Copyright 2020 MT<704340378@qq.com>
- *
- * 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 .
- */
+ *
+ * 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 .
+ */
#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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
+
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);
}
if (host_keyboard_led_state().caps_lock) {
diff --git a/keyboards/nopunin10did/jabberwocky/keymaps/via/keymap.c b/keyboards/nopunin10did/jabberwocky/keymaps/via/keymap.c
index 375fc939b2..cce5505909 100644
--- a/keyboards/nopunin10did/jabberwocky/keymaps/via/keymap.c
+++ b/keyboards/nopunin10did/jabberwocky/keymaps/via/keymap.c
@@ -18,29 +18,29 @@
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_GRV ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,KC_EQL ,KC_INT3,KC_BSPC, KC_NLCK,KC_PSLS,KC_PAST,KC_PAUS,
- KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T , KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_LBRC,KC_RBRC,KC_BSLS, KC_P7 ,KC_P8 ,KC_P9 ,KC_PMNS,
- KC_CAPS,KC_A ,KC_S ,KC_D ,KC_F ,KC_G , KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,KC_NUHS,KC_ENT , KC_P4 ,KC_P5 ,KC_P6 ,KC_PPLS,
-KC_LSFT,KC_NUBS,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,MO(1), MO(1), KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_INT1,KC_RSFT,KC_UP , KC_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),
-
-
-[1] = LAYOUT_RH_ANY(
-RESET ,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
- _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
- _______,_______,_______,_______,RESET ,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
- _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
-_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+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_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_MINS,KC_EQL ,KC_INT3,KC_BSPC, KC_NLCK,KC_PSLS,KC_PAST,KC_PAUS,
+ KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T , KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KC_LBRC,KC_RBRC,KC_BSLS, KC_P7 ,KC_P8 ,KC_P9 ,KC_PMNS,
+ KC_CAPS,KC_A ,KC_S ,KC_D ,KC_F ,KC_G , KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN,KC_QUOT,KC_NUHS,KC_ENT , KC_P4 ,KC_P5 ,KC_P6 ,KC_PPLS,
+KC_LSFT,KC_NUBS,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,MO(1), MO(1), KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_INT1,KC_RSFT,KC_UP , KC_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),
+
+
+[1] = LAYOUT_rh_any(
+RESET ,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
+ _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+ _______,_______,_______,_______,RESET ,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+ _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______, _______,_______,_______, _______, _______, _______,_______,_______,_______,_______, _______,_______,_______,_______),
-[2] = LAYOUT_RH_ANY(
-_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
- _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
- _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
- _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
-_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+[2] = LAYOUT_rh_any(
+_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
+ _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+ _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+ _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
+_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,
_______,_______, _______,_______,_______, _______, _______, _______,_______,_______,_______,_______, _______,_______,_______,_______),
};
diff --git a/keyboards/rubi/keymaps/default/keymap.c b/keyboards/rubi/keymaps/default/keymap.c
index 054e3ce232..e0e7290dfe 100644
--- a/keyboards/rubi/keymaps/default/keymap.c
+++ b/keyboards/rubi/keymaps/default/keymap.c
@@ -56,3 +56,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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;
+}
diff --git a/keyboards/rubi/keymaps/via/keymap.c b/keyboards/rubi/keymaps/via/keymap.c
index 3003db8886..1e8cb70c7c 100644
--- a/keyboards/rubi/keymaps/via/keymap.c
+++ b/keyboards/rubi/keymaps/via/keymap.c
@@ -51,3 +51,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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;
+}
diff --git a/keyboards/rubi/rubi.c b/keyboards/rubi/rubi.c
index 6cdf8302c1..50e5fcf782 100644
--- a/keyboards/rubi/rubi.c
+++ b/keyboards/rubi/rubi.c
@@ -73,36 +73,7 @@ bool led_update_kb(led_t led_state) {
return true;
}
-__attribute__ ((weak)) void 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);
- }
- }
- }
- }
-}
-
-void encoder_update_kb(uint8_t index, bool clockwise) {
- encoder_update_user(index, clockwise);
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!encoder_update_user(index, clockwise)) { return false; }
+ return true;
}