MAGIC functionality, AG swap in default layout

This commit is contained in:
Jack Humbert 2016-04-16 18:51:58 -04:00
parent 5f648b6c40
commit ab19ebd08a
10 changed files with 226 additions and 161 deletions

View file

@ -21,6 +21,9 @@ ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes)
SRC += $(COMMON_DIR)/bootmagic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBOOTMAGIC_ENABLE
else
SRC += $(COMMON_DIR)/magic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
endif
ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)

View file

@ -27,7 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "command.h"
#include "util.h"
#include "sendchar.h"
#include "bootmagic.h"
#ifdef BOOTMAGIC_ENABLE
#include "bootmagic.h"
#else
#include "magic.h"
#endif
#include "eeconfig.h"
#include "backlight.h"
#ifdef MOUSEKEY_ENABLE
@ -86,6 +90,8 @@ void keyboard_init(void)
#ifdef BOOTMAGIC_ENABLE
bootmagic();
#else
magic();
#endif
#ifdef BACKLIGHT_ENABLE

View file

@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include "action.h"
#ifdef BOOTMAGIC_ENABLE
/* NOTE: Not portable. Bit field order depends on implementation */
typedef union {
uint8_t raw;
@ -39,7 +37,6 @@ typedef union {
};
} keymap_config_t;
keymap_config_t keymap_config;
#endif
/* translates key to keycode */

36
tmk_core/common/magic.c Normal file
View file

@ -0,0 +1,36 @@
#include <stdint.h>
#include <stdbool.h>
#include <util/delay.h>
#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;
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();
#ifdef NKRO_ENABLE
keyboard_nkro = keymap_config.nkro;
#endif
uint8_t default_layer = 0;
default_layer = eeconfig_read_default_layer();
default_layer_set((uint32_t)default_layer);
}

6
tmk_core/common/magic.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef MAGIC_H
#define MAGIC_H
void magic(void);
#endif