aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quantum/keymap_common.c14
-rw-r--r--quantum/quantum.c2
-rw-r--r--tmk_core/common/action.c3
-rw-r--r--tmk_core/common/action_layer.h14
-rw-r--r--tmk_core/common/util.c6
-rw-r--r--tmk_core/protocol/vusb/vusb.c2
6 files changed, 30 insertions, 11 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index f34ba26e5..570d4798d 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -51,17 +51,23 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
51 action_t action = {}; 51 action_t action = {};
52 uint8_t action_layer, when, mod; 52 uint8_t action_layer, when, mod;
53 53
54 (void)action_layer;
55 (void)when;
56 (void)mod;
57
54 switch (keycode) { 58 switch (keycode) {
55 case KC_A ... KC_EXSEL: 59 case KC_A ... KC_EXSEL:
56 case KC_LCTRL ... KC_RGUI: 60 case KC_LCTRL ... KC_RGUI:
57 action.code = ACTION_KEY(keycode); 61 action.code = ACTION_KEY(keycode);
58 break; 62 break;
63#ifdef EXTRAKEY_ENABLE
59 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: 64 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
60 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); 65 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
61 break; 66 break;
62 case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN: 67 case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN:
63 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); 68 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
64 break; 69 break;
70#endif
65#ifdef MOUSEKEY_ENABLE 71#ifdef MOUSEKEY_ENABLE
66 case KC_MS_UP ... KC_MS_ACCEL2: 72 case KC_MS_UP ... KC_MS_ACCEL2:
67 action.code = ACTION_MOUSEKEY(keycode); 73 action.code = ACTION_MOUSEKEY(keycode);
@@ -93,6 +99,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
93 action.code = ACTION_MACRO(keycode & 0xFF); 99 action.code = ACTION_MACRO(keycode & 0xFF);
94 break; 100 break;
95#endif 101#endif
102#ifndef NO_ACTION_LAYER
96 case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: 103 case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
97 action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); 104 action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
98 break; 105 break;
@@ -117,6 +124,8 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
117 action_layer = keycode & 0xFF; 124 action_layer = keycode & 0xFF;
118 action.code = ACTION_LAYER_TOGGLE(action_layer); 125 action.code = ACTION_LAYER_TOGGLE(action_layer);
119 break; 126 break;
127#endif
128#ifndef NO_ACTION_ONESHOT
120 case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:; 129 case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:;
121 // OSL(action_layer) - One-shot action_layer 130 // OSL(action_layer) - One-shot action_layer
122 action_layer = keycode & 0xFF; 131 action_layer = keycode & 0xFF;
@@ -127,6 +136,8 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
127 mod = mod_config(keycode & 0xFF); 136 mod = mod_config(keycode & 0xFF);
128 action.code = ACTION_MODS_ONESHOT(mod); 137 action.code = ACTION_MODS_ONESHOT(mod);
129 break; 138 break;
139#endif
140#ifndef NO_ACTION_LAYER
130 case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX: 141 case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
131 action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF); 142 action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
132 break; 143 break;
@@ -135,10 +146,13 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
135 action_layer = (keycode >> 4) & 0xF; 146 action_layer = (keycode >> 4) & 0xF;
136 action.code = ACTION_LAYER_MODS(action_layer, mod); 147 action.code = ACTION_LAYER_MODS(action_layer, mod);
137 break; 148 break;
149#endif
150#ifndef NO_ACTION_TAPPING
138 case QK_MOD_TAP ... QK_MOD_TAP_MAX: 151 case QK_MOD_TAP ... QK_MOD_TAP_MAX:
139 mod = mod_config((keycode >> 0x8) & 0x1F); 152 mod = mod_config((keycode >> 0x8) & 0x1F);
140 action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF); 153 action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF);
141 break; 154 break;
155#endif
142#ifdef SWAP_HANDS_ENABLE 156#ifdef SWAP_HANDS_ENABLE
143 case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX: 157 case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
144 action.code = ACTION(ACT_SWAP_HANDS, keycode & 0xff); 158 action.code = ACTION(ACT_SWAP_HANDS, keycode & 0xff);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 03b5704eb..76a48cc77 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -284,9 +284,11 @@ bool process_record_quantum(keyrecord_t *record) {
284 284
285 if (record->event.pressed) { 285 if (record->event.pressed) {
286 switch (keycode) { 286 switch (keycode) {
287#ifndef NO_RESET
287 case RESET: 288 case RESET:
288 reset_keyboard(); 289 reset_keyboard();
289 return false; 290 return false;
291#endif
290#ifndef NO_DEBUG 292#ifndef NO_DEBUG
291 case DEBUG: 293 case DEBUG:
292 debug_enable ^= 1; 294 debug_enable ^= 1;
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 19c3569d5..74db245c1 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -775,11 +775,12 @@ void register_code(uint8_t code) {
775 add_mods(MOD_BIT(code)); 775 add_mods(MOD_BIT(code));
776 send_keyboard_report(); 776 send_keyboard_report();
777 } 777 }
778#ifdef EXTRAKEY_ENABLE
778 else if 779 else if
779 IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } 780 IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); }
780 else if 781 else if
781 IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } 782 IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); }
782 783#endif
783#ifdef MOUSEKEY_ENABLE 784#ifdef MOUSEKEY_ENABLE
784 else if 785 else if
785 IS_MOUSEKEY(code) { 786 IS_MOUSEKEY(code) {
diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h
index b8562f5a4..c283d2623 100644
--- a/tmk_core/common/action_layer.h
+++ b/tmk_core/common/action_layer.h
@@ -82,13 +82,13 @@ void layer_xor(layer_state_t state);
82 82
83# define layer_debug() 83# define layer_debug()
84# define layer_clear() 84# define layer_clear()
85# define layer_move(layer) 85# define layer_move(layer) (void)layer
86# define layer_on(layer) 86# define layer_on(layer) (void)layer
87# define layer_off(layer) 87# define layer_off(layer) (void)layer
88# define layer_invert(layer) 88# define layer_invert(layer) (void)layer
89# define layer_or(state) 89# define layer_or(state) (void)state
90# define layer_and(state) 90# define layer_and(state) (void)state
91# define layer_xor(state) 91# define layer_xor(state) (void)state
92#endif 92#endif
93 93
94layer_state_t layer_state_set_user(layer_state_t state); 94layer_state_t layer_state_set_user(layer_state_t state);
diff --git a/tmk_core/common/util.c b/tmk_core/common/util.c
index f4f018de8..861cca005 100644
--- a/tmk_core/common/util.c
+++ b/tmk_core/common/util.c
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include "util.h" 18#include "util.h"
19 19
20// bit population - return number of on-bit 20// bit population - return number of on-bit
21uint8_t bitpop(uint8_t bits) { 21__attribute__((noinline)) uint8_t bitpop(uint8_t bits) {
22 uint8_t c; 22 uint8_t c;
23 for (c = 0; bits; c++) bits &= bits - 1; 23 for (c = 0; bits; c++) bits &= bits - 1;
24 return c; 24 return c;
@@ -42,7 +42,7 @@ uint8_t bitpop32(uint32_t bits) {
42 42
43// most significant on-bit - return highest location of on-bit 43// most significant on-bit - return highest location of on-bit
44// NOTE: return 0 when bit0 is on or all bits are off 44// NOTE: return 0 when bit0 is on or all bits are off
45uint8_t biton(uint8_t bits) { 45__attribute__((noinline)) uint8_t biton(uint8_t bits) {
46 uint8_t n = 0; 46 uint8_t n = 0;
47 if (bits >> 4) { 47 if (bits >> 4) {
48 bits >>= 4; 48 bits >>= 4;
@@ -105,7 +105,7 @@ uint8_t biton32(uint32_t bits) {
105 return n; 105 return n;
106} 106}
107 107
108uint8_t bitrev(uint8_t bits) { 108__attribute__((noinline)) uint8_t bitrev(uint8_t bits) {
109 bits = (bits & 0x0f) << 4 | (bits & 0xf0) >> 4; 109 bits = (bits & 0x0f) << 4 | (bits & 0xf0) >> 4;
110 bits = (bits & 0b00110011) << 2 | (bits & 0b11001100) >> 2; 110 bits = (bits & 0b00110011) << 2 | (bits & 0b11001100) >> 2;
111 bits = (bits & 0b01010101) << 1 | (bits & 0b10101010) >> 1; 111 bits = (bits & 0b01010101) << 1 | (bits & 0b10101010) >> 1;
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 95c59d493..00314ebe8 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -158,10 +158,12 @@ typedef struct {
158} __attribute__((packed)) vusb_mouse_report_t; 158} __attribute__((packed)) vusb_mouse_report_t;
159 159
160static void send_mouse(report_mouse_t *report) { 160static void send_mouse(report_mouse_t *report) {
161#if defined(MOUSE_ENABLE)
161 vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report}; 162 vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report};
162 if (usbInterruptIsReady3()) { 163 if (usbInterruptIsReady3()) {
163 usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); 164 usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t));
164 } 165 }
166#endif
165} 167}
166 168
167#ifdef EXTRAKEY_ENABLE 169#ifdef EXTRAKEY_ENABLE