Merge branch 'actionmap'
This commit is contained in:
commit
3349b6a56d
@ -48,16 +48,9 @@ TMK_DIR = ../../tmk_core
|
|||||||
TARGET_DIR = .
|
TARGET_DIR = .
|
||||||
|
|
||||||
# project specific files
|
# project specific files
|
||||||
SRC = keymap_common.c \
|
SRC = matrix.c \
|
||||||
matrix.c \
|
|
||||||
led.c
|
led.c
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.c $(SRC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config.h
|
CONFIG_H = config.h
|
||||||
|
|
||||||
|
|
||||||
@ -120,6 +113,20 @@ CONSOLE_ENABLE = yes # Console for debug(+400)
|
|||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||||
|
ACTIONMAP_ENABLE = yes # Use 16bit action codes in keymap instead of 8bit keycodes
|
||||||
|
|
||||||
|
|
||||||
|
ifdef ACTIONMAP_ENABLE
|
||||||
|
KEYMAP_FILE = actionmap
|
||||||
|
else
|
||||||
|
KEYMAP_FILE = keymap
|
||||||
|
SRC := keymap_common.c $(SRC)
|
||||||
|
endif
|
||||||
|
ifdef KEYMAP
|
||||||
|
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
|
||||||
|
else
|
||||||
|
SRC := $(KEYMAP_FILE)_plain.c $(SRC)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Optimize size but this may cause error "relocation truncated to fit"
|
# Optimize size but this may cause error "relocation truncated to fit"
|
||||||
|
54
keyboard/alps64/actionmap_common.h
Normal file
54
keyboard/alps64/actionmap_common.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 Jun Wako <wakojun@gmail.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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef ACTIONMAP_COMMON_H
|
||||||
|
#define ACTIONMAP_COMMON_H
|
||||||
|
|
||||||
|
|
||||||
|
/* Alps64 keymap definition macro */
|
||||||
|
#define ACTIONMAP( \
|
||||||
|
K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \
|
||||||
|
K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
|
||||||
|
K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
|
||||||
|
K31, K41, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, K22, \
|
||||||
|
K30, K40, K50, K60, K70, K00, K10, K20 \
|
||||||
|
) { \
|
||||||
|
{ AC_##K00, AC_##K01, AC_##K02, AC_##K03, AC_##K04, AC_##K05, AC_##K06, AC_##K07 }, \
|
||||||
|
{ AC_##K10, AC_##K11, AC_##K12, AC_##K13, AC_##K14, AC_##K15, AC_##K16, AC_##K17 }, \
|
||||||
|
{ AC_##K20, AC_##K21, AC_##K22, AC_##K23, AC_##K24, AC_##K25, AC_##K26, AC_##K27 }, \
|
||||||
|
{ AC_##K30, AC_##K31, AC_##K32, AC_##K33, AC_##K34, AC_##K35, AC_##K36, AC_##K37 }, \
|
||||||
|
{ AC_##K40, AC_##K41, AC_##K42, AC_##K43, AC_##K44, AC_##K45, AC_##K46, AC_##K47 }, \
|
||||||
|
{ AC_##K50, AC_##K51, AC_##K52, AC_##K53, AC_##K54, AC_##K55, AC_##K56, AC_##K57 }, \
|
||||||
|
{ AC_##K60, AC_##K61, AC_##K62, AC_##K63, AC_##K64, AC_##K65, AC_##K66, AC_##K67 }, \
|
||||||
|
{ AC_##K70, AC_##K71, AC_##K72, AC_##K73, AC_##K74, AC_##K75, AC_##K76, AC_##K77 } \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AEK US */
|
||||||
|
#define ACTIONMAP_AEK( \
|
||||||
|
K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K27, \
|
||||||
|
K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
|
||||||
|
K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
|
||||||
|
K31, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, \
|
||||||
|
K30, K40, K50, K60, K00, K10, K20 \
|
||||||
|
) ACTIONMAP( \
|
||||||
|
K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, NUHS,K27, \
|
||||||
|
K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
|
||||||
|
K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
|
||||||
|
K31, NUBS,K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, ESC, \
|
||||||
|
K30, K40, K50, K60, APP, K00, K10, K20 \
|
||||||
|
)
|
||||||
|
|
||||||
|
#endif
|
149
keyboard/alps64/actionmap_hasu.c
Normal file
149
keyboard/alps64/actionmap_hasu.c
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "actionmap.h"
|
||||||
|
#include "action_code.h"
|
||||||
|
#include "actionmap_common.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
#define AC_LM1 ACTION_LAYER_MOMENTARY(1) // HHKB layer
|
||||||
|
#define AC_LT1 ACTION_LAYER_TAP_KEY(1, KC_ENTER) // HHKB layer
|
||||||
|
#define AC_LT2 ACTION_LAYER_TAP_KEY(2, KC_SLASH) // Cursor layer with Slash*
|
||||||
|
#define AC_LT3 ACTION_LAYER_TAP_KEY(3, KC_SCLN) // Mousekey layer with Semicolon*
|
||||||
|
#define AC_LT4 ACTION_LAYER_TAP_KEY(4, KC_SPC) // Space Fn
|
||||||
|
#define AC_LM3 ACTION_LAYER_MOMENTARY(3) // Mousekey layer(IJKL)
|
||||||
|
#define AC_APSW ACTION_MACRO(ALT_TAB) // Application switching
|
||||||
|
#define AC_BACK ACTION_MODS_KEY(MOD_LALT, KC_LEFT)
|
||||||
|
#define AC_FRWD ACTION_MODS_KEY(MOD_LALT, KC_RIGHT)
|
||||||
|
#define AC_LM5 ACTION_LAYER_MOMENTARY(5)
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro definition
|
||||||
|
*/
|
||||||
|
enum macro_id {
|
||||||
|
ALT_TAB,
|
||||||
|
};
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
switch (id) {
|
||||||
|
case ALT_TAB:
|
||||||
|
return (record->event.pressed ?
|
||||||
|
MACRO( D(LALT), D(TAB), END ) :
|
||||||
|
MACRO( U(TAB), END ));
|
||||||
|
}
|
||||||
|
return MACRO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/* Default Layer
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[0] = ACTIONMAP_AEK( \
|
||||||
|
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, \
|
||||||
|
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
|
||||||
|
LCTL,A, S, D, F, G, H, J, K, L, LT3, QUOT,LT1, \
|
||||||
|
LSFT,Z, X, C, V, B, N, M, COMM,DOT, LT2, RSFT, \
|
||||||
|
LCTL,LGUI,LALT, LT4, LM5, LM3, LM1),
|
||||||
|
/* HHKB mode[HHKB Fn]
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Del |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | | | | | | +| -|End|PgD|Dow|Shift |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[1] = ACTIONMAP_AEK( \
|
||||||
|
PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
|
||||||
|
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,DEL, \
|
||||||
|
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS),
|
||||||
|
|
||||||
|
/* Vi mode[Slash]
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Del |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[2] = ACTIONMAP_AEK( \
|
||||||
|
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
|
||||||
|
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, TRNS,TRNS,TRNS,DEL, \
|
||||||
|
TRNS,TRNS,LEFT,DOWN,RGHT,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS,ENT, \
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, TRNS,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS),
|
||||||
|
|
||||||
|
/* Mouse mode(IJKL)[Semicolon]
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
|
||||||
|
*/
|
||||||
|
[3] = ACTIONMAP_AEK( \
|
||||||
|
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_D,MS_U,WH_U,RGHT,BACK,FRWD,APSW, \
|
||||||
|
TRNS,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,TRNS,TRNS,\
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BACK,FRWD,TRNS,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, BTN1, TRNS,TRNS,TRNS),
|
||||||
|
|
||||||
|
/* Layer 4: Mouse mode(IJKL)[Space]
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
|
||||||
|
*/
|
||||||
|
[4] = ACTIONMAP_AEK( \
|
||||||
|
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
|
||||||
|
APSW,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,WH_D,MS_U,WH_U,RGHT,BACK,FRWD,APSW, \
|
||||||
|
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,MS_L,MS_D,MS_R,BTN1,TRNS,ENT, \
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BACK,TRNS,TRNS,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS),
|
||||||
|
|
||||||
|
/* 40% */
|
||||||
|
[5] = ACTIONMAP_AEK( \
|
||||||
|
TRNS,1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS,TRNS,TRNS, \
|
||||||
|
TRNS,s(1),s(2),s(3),s(4),s(5),s(6),s(7),s(8),s(9),s(0),TRNS,TRNS,TRNS, \
|
||||||
|
TRNS,1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS),
|
||||||
|
};
|
52
keyboard/alps64/actionmap_plain.c
Normal file
52
keyboard/alps64/actionmap_plain.c
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include "actionmap.h"
|
||||||
|
#include "action_code.h"
|
||||||
|
#include "actionmap_common.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
#define AC_LM1 ACTION_LAYER_MOMENTARY(1) // HHKB layer
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/* Default Layer
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BSpc |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[0] = ACTIONMAP_AEK( \
|
||||||
|
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
|
||||||
|
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
|
||||||
|
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
|
||||||
|
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, \
|
||||||
|
LCTL,LGUI,LALT, SPC, RALT,RGUI,LM1),
|
||||||
|
/* HHKB mode[HHKB Fn]
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Del |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | | | | | | +| -|End|PgD|Dow|Shift |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[1] = ACTIONMAP_AEK( \
|
||||||
|
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
|
||||||
|
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,DEL, \
|
||||||
|
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS, \
|
||||||
|
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS),
|
||||||
|
};
|
@ -6,7 +6,6 @@ SRC += $(COMMON_DIR)/host.c \
|
|||||||
$(COMMON_DIR)/action_macro.c \
|
$(COMMON_DIR)/action_macro.c \
|
||||||
$(COMMON_DIR)/action_layer.c \
|
$(COMMON_DIR)/action_layer.c \
|
||||||
$(COMMON_DIR)/action_util.c \
|
$(COMMON_DIR)/action_util.c \
|
||||||
$(COMMON_DIR)/keymap.c \
|
|
||||||
$(COMMON_DIR)/print.c \
|
$(COMMON_DIR)/print.c \
|
||||||
$(COMMON_DIR)/debug.c \
|
$(COMMON_DIR)/debug.c \
|
||||||
$(COMMON_DIR)/util.c \
|
$(COMMON_DIR)/util.c \
|
||||||
@ -17,6 +16,13 @@ SRC += $(COMMON_DIR)/host.c \
|
|||||||
|
|
||||||
|
|
||||||
# Option modules
|
# Option modules
|
||||||
|
ifdef ACTIONMAP_ENABLE
|
||||||
|
SRC += $(COMMON_DIR)/actionmap.c
|
||||||
|
OPT_DEFS += -DACTIONMAP_ENABLE
|
||||||
|
else
|
||||||
|
SRC += $(COMMON_DIR)/keymap.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef BOOTMAGIC_ENABLE
|
ifdef BOOTMAGIC_ENABLE
|
||||||
SRC += $(COMMON_DIR)/bootmagic.c
|
SRC += $(COMMON_DIR)/bootmagic.c
|
||||||
SRC += $(COMMON_DIR)/avr/eeconfig.c
|
SRC += $(COMMON_DIR)/avr/eeconfig.c
|
||||||
|
@ -251,8 +251,8 @@ enum layer_pram_tap_op {
|
|||||||
OP_OFF_ON,
|
OP_OFF_ON,
|
||||||
OP_SET_CLEAR,
|
OP_SET_CLEAR,
|
||||||
};
|
};
|
||||||
#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f))
|
#define ACTION_LAYER_BITOP(op, part, bits, on) ACTION(ACT_LAYER, (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f))
|
||||||
#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key))
|
#define ACTION_LAYER_TAP(layer, key) ACTION(ACT_LAYER_TAP, (layer)<<8 | (key))
|
||||||
/* Default Layer */
|
/* Default Layer */
|
||||||
#define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4))
|
#define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4))
|
||||||
#define ACTION_DEFAULT_LAYER_TOGGLE(layer) ACTION_DEFAULT_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4))
|
#define ACTION_DEFAULT_LAYER_TOGGLE(layer) ACTION_DEFAULT_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4))
|
||||||
|
@ -114,8 +114,7 @@ void layer_debug(void)
|
|||||||
|
|
||||||
action_t layer_switch_get_action(keypos_t key)
|
action_t layer_switch_get_action(keypos_t key)
|
||||||
{
|
{
|
||||||
action_t action;
|
action_t action = { .code = ACTION_TRANSPARENT };
|
||||||
action.code = ACTION_TRANSPARENT;
|
|
||||||
|
|
||||||
#ifndef NO_ACTION_LAYER
|
#ifndef NO_ACTION_LAYER
|
||||||
uint32_t layers = layer_state | default_layer_state;
|
uint32_t layers = layer_state | default_layer_state;
|
||||||
|
39
tmk_core/common/actionmap.c
Normal file
39
tmk_core/common/actionmap.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 Jun Wako <wakojun@gmail.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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "action_code.h"
|
||||||
|
#include "actionmap.h"
|
||||||
|
|
||||||
|
/* Converts key to action */
|
||||||
|
__attribute__ ((weak))
|
||||||
|
action_t action_for_key(uint8_t layer, keypos_t key)
|
||||||
|
{
|
||||||
|
return (action_t)pgm_read_word(&actionmaps[(layer)][(key.row)][(key.col)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Macro */
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
return MACRO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function */
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
}
|
459
tmk_core/common/actionmap.h
Normal file
459
tmk_core/common/actionmap.h
Normal file
@ -0,0 +1,459 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 Jun Wako <wakojun@gmail.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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef ACTIONMAP_H
|
||||||
|
#define ACTIONMAP_H
|
||||||
|
|
||||||
|
#include "keyboard.h"
|
||||||
|
#include "report.h"
|
||||||
|
#include "keycode.h"
|
||||||
|
#include "action_code.h"
|
||||||
|
#include "action.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Keymapping with 16bit action codes */
|
||||||
|
extern const uint16_t actionmaps[][MATRIX_ROWS][MATRIX_COLS];
|
||||||
|
|
||||||
|
|
||||||
|
/* Modified key */
|
||||||
|
#define AC_c(kc) ACTION_MODS_KEY(MOD_LCTL, KC_##kc)
|
||||||
|
#define AC_s(kc) ACTION_MODS_KEY(MOD_LSFT, KC_##kc)
|
||||||
|
#define AC_a(kc) ACTION_MODS_KEY(MOD_LALT, KC_##kc)
|
||||||
|
#define AC_g(kc) ACTION_MODS_KEY(MOD_LSFT, KC_##kc)
|
||||||
|
|
||||||
|
/* Normal key */
|
||||||
|
#define AC_NO ACTION_KEY(KC_NO)
|
||||||
|
#define AC_TRANSPARENT ACTION_KEY(KC_TRANSPARENT)
|
||||||
|
#define AC_ROLL_OVER ACTION_KEY(KC_ROLL_OVER)
|
||||||
|
#define AC_POST_FAIL ACTION_KEY(KC_POST_FAIL)
|
||||||
|
#define AC_UNDEFINED ACTION_KEY(KC_UNDEFINED)
|
||||||
|
#define AC_A ACTION_KEY(KC_A)
|
||||||
|
#define AC_B ACTION_KEY(KC_B)
|
||||||
|
#define AC_C ACTION_KEY(KC_C)
|
||||||
|
#define AC_D ACTION_KEY(KC_D)
|
||||||
|
#define AC_E ACTION_KEY(KC_E)
|
||||||
|
#define AC_F ACTION_KEY(KC_F)
|
||||||
|
#define AC_G ACTION_KEY(KC_G)
|
||||||
|
#define AC_H ACTION_KEY(KC_H)
|
||||||
|
#define AC_I ACTION_KEY(KC_I)
|
||||||
|
#define AC_J ACTION_KEY(KC_J)
|
||||||
|
#define AC_K ACTION_KEY(KC_K)
|
||||||
|
#define AC_L ACTION_KEY(KC_L)
|
||||||
|
#define AC_M ACTION_KEY(KC_M)
|
||||||
|
#define AC_N ACTION_KEY(KC_N)
|
||||||
|
#define AC_O ACTION_KEY(KC_O)
|
||||||
|
#define AC_P ACTION_KEY(KC_P)
|
||||||
|
#define AC_Q ACTION_KEY(KC_Q)
|
||||||
|
#define AC_R ACTION_KEY(KC_R)
|
||||||
|
#define AC_S ACTION_KEY(KC_S)
|
||||||
|
#define AC_T ACTION_KEY(KC_T)
|
||||||
|
#define AC_U ACTION_KEY(KC_U)
|
||||||
|
#define AC_V ACTION_KEY(KC_V)
|
||||||
|
#define AC_W ACTION_KEY(KC_W)
|
||||||
|
#define AC_X ACTION_KEY(KC_X)
|
||||||
|
#define AC_Y ACTION_KEY(KC_Y)
|
||||||
|
#define AC_Z ACTION_KEY(KC_Z)
|
||||||
|
#define AC_1 ACTION_KEY(KC_1)
|
||||||
|
#define AC_2 ACTION_KEY(KC_2)
|
||||||
|
#define AC_3 ACTION_KEY(KC_3)
|
||||||
|
#define AC_4 ACTION_KEY(KC_4)
|
||||||
|
#define AC_5 ACTION_KEY(KC_5)
|
||||||
|
#define AC_6 ACTION_KEY(KC_6)
|
||||||
|
#define AC_7 ACTION_KEY(KC_7)
|
||||||
|
#define AC_8 ACTION_KEY(KC_8)
|
||||||
|
#define AC_9 ACTION_KEY(KC_9)
|
||||||
|
#define AC_0 ACTION_KEY(KC_0)
|
||||||
|
#define AC_ENTER ACTION_KEY(KC_ENTER)
|
||||||
|
#define AC_ESCAPE ACTION_KEY(KC_ESCAPE)
|
||||||
|
#define AC_BSPACE ACTION_KEY(KC_BSPACE)
|
||||||
|
#define AC_TAB ACTION_KEY(KC_TAB)
|
||||||
|
#define AC_SPACE ACTION_KEY(KC_SPACE)
|
||||||
|
#define AC_MINUS ACTION_KEY(KC_MINUS)
|
||||||
|
#define AC_EQUAL ACTION_KEY(KC_EQUAL)
|
||||||
|
#define AC_LBRACKET ACTION_KEY(KC_LBRACKET)
|
||||||
|
#define AC_RBRACKET ACTION_KEY(KC_RBRACKET)
|
||||||
|
#define AC_BSLASH ACTION_KEY(KC_BSLASH)
|
||||||
|
#define AC_NONUS_HASH ACTION_KEY(KC_NONUS_HASH)
|
||||||
|
#define AC_SCOLON ACTION_KEY(KC_SCOLON)
|
||||||
|
#define AC_QUOTE ACTION_KEY(KC_QUOTE)
|
||||||
|
#define AC_GRAVE ACTION_KEY(KC_GRAVE)
|
||||||
|
#define AC_COMMA ACTION_KEY(KC_COMMA)
|
||||||
|
#define AC_DOT ACTION_KEY(KC_DOT)
|
||||||
|
#define AC_SLASH ACTION_KEY(KC_SLASH)
|
||||||
|
#define AC_CAPSLOCK ACTION_KEY(KC_CAPSLOCK)
|
||||||
|
#define AC_F1 ACTION_KEY(KC_F1)
|
||||||
|
#define AC_F2 ACTION_KEY(KC_F2)
|
||||||
|
#define AC_F3 ACTION_KEY(KC_F3)
|
||||||
|
#define AC_F4 ACTION_KEY(KC_F4)
|
||||||
|
#define AC_F5 ACTION_KEY(KC_F5)
|
||||||
|
#define AC_F6 ACTION_KEY(KC_F6)
|
||||||
|
#define AC_F7 ACTION_KEY(KC_F7)
|
||||||
|
#define AC_F8 ACTION_KEY(KC_F8)
|
||||||
|
#define AC_F9 ACTION_KEY(KC_F9)
|
||||||
|
#define AC_F10 ACTION_KEY(KC_F10)
|
||||||
|
#define AC_F11 ACTION_KEY(KC_F11)
|
||||||
|
#define AC_F12 ACTION_KEY(KC_F12)
|
||||||
|
#define AC_PSCREEN ACTION_KEY(KC_PSCREEN)
|
||||||
|
#define AC_SCROLLLOCK ACTION_KEY(KC_SCROLLLOCK)
|
||||||
|
#define AC_PAUSE ACTION_KEY(KC_PAUSE)
|
||||||
|
#define AC_INSERT ACTION_KEY(KC_INSERT)
|
||||||
|
#define AC_HOME ACTION_KEY(KC_HOME)
|
||||||
|
#define AC_PGUP ACTION_KEY(KC_PGUP)
|
||||||
|
#define AC_DELETE ACTION_KEY(KC_DELETE)
|
||||||
|
#define AC_END ACTION_KEY(KC_END)
|
||||||
|
#define AC_PGDOWN ACTION_KEY(KC_PGDOWN)
|
||||||
|
#define AC_RIGHT ACTION_KEY(KC_RIGHT)
|
||||||
|
#define AC_LEFT ACTION_KEY(KC_LEFT)
|
||||||
|
#define AC_DOWN ACTION_KEY(KC_DOWN)
|
||||||
|
#define AC_UP ACTION_KEY(KC_UP)
|
||||||
|
#define AC_NUMLOCK ACTION_KEY(KC_NUMLOCK)
|
||||||
|
#define AC_KP_SLASH ACTION_KEY(KC_KP_SLASH)
|
||||||
|
#define AC_KP_ASTERISK ACTION_KEY(KC_KP_ASTERISK)
|
||||||
|
#define AC_KP_MINUS ACTION_KEY(KC_KP_MINUS)
|
||||||
|
#define AC_KP_PLUS ACTION_KEY(KC_KP_PLUS)
|
||||||
|
#define AC_KP_ENTER ACTION_KEY(KC_KP_ENTER)
|
||||||
|
#define AC_KP_1 ACTION_KEY(KC_KP_1)
|
||||||
|
#define AC_KP_2 ACTION_KEY(KC_KP_2)
|
||||||
|
#define AC_KP_3 ACTION_KEY(KC_KP_3)
|
||||||
|
#define AC_KP_4 ACTION_KEY(KC_KP_4)
|
||||||
|
#define AC_KP_5 ACTION_KEY(KC_KP_5)
|
||||||
|
#define AC_KP_6 ACTION_KEY(KC_KP_6)
|
||||||
|
#define AC_KP_7 ACTION_KEY(KC_KP_7)
|
||||||
|
#define AC_KP_8 ACTION_KEY(KC_KP_8)
|
||||||
|
#define AC_KP_9 ACTION_KEY(KC_KP_9)
|
||||||
|
#define AC_KP_0 ACTION_KEY(KC_KP_0)
|
||||||
|
#define AC_KP_DOT ACTION_KEY(KC_KP_DOT)
|
||||||
|
#define AC_NONUS_BSLASH ACTION_KEY(KC_NONUS_BSLASH)
|
||||||
|
#define AC_APPLICATION ACTION_KEY(KC_APPLICATION)
|
||||||
|
#define AC_POWER ACTION_KEY(KC_POWER)
|
||||||
|
#define AC_KP_EQUAL ACTION_KEY(KC_KP_EQUAL)
|
||||||
|
#define AC_F13 ACTION_KEY(KC_F13)
|
||||||
|
#define AC_F14 ACTION_KEY(KC_F14)
|
||||||
|
#define AC_F15 ACTION_KEY(KC_F15)
|
||||||
|
#define AC_F16 ACTION_KEY(KC_F16)
|
||||||
|
#define AC_F17 ACTION_KEY(KC_F17)
|
||||||
|
#define AC_F18 ACTION_KEY(KC_F18)
|
||||||
|
#define AC_F19 ACTION_KEY(KC_F19)
|
||||||
|
#define AC_F20 ACTION_KEY(KC_F20)
|
||||||
|
#define AC_F21 ACTION_KEY(KC_F21)
|
||||||
|
#define AC_F22 ACTION_KEY(KC_F22)
|
||||||
|
#define AC_F23 ACTION_KEY(KC_F23)
|
||||||
|
#define AC_F24 ACTION_KEY(KC_F24)
|
||||||
|
#define AC_EXECUTE ACTION_KEY(KC_EXECUTE)
|
||||||
|
#define AC_HELP ACTION_KEY(KC_HELP)
|
||||||
|
#define AC_MENU ACTION_KEY(KC_MENU)
|
||||||
|
#define AC_SELECT ACTION_KEY(KC_SELECT)
|
||||||
|
#define AC_STOP ACTION_KEY(KC_STOP)
|
||||||
|
#define AC_AGAIN ACTION_KEY(KC_AGAIN)
|
||||||
|
#define AC_UNDO ACTION_KEY(KC_UNDO)
|
||||||
|
#define AC_CUT ACTION_KEY(KC_CUT)
|
||||||
|
#define AC_COPY ACTION_KEY(KC_COPY)
|
||||||
|
#define AC_PASTE ACTION_KEY(KC_PASTE)
|
||||||
|
#define AC_FIND ACTION_KEY(KC_FIND)
|
||||||
|
#define AC__MUTE ACTION_KEY(KC__MUTE)
|
||||||
|
#define AC__VOLUP ACTION_KEY(KC__VOLUP)
|
||||||
|
#define AC__VOLDOWN ACTION_KEY(KC__VOLDOWN)
|
||||||
|
#define AC_LOCKING_CAPS ACTION_KEY(KC_LOCKING_CAPS)
|
||||||
|
#define AC_LOCKING_NUM ACTION_KEY(KC_LOCKING_NUM)
|
||||||
|
#define AC_LOCKING_SCROLL ACTION_KEY(KC_LOCKING_SCROLL)
|
||||||
|
#define AC_KP_COMMA ACTION_KEY(KC_KP_COMMA)
|
||||||
|
#define AC_KP_EQUAL_AS400 ACTION_KEY(KC_KP_EQUAL_AS400)
|
||||||
|
#define AC_INT1 ACTION_KEY(KC_INT1)
|
||||||
|
#define AC_INT2 ACTION_KEY(KC_INT2)
|
||||||
|
#define AC_INT3 ACTION_KEY(KC_INT3)
|
||||||
|
#define AC_INT4 ACTION_KEY(KC_INT4)
|
||||||
|
#define AC_INT5 ACTION_KEY(KC_INT5)
|
||||||
|
#define AC_INT6 ACTION_KEY(KC_INT6)
|
||||||
|
#define AC_INT7 ACTION_KEY(KC_INT7)
|
||||||
|
#define AC_INT8 ACTION_KEY(KC_INT8)
|
||||||
|
#define AC_INT9 ACTION_KEY(KC_INT9)
|
||||||
|
#define AC_LANG1 ACTION_KEY(KC_LANG1)
|
||||||
|
#define AC_LANG2 ACTION_KEY(KC_LANG2)
|
||||||
|
#define AC_LANG3 ACTION_KEY(KC_LANG3)
|
||||||
|
#define AC_LANG4 ACTION_KEY(KC_LANG4)
|
||||||
|
#define AC_LANG5 ACTION_KEY(KC_LANG5)
|
||||||
|
#define AC_LANG6 ACTION_KEY(KC_LANG6)
|
||||||
|
#define AC_LANG7 ACTION_KEY(KC_LANG7)
|
||||||
|
#define AC_LANG8 ACTION_KEY(KC_LANG8)
|
||||||
|
#define AC_LANG9 ACTION_KEY(KC_LANG9)
|
||||||
|
#define AC_ALT_ERASE ACTION_KEY(KC_ALT_ERASE)
|
||||||
|
#define AC_SYSREQ ACTION_KEY(KC_SYSREQ)
|
||||||
|
#define AC_CANCEL ACTION_KEY(KC_CANCEL)
|
||||||
|
#define AC_CLEAR ACTION_KEY(KC_CLEAR)
|
||||||
|
#define AC_PRIOR ACTION_KEY(KC_PRIOR)
|
||||||
|
#define AC_RETURN ACTION_KEY(KC_RETURN)
|
||||||
|
#define AC_SEPARATOR ACTION_KEY(KC_SEPARATOR)
|
||||||
|
#define AC_OUT ACTION_KEY(KC_OUT)
|
||||||
|
#define AC_OPER ACTION_KEY(KC_OPER)
|
||||||
|
#define AC_CLEAR_AGAIN ACTION_KEY(KC_CLEAR_AGAIN)
|
||||||
|
#define AC_CRSEL ACTION_KEY(KC_CRSEL)
|
||||||
|
#define AC_EXSEL ACTION_KEY(KC_EXSEL)
|
||||||
|
#define AC_KP_00 ACTION_KEY(KC_KP_00)
|
||||||
|
#define AC_KP_000 ACTION_KEY(KC_KP_000)
|
||||||
|
#define AC_THOUSANDS_SEPARATOR ACTION_KEY(KC_THOUSANDS_SEPARATOR)
|
||||||
|
#define AC_DECIMAL_SEPARATOR ACTION_KEY(KC_DECIMAL_SEPARATOR)
|
||||||
|
#define AC_CURRENCY_UNIT ACTION_KEY(KC_CURRENCY_UNIT)
|
||||||
|
#define AC_CURRENCY_SUB_UNIT ACTION_KEY(KC_CURRENCY_SUB_UNIT)
|
||||||
|
#define AC_KP_LPAREN ACTION_KEY(KC_KP_LPAREN)
|
||||||
|
#define AC_KP_RPAREN ACTION_KEY(KC_KP_RPAREN)
|
||||||
|
#define AC_KP_LCBRACKET ACTION_KEY(KC_KP_LCBRACKET)
|
||||||
|
#define AC_KP_RCBRACKET ACTION_KEY(KC_KP_RCBRACKET)
|
||||||
|
#define AC_KP_TAB ACTION_KEY(KC_KP_TAB)
|
||||||
|
#define AC_KP_BSPACE ACTION_KEY(KC_KP_BSPACE)
|
||||||
|
#define AC_KP_A ACTION_KEY(KC_KP_A)
|
||||||
|
#define AC_KP_B ACTION_KEY(KC_KP_B)
|
||||||
|
#define AC_KP_C ACTION_KEY(KC_KP_C)
|
||||||
|
#define AC_KP_D ACTION_KEY(KC_KP_D)
|
||||||
|
#define AC_KP_E ACTION_KEY(KC_KP_E)
|
||||||
|
#define AC_KP_F ACTION_KEY(KC_KP_F)
|
||||||
|
#define AC_KP_XOR ACTION_KEY(KC_KP_XOR)
|
||||||
|
#define AC_KP_HAT ACTION_KEY(KC_KP_HAT)
|
||||||
|
#define AC_KP_PERC ACTION_KEY(KC_KP_PERC)
|
||||||
|
#define AC_KP_LT ACTION_KEY(KC_KP_LT)
|
||||||
|
#define AC_KP_GT ACTION_KEY(KC_KP_GT)
|
||||||
|
#define AC_KP_AND ACTION_KEY(KC_KP_AND)
|
||||||
|
#define AC_KP_LAZYAND ACTION_KEY(KC_KP_LAZYAND)
|
||||||
|
#define AC_KP_OR ACTION_KEY(KC_KP_OR)
|
||||||
|
#define AC_KP_LAZYOR ACTION_KEY(KC_KP_LAZYOR)
|
||||||
|
#define AC_KP_COLON ACTION_KEY(KC_KP_COLON)
|
||||||
|
#define AC_KP_HASH ACTION_KEY(KC_KP_HASH)
|
||||||
|
#define AC_KP_SPACE ACTION_KEY(KC_KP_SPACE)
|
||||||
|
#define AC_KP_ATMARK ACTION_KEY(KC_KP_ATMARK)
|
||||||
|
#define AC_KP_EXCLAMATION ACTION_KEY(KC_KP_EXCLAMATION)
|
||||||
|
#define AC_KP_MEM_STORE ACTION_KEY(KC_KP_MEM_STORE)
|
||||||
|
#define AC_KP_MEM_RECALL ACTION_KEY(KC_KP_MEM_RECALL)
|
||||||
|
#define AC_KP_MEM_CLEAR ACTION_KEY(KC_KP_MEM_CLEAR)
|
||||||
|
#define AC_KP_MEM_ADD ACTION_KEY(KC_KP_MEM_ADD)
|
||||||
|
#define AC_KP_MEM_SUB ACTION_KEY(KC_KP_MEM_SUB)
|
||||||
|
#define AC_KP_MEM_MUL ACTION_KEY(KC_KP_MEM_MUL)
|
||||||
|
#define AC_KP_MEM_DIV ACTION_KEY(KC_KP_MEM_DIV)
|
||||||
|
#define AC_KP_PLUS_MINUS ACTION_KEY(KC_KP_PLUS_MINUS)
|
||||||
|
#define AC_KP_CLEAR ACTION_KEY(KC_KP_CLEAR)
|
||||||
|
#define AC_KP_CLEAR_ENTRY ACTION_KEY(KC_KP_CLEAR_ENTRY)
|
||||||
|
#define AC_KP_BINARY ACTION_KEY(KC_KP_BINARY)
|
||||||
|
#define AC_KP_OCTAL ACTION_KEY(KC_KP_OCTAL)
|
||||||
|
#define AC_KP_DECIMAL ACTION_KEY(KC_KP_DECIMAL)
|
||||||
|
#define AC_KP_HEXADECIMAL ACTION_KEY(KC_KP_HEXADECIMAL)
|
||||||
|
|
||||||
|
/* Modifiers */
|
||||||
|
#define AC_LCTRL ACTION_KEY(KC_LCTRL)
|
||||||
|
#define AC_LSHIFT ACTION_KEY(KC_LSHIFT)
|
||||||
|
#define AC_LALT ACTION_KEY(KC_LALT)
|
||||||
|
#define AC_LGUI ACTION_KEY(KC_LGUI)
|
||||||
|
#define AC_RCTRL ACTION_KEY(KC_RCTRL)
|
||||||
|
#define AC_RSHIFT ACTION_KEY(KC_RSHIFT)
|
||||||
|
#define AC_RALT ACTION_KEY(KC_RALT)
|
||||||
|
#define AC_RGUI ACTION_KEY(KC_RGUI)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TMK extensions
|
||||||
|
*/
|
||||||
|
/* Sytem Control */
|
||||||
|
#define AC_SYSTEM_POWER ACTION_USAGE_SYSTEM(SYSTEM_POWER_DOWN)
|
||||||
|
#define AC_SYSTEM_SLEEP ACTION_USAGE_SYSTEM(SYSTEM_SLEEP)
|
||||||
|
#define AC_SYSTEM_WAKE ACTION_USAGE_SYSTEM(SYSTEM_WAKE_UP)
|
||||||
|
/* Consumer Page */
|
||||||
|
#define AC_AUDIO_MUTE ACTION_USAGE_CONSUMER(AUDIO_MUTE)
|
||||||
|
#define AC_AUDIO_VOL_UP ACTION_USAGE_CONSUMER(AUDIO_VOL_UP)
|
||||||
|
#define AC_AUDIO_VOL_DOWN ACTION_USAGE_CONSUMER(AUDIO_VOL_DOWN)
|
||||||
|
#define AC_MEDIA_NEXT_TRACK ACTION_USAGE_CONSUMER(TRANSPORT_NEXT_TRACK)
|
||||||
|
#define AC_MEDIA_PREV_TRACK ACTION_USAGE_CONSUMER(TRANSPORT_PREV_TRACK)
|
||||||
|
#define AC_MEDIA_FAST_FORWARD ACTION_USAGE_CONSUMER(TRANSPORT_FAST_FORWARD)
|
||||||
|
#define AC_MEDIA_REWIND ACTION_USAGE_CONSUMER(TRANSPORT_REWIND)
|
||||||
|
#define AC_MEDIA_STOP ACTION_USAGE_CONSUMER(TRANSPORT_STOP)
|
||||||
|
#define AC_MEDIA_PLAY_PAUSE ACTION_USAGE_CONSUMER(TRANSPORT_PLAY_PAUSE)
|
||||||
|
#define AC_MEDIA_EJECT ACTION_USAGE_CONSUMER(TRANSPORT_STOP_EJECT)
|
||||||
|
#define AC_MEDIA_SELECT ACTION_USAGE_CONSUMER(APPLAUNCH_CC_CONFIG)
|
||||||
|
#define AC_MAIL ACTION_USAGE_CONSUMER(APPLAUNCH_EMAIL)
|
||||||
|
#define AC_CALCULATOR ACTION_USAGE_CONSUMER(APPLAUNCH_CALCULATOR)
|
||||||
|
#define AC_MY_COMPUTER ACTION_USAGE_CONSUMER(APPLAUNCH_LOCAL_BROWSER)
|
||||||
|
#define AC_WWW_SEARCH ACTION_USAGE_CONSUMER(APPCONTROL_SEARCH)
|
||||||
|
#define AC_WWW_HOME ACTION_USAGE_CONSUMER(APPCONTROL_HOME)
|
||||||
|
#define AC_WWW_BACK ACTION_USAGE_CONSUMER(APPCONTROL_BACK)
|
||||||
|
#define AC_WWW_FORWARD ACTION_USAGE_CONSUMER(APPCONTROL_FORWARD)
|
||||||
|
#define AC_WWW_STOP ACTION_USAGE_CONSUMER(APPCONTROL_STOP)
|
||||||
|
#define AC_WWW_REFRESH ACTION_USAGE_CONSUMER(APPCONTROL_REFRESH)
|
||||||
|
#define AC_WWW_FAVORITES ACTION_USAGE_CONSUMER(APPCONTROL_BOOKMARKS)
|
||||||
|
/* Jump to bootloader */
|
||||||
|
#define AC_BOOTLOADER ACTION_KEY(KC_BOOTLOADER)
|
||||||
|
/* Fn key */
|
||||||
|
/*
|
||||||
|
#define AC_FN0 ACTION_KEY(KC_FN0)
|
||||||
|
#define AC_FN1 ACTION_KEY(KC_FN1)
|
||||||
|
#define AC_FN2 ACTION_KEY(KC_FN2)
|
||||||
|
#define AC_FN3 ACTION_KEY(KC_FN3)
|
||||||
|
#define AC_FN4 ACTION_KEY(KC_FN4)
|
||||||
|
#define AC_FN5 ACTION_KEY(KC_FN5)
|
||||||
|
#define AC_FN6 ACTION_KEY(KC_FN6)
|
||||||
|
#define AC_FN7 ACTION_KEY(KC_FN7)
|
||||||
|
#define AC_FN8 ACTION_KEY(KC_FN8)
|
||||||
|
#define AC_FN9 ACTION_KEY(KC_FN9)
|
||||||
|
#define AC_FN10 ACTION_KEY(KC_FN10)
|
||||||
|
#define AC_FN11 ACTION_KEY(KC_FN11)
|
||||||
|
#define AC_FN12 ACTION_KEY(KC_FN12)
|
||||||
|
#define AC_FN13 ACTION_KEY(KC_FN13)
|
||||||
|
#define AC_FN14 ACTION_KEY(KC_FN14)
|
||||||
|
#define AC_FN15 ACTION_KEY(KC_FN15)
|
||||||
|
#define AC_FN16 ACTION_KEY(KC_FN16)
|
||||||
|
#define AC_FN17 ACTION_KEY(KC_FN17)
|
||||||
|
#define AC_FN18 ACTION_KEY(KC_FN18)
|
||||||
|
#define AC_FN19 ACTION_KEY(KC_FN19)
|
||||||
|
#define AC_FN20 ACTION_KEY(KC_FN20)
|
||||||
|
#define AC_FN21 ACTION_KEY(KC_FN21)
|
||||||
|
#define AC_FN22 ACTION_KEY(KC_FN22)
|
||||||
|
#define AC_FN23 ACTION_KEY(KC_FN23)
|
||||||
|
#define AC_FN24 ACTION_KEY(KC_FN24)
|
||||||
|
#define AC_FN25 ACTION_KEY(KC_FN25)
|
||||||
|
#define AC_FN26 ACTION_KEY(KC_FN26)
|
||||||
|
#define AC_FN27 ACTION_KEY(KC_FN27)
|
||||||
|
#define AC_FN28 ACTION_KEY(KC_FN28)
|
||||||
|
#define AC_FN29 ACTION_KEY(KC_FN29)
|
||||||
|
#define AC_FN30 ACTION_KEY(KC_FN30)
|
||||||
|
#define AC_FN31 ACTION_KEY(KC_FN31)
|
||||||
|
*/
|
||||||
|
/* Mousekey */
|
||||||
|
#define AC_MS_UP ACTION_MOUSEKEY(KC_MS_UP)
|
||||||
|
#define AC_MS_DOWN ACTION_MOUSEKEY(KC_MS_DOWN)
|
||||||
|
#define AC_MS_LEFT ACTION_MOUSEKEY(KC_MS_LEFT)
|
||||||
|
#define AC_MS_RIGHT ACTION_MOUSEKEY(KC_MS_RIGHT)
|
||||||
|
#define AC_MS_BTN1 ACTION_MOUSEKEY(KC_MS_BTN1)
|
||||||
|
#define AC_MS_BTN2 ACTION_MOUSEKEY(KC_MS_BTN2)
|
||||||
|
#define AC_MS_BTN3 ACTION_MOUSEKEY(KC_MS_BTN3)
|
||||||
|
#define AC_MS_BTN4 ACTION_MOUSEKEY(KC_MS_BTN4)
|
||||||
|
#define AC_MS_BTN5 ACTION_MOUSEKEY(KC_MS_BTN5)
|
||||||
|
#define AC_MS_WH_UP ACTION_MOUSEKEY(KC_MS_WH_UP)
|
||||||
|
#define AC_MS_WH_DOWN ACTION_MOUSEKEY(KC_MS_WH_DOWN)
|
||||||
|
#define AC_MS_WH_LEFT ACTION_MOUSEKEY(KC_MS_WH_LEFT)
|
||||||
|
#define AC_MS_WH_RIGHT ACTION_MOUSEKEY(KC_MS_WH_RIGHT)
|
||||||
|
#define AC_MS_ACCEL0 ACTION_MOUSEKEY(KC_MS_ACCEL0)
|
||||||
|
#define AC_MS_ACCEL1 ACTION_MOUSEKEY(KC_MS_ACCEL1)
|
||||||
|
#define AC_MS_ACCEL2 ACTION_MOUSEKEY(KC_MS_ACCEL2)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Short names
|
||||||
|
*/
|
||||||
|
#define AC_LCTL ACTION_KEY(KC_LCTRL)
|
||||||
|
#define AC_RCTL ACTION_KEY(KC_RCTRL)
|
||||||
|
#define AC_LSFT ACTION_KEY(KC_LSHIFT)
|
||||||
|
#define AC_RSFT ACTION_KEY(KC_RSHIFT)
|
||||||
|
#define AC_ESC ACTION_KEY(KC_ESCAPE)
|
||||||
|
#define AC_BSPC ACTION_KEY(KC_BSPACE)
|
||||||
|
#define AC_ENT ACTION_KEY(KC_ENTER)
|
||||||
|
#define AC_DEL ACTION_KEY(KC_DELETE)
|
||||||
|
#define AC_INS ACTION_KEY(KC_INSERT)
|
||||||
|
#define AC_CAPS ACTION_KEY(KC_CAPSLOCK)
|
||||||
|
#define AC_CLCK ACTION_KEY(KC_CAPSLOCK)
|
||||||
|
#define AC_RGHT ACTION_KEY(KC_RIGHT)
|
||||||
|
#define AC_PGDN ACTION_KEY(KC_PGDOWN)
|
||||||
|
#define AC_PSCR ACTION_KEY(KC_PSCREEN)
|
||||||
|
#define AC_SLCK ACTION_KEY(KC_SCROLLLOCK)
|
||||||
|
#define AC_PAUS ACTION_KEY(KC_PAUSE)
|
||||||
|
#define AC_BRK ACTION_KEY(KC_PAUSE)
|
||||||
|
#define AC_NLCK ACTION_KEY(KC_NUMLOCK)
|
||||||
|
#define AC_SPC ACTION_KEY(KC_SPACE)
|
||||||
|
#define AC_MINS ACTION_KEY(KC_MINUS)
|
||||||
|
#define AC_EQL ACTION_KEY(KC_EQUAL)
|
||||||
|
#define AC_GRV ACTION_KEY(KC_GRAVE)
|
||||||
|
#define AC_RBRC ACTION_KEY(KC_RBRACKET)
|
||||||
|
#define AC_LBRC ACTION_KEY(KC_LBRACKET)
|
||||||
|
#define AC_COMM ACTION_KEY(KC_COMMA)
|
||||||
|
#define AC_BSLS ACTION_KEY(KC_BSLASH)
|
||||||
|
#define AC_SLSH ACTION_KEY(KC_SLASH)
|
||||||
|
#define AC_SCLN ACTION_KEY(KC_SCOLON)
|
||||||
|
#define AC_QUOT ACTION_KEY(KC_QUOTE)
|
||||||
|
#define AC_APP ACTION_KEY(KC_APPLICATION)
|
||||||
|
#define AC_NUHS ACTION_KEY(KC_NONUS_HASH)
|
||||||
|
#define AC_NUBS ACTION_KEY(KC_NONUS_BSLASH)
|
||||||
|
#define AC_LCAP ACTION_KEY(KC_LOCKING_CAPS)
|
||||||
|
#define AC_LNUM ACTION_KEY(KC_LOCKING_NUM)
|
||||||
|
#define AC_LSCR ACTION_KEY(KC_LOCKING_SCROLL)
|
||||||
|
#define AC_ERAS ACTION_KEY(KC_ALT_ERASE,)
|
||||||
|
#define AC_CLR ACTION_KEY(KC_CLEAR)
|
||||||
|
/* Japanese specific */
|
||||||
|
#define AC_ZKHK ACTION_KEY(KC_GRAVE)
|
||||||
|
#define AC_RO ACTION_KEY(KC_INT1)
|
||||||
|
#define AC_KANA ACTION_KEY(KC_INT2)
|
||||||
|
#define AC_JYEN ACTION_KEY(KC_INT3)
|
||||||
|
#define AC_HENK ACTION_KEY(KC_INT4)
|
||||||
|
#define AC_MHEN ACTION_KEY(KC_INT5)
|
||||||
|
/* Keypad */
|
||||||
|
#define AC_P1 ACTION_KEY(KC_KP_1)
|
||||||
|
#define AC_P2 ACTION_KEY(KC_KP_2)
|
||||||
|
#define AC_P3 ACTION_KEY(KC_KP_3)
|
||||||
|
#define AC_P4 ACTION_KEY(KC_KP_4)
|
||||||
|
#define AC_P5 ACTION_KEY(KC_KP_5)
|
||||||
|
#define AC_P6 ACTION_KEY(KC_KP_6)
|
||||||
|
#define AC_P7 ACTION_KEY(KC_KP_7)
|
||||||
|
#define AC_P8 ACTION_KEY(KC_KP_8)
|
||||||
|
#define AC_P9 ACTION_KEY(KC_KP_9)
|
||||||
|
#define AC_P0 ACTION_KEY(KC_KP_0)
|
||||||
|
#define AC_PDOT ACTION_KEY(KC_KP_DOT)
|
||||||
|
#define AC_PCMM ACTION_KEY(KC_KP_COMMA)
|
||||||
|
#define AC_PSLS ACTION_KEY(KC_KP_SLASH)
|
||||||
|
#define AC_PAST ACTION_KEY(KC_KP_ASTERISK)
|
||||||
|
#define AC_PMNS ACTION_KEY(KC_KP_MINUS)
|
||||||
|
#define AC_PPLS ACTION_KEY(KC_KP_PLUS)
|
||||||
|
#define AC_PEQL ACTION_KEY(KC_KP_EQUAL)
|
||||||
|
#define AC_PENT ACTION_KEY(KC_KP_ENTER)
|
||||||
|
/* Mousekey */
|
||||||
|
#define AC_MS_U ACTION_MOUSEKEY(KC_MS_UP)
|
||||||
|
#define AC_MS_D ACTION_MOUSEKEY(KC_MS_DOWN)
|
||||||
|
#define AC_MS_L ACTION_MOUSEKEY(KC_MS_LEFT)
|
||||||
|
#define AC_MS_R ACTION_MOUSEKEY(KC_MS_RIGHT)
|
||||||
|
#define AC_BTN1 ACTION_MOUSEKEY(KC_MS_BTN1)
|
||||||
|
#define AC_BTN2 ACTION_MOUSEKEY(KC_MS_BTN2)
|
||||||
|
#define AC_BTN3 ACTION_MOUSEKEY(KC_MS_BTN3)
|
||||||
|
#define AC_BTN4 ACTION_MOUSEKEY(KC_MS_BTN4)
|
||||||
|
#define AC_BTN5 ACTION_MOUSEKEY(KC_MS_BTN5)
|
||||||
|
#define AC_WH_U ACTION_MOUSEKEY(KC_MS_WH_UP)
|
||||||
|
#define AC_WH_D ACTION_MOUSEKEY(KC_MS_WH_DOWN)
|
||||||
|
#define AC_WH_L ACTION_MOUSEKEY(KC_MS_WH_LEFT)
|
||||||
|
#define AC_WH_R ACTION_MOUSEKEY(KC_MS_WH_RIGHT)
|
||||||
|
#define AC_ACL0 ACTION_MOUSEKEY(KC_MS_ACCEL0)
|
||||||
|
#define AC_ACL1 ACTION_MOUSEKEY(KC_MS_ACCEL1)
|
||||||
|
#define AC_ACL2 ACTION_MOUSEKEY(KC_MS_ACCEL2)
|
||||||
|
/* Sytem Control */
|
||||||
|
#define AC_PWR ACTION_USAGE_SYSTEM(SYSTEM_POWER_DOWN)
|
||||||
|
#define AC_SLEP ACTION_USAGE_SYSTEM(SYSTEM_SLEEP)
|
||||||
|
#define AC_WAKE ACTION_USAGE_SYSTEM(SYSTEM_WAKE_UP)
|
||||||
|
/* Consumer Page */
|
||||||
|
#define AC_MUTE ACTION_USAGE_CONSUMER(AUDIO_MUTE)
|
||||||
|
#define AC_VOLU ACTION_USAGE_CONSUMER(AUDIO_VOL_UP)
|
||||||
|
#define AC_VOLD ACTION_USAGE_CONSUMER(AUDIO_VOL_DOWN)
|
||||||
|
#define AC_MNXT ACTION_USAGE_CONSUMER(TRANSPORT_NEXT_TRACK)
|
||||||
|
#define AC_MPRV ACTION_USAGE_CONSUMER(TRANSPORT_PREV_TRACK)
|
||||||
|
#define AC_MFFD ACTION_USAGE_CONSUMER(TRANSPORT_FAST_FORWARD)
|
||||||
|
#define AC_MRWD ACTION_USAGE_CONSUMER(TRANSPORT_REWIND)
|
||||||
|
#define AC_MSTP ACTION_USAGE_CONSUMER(TRANSPORT_STOP)
|
||||||
|
#define AC_MPLY ACTION_USAGE_CONSUMER(TRANSPORT_PLAY_PAUSE)
|
||||||
|
#define AC_EJCT ACTION_USAGE_CONSUMER(TRANSPORT_STOP_EJECT)
|
||||||
|
#define AC_MSEL ACTION_USAGE_CONSUMER(APPLAUNCH_CC_CONFIG)
|
||||||
|
#define AC_MAIL ACTION_USAGE_CONSUMER(APPLAUNCH_EMAIL)
|
||||||
|
#define AC_CALC ACTION_USAGE_CONSUMER(APPLAUNCH_CALCULATOR)
|
||||||
|
#define AC_MYCM ACTION_USAGE_CONSUMER(APPLAUNCH_LOCAL_BROWSER)
|
||||||
|
#define AC_WSCH ACTION_USAGE_CONSUMER(APPCONTROL_SEARCH)
|
||||||
|
#define AC_WHOM ACTION_USAGE_CONSUMER(APPCONTROL_HOME)
|
||||||
|
#define AC_WBAK ACTION_USAGE_CONSUMER(APPCONTROL_BACK)
|
||||||
|
#define AC_WFWD ACTION_USAGE_CONSUMER(APPCONTROL_FORWARD)
|
||||||
|
#define AC_WSTP ACTION_USAGE_CONSUMER(APPCONTROL_STOP)
|
||||||
|
#define AC_WREF ACTION_USAGE_CONSUMER(APPCONTROL_REFRESH)
|
||||||
|
#define AC_WFAV ACTION_USAGE_CONSUMER(APPCONTROL_BOOKMARKS)
|
||||||
|
/* Jump to bootloader */
|
||||||
|
#define AC_BTLD ACTION_KEY(KC_BOOTLOADER)
|
||||||
|
/* Transparent */
|
||||||
|
#define AC_TRNS ACTION_KEY(KC_TRANSPARENT)
|
||||||
|
|
||||||
|
#endif
|
@ -5,6 +5,7 @@
|
|||||||
#include "bootloader.h"
|
#include "bootloader.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
|
#include "actionmap.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
@ -26,28 +27,28 @@ void bootmagic(void)
|
|||||||
print("done.\n");
|
print("done.\n");
|
||||||
|
|
||||||
/* bootmagic skip */
|
/* bootmagic skip */
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SKIP)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_SKIP)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eeconfig clear */
|
/* eeconfig clear */
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
|
||||||
eeconfig_init();
|
eeconfig_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bootloader */
|
/* bootloader */
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_BOOTLOADER)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_BOOTLOADER)) {
|
||||||
bootloader_jump();
|
bootloader_jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* debug enable */
|
/* debug enable */
|
||||||
debug_config.raw = eeconfig_read_debug();
|
debug_config.raw = eeconfig_read_debug();
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_ENABLE)) {
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MATRIX)) {
|
||||||
debug_config.matrix = !debug_config.matrix;
|
debug_config.matrix = !debug_config.matrix;
|
||||||
} else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) {
|
} else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) {
|
||||||
debug_config.keyboard = !debug_config.keyboard;
|
debug_config.keyboard = !debug_config.keyboard;
|
||||||
} else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MOUSE)) {
|
} else if (bootmagic_scan_key(BOOTMAGIC_KEY_DEBUG_MOUSE)) {
|
||||||
debug_config.mouse = !debug_config.mouse;
|
debug_config.mouse = !debug_config.mouse;
|
||||||
} else {
|
} else {
|
||||||
debug_config.enable = !debug_config.enable;
|
debug_config.enable = !debug_config.enable;
|
||||||
@ -57,28 +58,28 @@ void bootmagic(void)
|
|||||||
|
|
||||||
/* keymap config */
|
/* keymap config */
|
||||||
keymap_config.raw = eeconfig_read_keymap();
|
keymap_config.raw = eeconfig_read_keymap();
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) {
|
if (bootmagic_scan_key(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;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) {
|
||||||
keymap_config.capslock_to_control = !keymap_config.capslock_to_control;
|
keymap_config.capslock_to_control = !keymap_config.capslock_to_control;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) {
|
||||||
keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui;
|
keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) {
|
||||||
keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui;
|
keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_NO_GUI)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_NO_GUI)) {
|
||||||
keymap_config.no_gui = !keymap_config.no_gui;
|
keymap_config.no_gui = !keymap_config.no_gui;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) {
|
||||||
keymap_config.swap_grave_esc = !keymap_config.swap_grave_esc;
|
keymap_config.swap_grave_esc = !keymap_config.swap_grave_esc;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) {
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) {
|
||||||
keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace;
|
keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace;
|
||||||
}
|
}
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_HOST_NKRO)) {
|
if (bootmagic_scan_key(BOOTMAGIC_HOST_NKRO)) {
|
||||||
keymap_config.nkro = !keymap_config.nkro;
|
keymap_config.nkro = !keymap_config.nkro;
|
||||||
}
|
}
|
||||||
eeconfig_write_keymap(keymap_config.raw);
|
eeconfig_write_keymap(keymap_config.raw);
|
||||||
@ -89,14 +90,14 @@ void bootmagic(void)
|
|||||||
|
|
||||||
/* default layer */
|
/* default layer */
|
||||||
uint8_t default_layer = 0;
|
uint8_t default_layer = 0;
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { default_layer |= (1<<1); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { default_layer |= (1<<2); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { default_layer |= (1<<3); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { default_layer |= (1<<4); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { default_layer |= (1<<5); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); }
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); }
|
if (bootmagic_scan_key(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); }
|
||||||
if (default_layer) {
|
if (default_layer) {
|
||||||
eeconfig_write_default_layer(default_layer);
|
eeconfig_write_default_layer(default_layer);
|
||||||
default_layer_set((uint32_t)default_layer);
|
default_layer_set((uint32_t)default_layer);
|
||||||
@ -106,13 +107,22 @@ void bootmagic(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool scan_keycode(uint8_t keycode)
|
static bool scan_key(uint16_t code)
|
||||||
{
|
{
|
||||||
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
||||||
matrix_row_t matrix_row = matrix_get_row(r);
|
matrix_row_t matrix_row = matrix_get_row(r);
|
||||||
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
||||||
if (matrix_row & ((matrix_row_t)1<<c)) {
|
if (matrix_row & ((matrix_row_t)1<<c)) {
|
||||||
if (keycode == keymap_key_to_keycode(0, (keypos_t){ .row = r, .col = c })) {
|
// read key from Layer 0
|
||||||
|
action_t action = action_for_key(0, (keypos_t){ .row = r, .col = c });
|
||||||
|
if (action.code == code ||
|
||||||
|
((action.kind.id == ACT_LMODS ||
|
||||||
|
action.kind.id == ACT_RMODS ||
|
||||||
|
action.kind.id == ACT_LMODS_TAP ||
|
||||||
|
action.kind.id == ACT_RMODS_TAP ||
|
||||||
|
action.kind.id == ACT_LAYER_TAP ||
|
||||||
|
action.kind.id == ACT_LAYER_TAP_EXT) &&
|
||||||
|
action.key.code == code)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,9 +131,9 @@ static bool scan_keycode(uint8_t keycode)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bootmagic_scan_keycode(uint8_t keycode)
|
bool bootmagic_scan_key(uint16_t code)
|
||||||
{
|
{
|
||||||
if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false;
|
if (!scan_key(BOOTMAGIC_KEY_SALT)) return false;
|
||||||
|
|
||||||
return scan_keycode(keycode);
|
return scan_key(code);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,6 @@
|
|||||||
|
|
||||||
|
|
||||||
void bootmagic(void);
|
void bootmagic(void);
|
||||||
bool bootmagic_scan_keycode(uint8_t keycode);
|
bool bootmagic_scan_key(uint16_t action);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -153,8 +153,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define KC_MRWD KC_MEDIA_REWIND
|
#define KC_MRWD KC_MEDIA_REWIND
|
||||||
#define KC_MSTP KC_MEDIA_STOP
|
#define KC_MSTP KC_MEDIA_STOP
|
||||||
#define KC_MPLY KC_MEDIA_PLAY_PAUSE
|
#define KC_MPLY KC_MEDIA_PLAY_PAUSE
|
||||||
#define KC_MSEL KC_MEDIA_SELECT
|
|
||||||
#define KC_EJCT KC_MEDIA_EJECT
|
#define KC_EJCT KC_MEDIA_EJECT
|
||||||
|
#define KC_MSEL KC_MEDIA_SELECT
|
||||||
#define KC_MAIL KC_MAIL
|
#define KC_MAIL KC_MAIL
|
||||||
#define KC_CALC KC_CALCULATOR
|
#define KC_CALC KC_CALCULATOR
|
||||||
#define KC_MYCM KC_MY_COMPUTER
|
#define KC_MYCM KC_MY_COMPUTER
|
||||||
@ -420,10 +420,12 @@ enum internal_special_keycodes {
|
|||||||
KC_AUDIO_VOL_DOWN,
|
KC_AUDIO_VOL_DOWN,
|
||||||
KC_MEDIA_NEXT_TRACK,
|
KC_MEDIA_NEXT_TRACK,
|
||||||
KC_MEDIA_PREV_TRACK,
|
KC_MEDIA_PREV_TRACK,
|
||||||
|
KC_MEDIA_FAST_FORWARD,
|
||||||
|
KC_MEDIA_REWIND,
|
||||||
KC_MEDIA_STOP,
|
KC_MEDIA_STOP,
|
||||||
KC_MEDIA_PLAY_PAUSE,
|
KC_MEDIA_PLAY_PAUSE,
|
||||||
KC_MEDIA_SELECT,
|
|
||||||
KC_MEDIA_EJECT,
|
KC_MEDIA_EJECT,
|
||||||
|
KC_MEDIA_SELECT,
|
||||||
KC_MAIL,
|
KC_MAIL,
|
||||||
KC_CALCULATOR,
|
KC_CALCULATOR,
|
||||||
KC_MY_COMPUTER,
|
KC_MY_COMPUTER,
|
||||||
@ -433,9 +435,7 @@ enum internal_special_keycodes {
|
|||||||
KC_WWW_FORWARD,
|
KC_WWW_FORWARD,
|
||||||
KC_WWW_STOP,
|
KC_WWW_STOP,
|
||||||
KC_WWW_REFRESH,
|
KC_WWW_REFRESH,
|
||||||
KC_WWW_FAVORITES,
|
KC_WWW_FAVORITES, /* 0xBC */
|
||||||
KC_MEDIA_FAST_FORWARD,
|
|
||||||
KC_MEDIA_REWIND, /* 0xBC */
|
|
||||||
|
|
||||||
/* Jump to bootloader */
|
/* Jump to bootloader */
|
||||||
KC_BOOTLOADER = 0xBF,
|
KC_BOOTLOADER = 0xBF,
|
||||||
|
@ -46,25 +46,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define TRANSPORT_STOP_EJECT 0x00CC
|
#define TRANSPORT_STOP_EJECT 0x00CC
|
||||||
#define TRANSPORT_PLAY_PAUSE 0x00CD
|
#define TRANSPORT_PLAY_PAUSE 0x00CD
|
||||||
/* application launch */
|
/* application launch */
|
||||||
#define AL_CC_CONFIG 0x0183
|
#define APPLAUNCH_CC_CONFIG 0x0183
|
||||||
#define AL_EMAIL 0x018A
|
#define APPLAUNCH_EMAIL 0x018A
|
||||||
#define AL_CALCULATOR 0x0192
|
#define APPLAUNCH_CALCULATOR 0x0192
|
||||||
#define AL_LOCAL_BROWSER 0x0194
|
#define APPLAUNCH_LOCAL_BROWSER 0x0194
|
||||||
/* application control */
|
/* application control */
|
||||||
#define AC_SEARCH 0x0221
|
#define APPCONTROL_SEARCH 0x0221
|
||||||
#define AC_HOME 0x0223
|
#define APPCONTROL_HOME 0x0223
|
||||||
#define AC_BACK 0x0224
|
#define APPCONTROL_BACK 0x0224
|
||||||
#define AC_FORWARD 0x0225
|
#define APPCONTROL_FORWARD 0x0225
|
||||||
#define AC_STOP 0x0226
|
#define APPCONTROL_STOP 0x0226
|
||||||
#define AC_REFRESH 0x0227
|
#define APPCONTROL_REFRESH 0x0227
|
||||||
#define AC_BOOKMARKS 0x022A
|
#define APPCONTROL_BOOKMARKS 0x022A
|
||||||
/* supplement for Bluegiga iWRAP HID(not supported by Windows?) */
|
/* supplement for Bluegiga iWRAP HID(not supported by Windows?) */
|
||||||
#define AL_LOCK 0x019E
|
#define APPLAUNCH_LOCK 0x019E
|
||||||
#define TRANSPORT_RECORD 0x00B2
|
#define TRANSPORT_RECORD 0x00B2
|
||||||
#define TRANSPORT_FAST_FORWARD 0x00B3
|
#define TRANSPORT_FAST_FORWARD 0x00B3
|
||||||
#define TRANSPORT_REWIND 0x00B4
|
#define TRANSPORT_REWIND 0x00B4
|
||||||
#define TRANSPORT_EJECT 0x00B8
|
#define TRANSPORT_EJECT 0x00B8
|
||||||
#define AC_MINIMIZE 0x0206
|
#define APPCONTROL_MINIMIZE 0x0206
|
||||||
|
|
||||||
/* Generic Desktop Page(0x01) - system power control */
|
/* Generic Desktop Page(0x01) - system power control */
|
||||||
#define SYSTEM_POWER_DOWN 0x0081
|
#define SYSTEM_POWER_DOWN 0x0081
|
||||||
@ -169,17 +169,17 @@ typedef struct {
|
|||||||
(key == KC_MEDIA_STOP ? TRANSPORT_STOP : \
|
(key == KC_MEDIA_STOP ? TRANSPORT_STOP : \
|
||||||
(key == KC_MEDIA_EJECT ? TRANSPORT_STOP_EJECT : \
|
(key == KC_MEDIA_EJECT ? TRANSPORT_STOP_EJECT : \
|
||||||
(key == KC_MEDIA_PLAY_PAUSE ? TRANSPORT_PLAY_PAUSE : \
|
(key == KC_MEDIA_PLAY_PAUSE ? TRANSPORT_PLAY_PAUSE : \
|
||||||
(key == KC_MEDIA_SELECT ? AL_CC_CONFIG : \
|
(key == KC_MEDIA_SELECT ? APPLAUNCH_CC_CONFIG : \
|
||||||
(key == KC_MAIL ? AL_EMAIL : \
|
(key == KC_MAIL ? APPLAUNCH_EMAIL : \
|
||||||
(key == KC_CALCULATOR ? AL_CALCULATOR : \
|
(key == KC_CALCULATOR ? APPLAUNCH_CALCULATOR : \
|
||||||
(key == KC_MY_COMPUTER ? AL_LOCAL_BROWSER : \
|
(key == KC_MY_COMPUTER ? APPLAUNCH_LOCAL_BROWSER : \
|
||||||
(key == KC_WWW_SEARCH ? AC_SEARCH : \
|
(key == KC_WWW_SEARCH ? APPCONTROL_SEARCH : \
|
||||||
(key == KC_WWW_HOME ? AC_HOME : \
|
(key == KC_WWW_HOME ? APPCONTROL_HOME : \
|
||||||
(key == KC_WWW_BACK ? AC_BACK : \
|
(key == KC_WWW_BACK ? APPCONTROL_BACK : \
|
||||||
(key == KC_WWW_FORWARD ? AC_FORWARD : \
|
(key == KC_WWW_FORWARD ? APPCONTROL_FORWARD : \
|
||||||
(key == KC_WWW_STOP ? AC_STOP : \
|
(key == KC_WWW_STOP ? APPCONTROL_STOP : \
|
||||||
(key == KC_WWW_REFRESH ? AC_REFRESH : \
|
(key == KC_WWW_REFRESH ? APPCONTROL_REFRESH : \
|
||||||
(key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0)))))))))))))))))))))
|
(key == KC_WWW_FAVORITES ? APPCONTROL_BOOKMARKS : 0)))))))))))))))))))))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user