Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip out features to allow minimum firmware sizes #8645

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions quantum/keymap_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,23 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
action_t action = {};
uint8_t action_layer, when, mod;

(void)action_layer;
(void)when;
(void)mod;
zvecr marked this conversation as resolved.
Show resolved Hide resolved

switch (keycode) {
case KC_A ... KC_EXSEL:
case KC_LCTRL ... KC_RGUI:
action.code = ACTION_KEY(keycode);
break;
#ifdef EXTRAKEY_ENABLE
case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
break;
case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN:
action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
break;
#endif
#ifdef MOUSEKEY_ENABLE
case KC_MS_UP ... KC_MS_ACCEL2:
action.code = ACTION_MOUSEKEY(keycode);
Expand Down Expand Up @@ -93,6 +99,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
action.code = ACTION_MACRO(keycode & 0xFF);
break;
#endif
#ifndef NO_ACTION_LAYER
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
break;
Expand All @@ -117,6 +124,8 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
action_layer = keycode & 0xFF;
action.code = ACTION_LAYER_TOGGLE(action_layer);
break;
#endif
#ifndef NO_ACTION_ONESHOT
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:;
// OSL(action_layer) - One-shot action_layer
action_layer = keycode & 0xFF;
Expand All @@ -127,6 +136,8 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
mod = mod_config(keycode & 0xFF);
action.code = ACTION_MODS_ONESHOT(mod);
break;
#endif
#ifndef NO_ACTION_LAYER
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
break;
Expand All @@ -135,10 +146,13 @@ action_t action_for_key(uint8_t layer, keypos_t key) {
action_layer = (keycode >> 4) & 0xF;
action.code = ACTION_LAYER_MODS(action_layer, mod);
break;
#endif
#ifndef NO_ACTION_TAPPING
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
mod = mod_config((keycode >> 0x8) & 0x1F);
action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF);
break;
#endif
#ifdef SWAP_HANDS_ENABLE
case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
action.code = ACTION(ACT_SWAP_HANDS, keycode & 0xff);
Expand Down
2 changes: 2 additions & 0 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ bool process_record_quantum(keyrecord_t *record) {

if (record->event.pressed) {
switch (keycode) {
#ifndef NO_RESET
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
case RESET:
reset_keyboard();
return false;
#endif
#ifndef NO_DEBUG
case DEBUG:
debug_enable ^= 1;
Expand Down
3 changes: 2 additions & 1 deletion tmk_core/common/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,11 +775,12 @@ void register_code(uint8_t code) {
add_mods(MOD_BIT(code));
send_keyboard_report();
}
#ifdef EXTRAKEY_ENABLE
else if
IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); }
else if
IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); }

#endif
#ifdef MOUSEKEY_ENABLE
else if
IS_MOUSEKEY(code) {
Expand Down
14 changes: 7 additions & 7 deletions tmk_core/common/action_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ void layer_xor(layer_state_t state);

# define layer_debug()
# define layer_clear()
# define layer_move(layer)
# define layer_on(layer)
# define layer_off(layer)
# define layer_invert(layer)
# define layer_or(state)
# define layer_and(state)
# define layer_xor(state)
# define layer_move(layer) (void)layer
# define layer_on(layer) (void)layer
# define layer_off(layer) (void)layer
# define layer_invert(layer) (void)layer
# define layer_or(state) (void)state
# define layer_and(state) (void)state
# define layer_xor(state) (void)state
#endif

layer_state_t layer_state_set_user(layer_state_t state);
Expand Down
6 changes: 3 additions & 3 deletions tmk_core/common/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"

// bit population - return number of on-bit
uint8_t bitpop(uint8_t bits) {
__attribute__((noinline)) uint8_t bitpop(uint8_t bits) {
uint8_t c;
for (c = 0; bits; c++) bits &= bits - 1;
return c;
Expand All @@ -42,7 +42,7 @@ uint8_t bitpop32(uint32_t bits) {

// most significant on-bit - return highest location of on-bit
// NOTE: return 0 when bit0 is on or all bits are off
uint8_t biton(uint8_t bits) {
__attribute__((noinline)) uint8_t biton(uint8_t bits) {
uint8_t n = 0;
if (bits >> 4) {
bits >>= 4;
Expand Down Expand Up @@ -105,7 +105,7 @@ uint8_t biton32(uint32_t bits) {
return n;
}

uint8_t bitrev(uint8_t bits) {
__attribute__((noinline)) uint8_t bitrev(uint8_t bits) {
bits = (bits & 0x0f) << 4 | (bits & 0xf0) >> 4;
bits = (bits & 0b00110011) << 2 | (bits & 0b11001100) >> 2;
bits = (bits & 0b01010101) << 1 | (bits & 0b10101010) >> 1;
Expand Down
2 changes: 2 additions & 0 deletions tmk_core/protocol/vusb/vusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ typedef struct {
} __attribute__((packed)) vusb_mouse_report_t;

static void send_mouse(report_mouse_t *report) {
#if defined(MOUSE_ENABLE)
vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report};
if (usbInterruptIsReady3()) {
usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t));
}
#endif
}

#ifdef EXTRAKEY_ENABLE
Expand Down