Overhaul bootmagic logic to have single entrypoint (#8532)
* Relocate bootmagic logic to have single entrypoint * Align init of layer state
This commit is contained in:
parent
02dc3b6722
commit
a3cbc8a004
@ -421,10 +421,6 @@ ifeq ($(strip $(TERMINAL_ENABLE)), yes)
|
|||||||
OPT_DEFS += -DUSER_PRINT
|
OPT_DEFS += -DUSER_PRINT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(USB_HID_ENABLE)), yes)
|
|
||||||
include $(TMK_DIR)/protocol/usb_hid.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(WPM_ENABLE)), yes)
|
ifeq ($(strip $(WPM_ENABLE)), yes)
|
||||||
SRC += $(QUANTUM_DIR)/wpm.c
|
SRC += $(QUANTUM_DIR)/wpm.c
|
||||||
OPT_DEFS += -DWPM_ENABLE
|
OPT_DEFS += -DWPM_ENABLE
|
||||||
@ -458,6 +454,23 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
|
|||||||
SRC += $(QUANTUM_DIR)/dip_switch.c
|
SRC += $(QUANTUM_DIR)/dip_switch.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
VALID_MAGIC_TYPES := yes full lite
|
||||||
|
BOOTMAGIC_ENABLE ?= no
|
||||||
|
ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
|
||||||
|
ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),)
|
||||||
|
$(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic)
|
||||||
|
endif
|
||||||
|
ifeq ($(strip $(BOOTMAGIC_ENABLE)), lite)
|
||||||
|
OPT_DEFS += -DBOOTMAGIC_LITE
|
||||||
|
QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c
|
||||||
|
else
|
||||||
|
OPT_DEFS += -DBOOTMAGIC_ENABLE
|
||||||
|
QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_full.c
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
COMMON_VPATH += $(QUANTUM_DIR)/bootmagic
|
||||||
|
QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/magic.c
|
||||||
|
|
||||||
VALID_CUSTOM_MATRIX_TYPES:= yes lite no
|
VALID_CUSTOM_MATRIX_TYPES:= yes lite no
|
||||||
|
|
||||||
CUSTOM_MATRIX ?= no
|
CUSTOM_MATRIX ?= no
|
||||||
|
24
quantum/bootmagic/bootmagic.h
Normal file
24
quantum/bootmagic/bootmagic.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(BOOTMAGIC_ENABLE)
|
||||||
|
# include "bootmagic_full.h"
|
||||||
|
#elif defined(BOOTMAGIC_LITE)
|
||||||
|
# include "bootmagic_lite.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void bootmagic(void);
|
@ -1,3 +1,18 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
@ -10,18 +25,35 @@
|
|||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
#include "bootmagic.h"
|
#include "bootmagic.h"
|
||||||
|
|
||||||
keymap_config_t keymap_config;
|
/** \brief Scan Keycode
|
||||||
|
|
||||||
/** \brief Bootmagic
|
|
||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
*/
|
*/
|
||||||
void bootmagic(void) {
|
static bool scan_keycode(uint8_t keycode) {
|
||||||
/* check signature */
|
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
||||||
if (!eeconfig_is_enabled()) {
|
matrix_row_t matrix_row = matrix_get_row(r);
|
||||||
eeconfig_init();
|
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
||||||
|
if (matrix_row & ((matrix_row_t)1 << c)) {
|
||||||
|
if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Bootmagic Scan Keycode
|
||||||
|
*
|
||||||
|
* FIXME: needs doc
|
||||||
|
*/
|
||||||
|
static bool bootmagic_scan_keycode(uint8_t keycode) {
|
||||||
|
if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
|
||||||
|
|
||||||
|
return scan_keycode(keycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bootmagic(void) {
|
||||||
/* do scans in case of bounce */
|
/* do scans in case of bounce */
|
||||||
print("bootmagic scan: ... ");
|
print("bootmagic scan: ... ");
|
||||||
uint8_t scan = 100;
|
uint8_t scan = 100;
|
||||||
@ -46,8 +78,6 @@ void bootmagic(void) {
|
|||||||
bootloader_jump();
|
bootloader_jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* debug enable */
|
|
||||||
debug_config.raw = eeconfig_read_debug();
|
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
|
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
|
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
|
||||||
debug_config.matrix = !debug_config.matrix;
|
debug_config.matrix = !debug_config.matrix;
|
||||||
@ -61,8 +91,6 @@ void bootmagic(void) {
|
|||||||
}
|
}
|
||||||
eeconfig_update_debug(debug_config.raw);
|
eeconfig_update_debug(debug_config.raw);
|
||||||
|
|
||||||
/* keymap config */
|
|
||||||
keymap_config.raw = eeconfig_read_keymap();
|
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) {
|
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) {
|
||||||
keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
|
keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
|
||||||
}
|
}
|
||||||
@ -94,70 +122,34 @@ void bootmagic(void) {
|
|||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) {
|
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) {
|
||||||
default_layer |= (1 << 0);
|
default_layer |= (1 << 0);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) {
|
||||||
default_layer |= (1 << 1);
|
default_layer |= (1 << 1);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) {
|
||||||
default_layer |= (1 << 2);
|
default_layer |= (1 << 2);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) {
|
||||||
default_layer |= (1 << 3);
|
default_layer |= (1 << 3);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) {
|
||||||
default_layer |= (1 << 4);
|
default_layer |= (1 << 4);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) {
|
||||||
default_layer |= (1 << 5);
|
default_layer |= (1 << 5);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) {
|
||||||
default_layer |= (1 << 6);
|
default_layer |= (1 << 6);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) {
|
||||||
default_layer |= (1 << 7);
|
default_layer |= (1 << 7);
|
||||||
}
|
}
|
||||||
if (default_layer) {
|
eeconfig_update_default_layer(default_layer);
|
||||||
eeconfig_update_default_layer(default_layer);
|
|
||||||
default_layer_set((layer_state_t)default_layer);
|
|
||||||
} else {
|
|
||||||
default_layer = eeconfig_read_default_layer();
|
|
||||||
default_layer_set((layer_state_t)default_layer);
|
|
||||||
}
|
|
||||||
/* Also initialize layer state to trigger callback functions for layer_state */
|
|
||||||
layer_state_set_kb((layer_state_t)layer_state);
|
|
||||||
|
|
||||||
/* EE_HANDS handedness */
|
/* EE_HANDS handedness */
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) {
|
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) {
|
||||||
eeconfig_update_handedness(true);
|
eeconfig_update_handedness(true);
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) {
|
else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) {
|
||||||
eeconfig_update_handedness(false);
|
eeconfig_update_handedness(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Scan Keycode
|
|
||||||
*
|
|
||||||
* FIXME: needs doc
|
|
||||||
*/
|
|
||||||
static bool scan_keycode(uint8_t keycode) {
|
|
||||||
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
|
||||||
matrix_row_t matrix_row = matrix_get_row(r);
|
|
||||||
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
|
||||||
if (matrix_row & ((matrix_row_t)1 << c)) {
|
|
||||||
if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Bootmagic Scan Keycode
|
|
||||||
*
|
|
||||||
* FIXME: needs doc
|
|
||||||
*/
|
|
||||||
bool bootmagic_scan_keycode(uint8_t keycode) {
|
|
||||||
if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
|
|
||||||
|
|
||||||
return scan_keycode(keycode);
|
|
||||||
}
|
|
@ -1,3 +1,19 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* FIXME: Add special doxygen comments for defines here. */
|
/* FIXME: Add special doxygen comments for defines here. */
|
||||||
@ -96,7 +112,4 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7
|
#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7
|
||||||
# define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7
|
# define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void bootmagic(void);
|
|
||||||
bool bootmagic_scan_keycode(uint8_t keycode);
|
|
@ -1,3 +1,18 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
/** \brief Reset eeprom
|
/** \brief Reset eeprom
|
||||||
@ -47,3 +62,5 @@ __attribute__((weak)) void bootmagic_lite(void) {
|
|||||||
bootloader_jump();
|
bootloader_jump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bootmagic(void) { bootmagic_lite(); }
|
25
quantum/bootmagic/bootmagic_lite.h
Normal file
25
quantum/bootmagic/bootmagic_lite.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef BOOTMAGIC_LITE_COLUMN
|
||||||
|
# define BOOTMAGIC_LITE_COLUMN 0
|
||||||
|
#endif
|
||||||
|
#ifndef BOOTMAGIC_LITE_ROW
|
||||||
|
# define BOOTMAGIC_LITE_ROW 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void bootmagic_lite(void);
|
54
quantum/bootmagic/magic.c
Normal file
54
quantum/bootmagic/magic.c
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "wait.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "bootloader.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "keymap.h"
|
||||||
|
#include "host.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "eeconfig.h"
|
||||||
|
#include "bootmagic.h"
|
||||||
|
|
||||||
|
keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
__attribute__((weak)) void bootmagic(void) {}
|
||||||
|
|
||||||
|
/** \brief Magic
|
||||||
|
*
|
||||||
|
* FIXME: Needs doc
|
||||||
|
*/
|
||||||
|
void magic(void) {
|
||||||
|
/* check signature */
|
||||||
|
if (!eeconfig_is_enabled()) {
|
||||||
|
eeconfig_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* init globals */
|
||||||
|
debug_config.raw = eeconfig_read_debug();
|
||||||
|
keymap_config.raw = eeconfig_read_keymap();
|
||||||
|
|
||||||
|
bootmagic();
|
||||||
|
|
||||||
|
/* read here just incase bootmagic process changed its value */
|
||||||
|
layer_state_t default_layer = (layer_state_t)eeconfig_read_default_layer();
|
||||||
|
default_layer_set(default_layer);
|
||||||
|
|
||||||
|
/* Also initialize layer state to trigger callback functions for layer_state */
|
||||||
|
layer_state_set_kb((layer_state_t)layer_state);
|
||||||
|
}
|
18
quantum/bootmagic/magic.h
Normal file
18
quantum/bootmagic/magic.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* Copyright 2021 QMK
|
||||||
|
*
|
||||||
|
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
void magic(void);
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
#include "magic.h"
|
||||||
|
|
||||||
#ifdef BLUETOOTH_ENABLE
|
#ifdef BLUETOOTH_ENABLE
|
||||||
# include "outputselect.h"
|
# include "outputselect.h"
|
||||||
@ -601,12 +602,7 @@ void tap_random_base64(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init_quantum() {
|
void matrix_init_quantum() {
|
||||||
#ifdef BOOTMAGIC_LITE
|
magic();
|
||||||
bootmagic_lite();
|
|
||||||
#endif
|
|
||||||
if (!eeconfig_is_enabled()) {
|
|
||||||
eeconfig_init();
|
|
||||||
}
|
|
||||||
#if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN)
|
#if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN)
|
||||||
// TODO: remove calls to led_init_ports from keyboards and remove ifdef
|
// TODO: remove calls to led_init_ports from keyboards and remove ifdef
|
||||||
led_init_ports();
|
led_init_ports();
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
#include "bootloader.h"
|
#include "bootloader.h"
|
||||||
|
#include "bootmagic.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "sync_timer.h"
|
#include "sync_timer.h"
|
||||||
#include "config_common.h"
|
#include "config_common.h"
|
||||||
@ -283,15 +284,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record);
|
|||||||
void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
|
void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
|
||||||
void post_process_record_user(uint16_t keycode, keyrecord_t *record);
|
void post_process_record_user(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
#ifndef BOOTMAGIC_LITE_COLUMN
|
|
||||||
# define BOOTMAGIC_LITE_COLUMN 0
|
|
||||||
#endif
|
|
||||||
#ifndef BOOTMAGIC_LITE_ROW
|
|
||||||
# define BOOTMAGIC_LITE_ROW 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void bootmagic_lite(void);
|
|
||||||
|
|
||||||
void reset_keyboard(void);
|
void reset_keyboard(void);
|
||||||
|
|
||||||
void startup_user(void);
|
void startup_user(void);
|
||||||
|
@ -24,28 +24,6 @@ else
|
|||||||
include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
|
include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Option modules
|
|
||||||
BOOTMAGIC_ENABLE ?= no
|
|
||||||
VALID_MAGIC_TYPES := yes full lite
|
|
||||||
ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
|
|
||||||
ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),)
|
|
||||||
$(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic)
|
|
||||||
endif
|
|
||||||
ifeq ($(strip $(BOOTMAGIC_ENABLE)), lite)
|
|
||||||
TMK_COMMON_DEFS += -DBOOTMAGIC_LITE
|
|
||||||
TMK_COMMON_SRC += $(COMMON_DIR)/bootmagic_lite.c
|
|
||||||
|
|
||||||
TMK_COMMON_DEFS += -DMAGIC_ENABLE
|
|
||||||
TMK_COMMON_SRC += $(COMMON_DIR)/magic.c
|
|
||||||
else
|
|
||||||
TMK_COMMON_DEFS += -DBOOTMAGIC_ENABLE
|
|
||||||
TMK_COMMON_SRC += $(COMMON_DIR)/bootmagic.c
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
TMK_COMMON_DEFS += -DMAGIC_ENABLE
|
|
||||||
TMK_COMMON_SRC += $(COMMON_DIR)/magic.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
SHARED_EP_ENABLE = no
|
SHARED_EP_ENABLE = no
|
||||||
MOUSE_SHARED_EP ?= yes
|
MOUSE_SHARED_EP ?= yes
|
||||||
ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes)
|
ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes)
|
||||||
|
@ -34,11 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
# include "backlight.h"
|
# include "backlight.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef BOOTMAGIC_ENABLE
|
|
||||||
# include "bootmagic.h"
|
|
||||||
#else
|
|
||||||
# include "magic.h"
|
|
||||||
#endif
|
|
||||||
#ifdef MOUSEKEY_ENABLE
|
#ifdef MOUSEKEY_ENABLE
|
||||||
# include "mousekey.h"
|
# include "mousekey.h"
|
||||||
#endif
|
#endif
|
||||||
@ -296,11 +291,6 @@ void keyboard_init(void) {
|
|||||||
#ifdef ADB_MOUSE_ENABLE
|
#ifdef ADB_MOUSE_ENABLE
|
||||||
adb_mouse_init();
|
adb_mouse_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef BOOTMAGIC_ENABLE
|
|
||||||
bootmagic();
|
|
||||||
#else
|
|
||||||
magic();
|
|
||||||
#endif
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
backlight_init();
|
backlight_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#if defined(__AVR__)
|
|
||||||
# include <util/delay.h>
|
|
||||||
#endif
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "bootloader.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "eeconfig.h"
|
|
||||||
#include "magic.h"
|
|
||||||
|
|
||||||
keymap_config_t keymap_config;
|
|
||||||
|
|
||||||
/** \brief Magic
|
|
||||||
*
|
|
||||||
* FIXME: Needs doc
|
|
||||||
*/
|
|
||||||
void magic(void) {
|
|
||||||
/* check signature */
|
|
||||||
if (!eeconfig_is_enabled()) {
|
|
||||||
eeconfig_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* debug enable */
|
|
||||||
debug_config.raw = eeconfig_read_debug();
|
|
||||||
|
|
||||||
/* keymap config */
|
|
||||||
keymap_config.raw = eeconfig_read_keymap();
|
|
||||||
|
|
||||||
uint8_t default_layer = 0;
|
|
||||||
default_layer = eeconfig_read_default_layer();
|
|
||||||
default_layer_set((layer_state_t)default_layer);
|
|
||||||
|
|
||||||
/* Also initialize layer state to trigger callback functions for layer_state */
|
|
||||||
layer_state_set_kb((layer_state_t)layer_state);
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
void magic(void);
|
|
@ -54,5 +54,9 @@ ifeq ($(strip $(XT_ENABLE)), yes)
|
|||||||
OPT_DEFS += -DXT_ENABLE
|
OPT_DEFS += -DXT_ENABLE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(USB_HID_ENABLE)), yes)
|
||||||
|
include $(TMK_DIR)/protocol/usb_hid.mk
|
||||||
|
endif
|
||||||
|
|
||||||
# Search Path
|
# Search Path
|
||||||
VPATH += $(TMK_DIR)/protocol
|
VPATH += $(TMK_DIR)/protocol
|
||||||
|
Loading…
Reference in New Issue
Block a user