commit
7541122cad
7 changed files with 391 additions and 223 deletions
57
Makefile
57
Makefile
|
@ -38,7 +38,7 @@ ERROR_FILE := $(BUILD_DIR)/error_occured
|
|||
|
||||
MAKEFILE_INCLUDED=yes
|
||||
|
||||
# Helper function to process the newt element of a space separated path
|
||||
# Helper function to process the newt element of a space separated path
|
||||
# It works a bit like the traditional functional head tail
|
||||
# so the CURRENT_PATH_ELEMENT will beome the new head
|
||||
# and the PATH_ELEMENTS are the rest that are still unprocessed
|
||||
|
@ -47,16 +47,16 @@ define NEXT_PATH_ELEMENT
|
|||
$$(eval PATH_ELEMENTS := $$(wordlist 2,9999,$$(PATH_ELEMENTS)))
|
||||
endef
|
||||
|
||||
# We change the / to spaces so that we more easily can work with the elements
|
||||
# We change the / to spaces so that we more easily can work with the elements
|
||||
# separately
|
||||
PATH_ELEMENTS := $(subst /, ,$(STARTING_DIR))
|
||||
# Initialize the path elements list for further processing
|
||||
$(eval $(call NEXT_PATH_ELEMENT))
|
||||
|
||||
# This function sets the KEYBOARD; KEYMAP and SUBPROJECT to the correct
|
||||
# This function sets the KEYBOARD; KEYMAP and SUBPROJECT to the correct
|
||||
# variables depending on which directory you stand in.
|
||||
# It's really a very simple if else chain, if you squint enough,
|
||||
# but the makefile syntax makes it very verbose.
|
||||
# It's really a very simple if else chain, if you squint enough,
|
||||
# but the makefile syntax makes it very verbose.
|
||||
# If we are in a subfolder of keyboards
|
||||
ifeq ($(CURRENT_PATH_ELEMENT),keyboards)
|
||||
$(eval $(call NEXT_PATH_ELEMENT))
|
||||
|
@ -111,7 +111,7 @@ endif
|
|||
.DEFAULT_GOAL := all
|
||||
ifneq ($(KEYMAP),)
|
||||
ifeq ($(SUBPROJECT),)
|
||||
# Inside a keymap folder, just build the keymap, with the
|
||||
# Inside a keymap folder, just build the keymap, with the
|
||||
# default subproject
|
||||
.DEFAULT_GOAL := $(KEYBOARD)-$(KEYMAP)
|
||||
else
|
||||
|
@ -163,7 +163,7 @@ define TRY_TO_MATCH_RULE_FROM_LIST_HELPER3
|
|||
ifneq ($1,)
|
||||
ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,$$(firstword $1)),true)
|
||||
MATCHED_ITEM := $$(firstword $1)
|
||||
else
|
||||
else
|
||||
$$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER3,$$(wordlist 2,9999,$1)))
|
||||
endif
|
||||
endif
|
||||
|
@ -171,10 +171,10 @@ endef
|
|||
|
||||
# A recursive helper function for finding the longest match
|
||||
# $1 The list to be checed
|
||||
# It works by always removing the currently matched item from the list
|
||||
# It works by always removing the currently matched item from the list
|
||||
# and call itself recursively, until a match is found
|
||||
define TRY_TO_MATCH_RULE_FROM_LIST_HELPER2
|
||||
# Stop the recursion when the list is empty
|
||||
# Stop the recursion when the list is empty
|
||||
ifneq ($1,)
|
||||
RULE_BEFORE := $$(RULE)
|
||||
$$(eval $$(call TRY_TO_MATCH_RULE_FROM_LIST_HELPER3,$1))
|
||||
|
@ -270,7 +270,7 @@ define PARSE_KEYBOARD
|
|||
$$(eval $$(call PARSE_SUBPROJECT,$$(SUBPROJECT)))
|
||||
# If there's no matching subproject, we assume it's the default
|
||||
# This will allow you to leave the subproject part of the target out
|
||||
else
|
||||
else
|
||||
$$(eval $$(call PARSE_SUBPROJECT,))
|
||||
endif
|
||||
endef
|
||||
|
@ -285,7 +285,7 @@ endef
|
|||
# When entering this, the keyboard and subproject are known, so now we need
|
||||
# to determine which keymaps are going to get compiled
|
||||
define PARSE_SUBPROJECT
|
||||
# If we want to compile the default subproject, then we need to
|
||||
# If we want to compile the default subproject, then we need to
|
||||
# include the correct makefile to determine the actual name of it
|
||||
CURRENT_SP := $1
|
||||
ifeq ($$(CURRENT_SP),)
|
||||
|
@ -304,7 +304,7 @@ define PARSE_SUBPROJECT
|
|||
endif
|
||||
endif
|
||||
# The special allsp is handled later
|
||||
ifneq ($$(CURRENT_SP),allsp)
|
||||
ifneq ($$(CURRENT_SP),allsp)
|
||||
# get a list of all keymaps
|
||||
KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/keymaps/*/.)))
|
||||
ifneq ($$(CURRENT_SP),)
|
||||
|
@ -343,7 +343,7 @@ define PARSE_SUBPROJECT
|
|||
endif
|
||||
endef
|
||||
|
||||
# If we want to parse all subprojects, but the keyboard doesn't have any,
|
||||
# If we want to parse all subprojects, but the keyboard doesn't have any,
|
||||
# then use defaultsp instead
|
||||
define PARSE_ALL_SUBPROJECTS
|
||||
ifeq ($$(SUBPROJECTS),)
|
||||
|
@ -448,7 +448,7 @@ endef
|
|||
|
||||
|
||||
# Set the silent mode depending on if we are trying to compile multiple keyboards or not
|
||||
# By default it's on in that case, but it can be overriden by specifying silent=false
|
||||
# By default it's on in that case, but it can be overriden by specifying silent=false
|
||||
# from the command line
|
||||
define SET_SILENT_MODE
|
||||
ifdef SUB_IS_SILENT
|
||||
|
@ -481,11 +481,12 @@ endef
|
|||
# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
|
||||
SUBPROJECTS := $(notdir $(patsubst %/Makefile,%,$(wildcard ./*/Makefile)))
|
||||
.PHONY: $(SUBPROJECTS)
|
||||
$(SUBPROJECTS): %: %-allkm
|
||||
$(SUBPROJECTS): %: %-allkm
|
||||
|
||||
# Let's match everything, we handle all the rule parsing ourselves
|
||||
.PHONY: %
|
||||
%:
|
||||
ifndef SKIP_GIT
|
||||
%:
|
||||
# Check if we have the CMP tool installed
|
||||
cmp --version >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
|
||||
# Check if the submodules are dirty, and display a warning if they are
|
||||
|
@ -505,8 +506,24 @@ $(SUBPROJECTS): %: %-allkm
|
|||
# But we return the error code at the end, to trigger travis failures
|
||||
$(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND))
|
||||
if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
|
||||
$(foreach TEST,$(TESTS),$(RUN_TEST))
|
||||
$(foreach TEST,$(TESTS),$(RUN_TEST))
|
||||
if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
|
||||
else
|
||||
%:
|
||||
# Check if we have the CMP tool installed
|
||||
cmp --version >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
|
||||
rm -f $(ERROR_FILE) > /dev/null 2>&1
|
||||
$(eval $(call PARSE_RULE,$@))
|
||||
$(eval $(call SET_SILENT_MODE))
|
||||
# Run all the commands in the same shell, notice the + at the first line
|
||||
# it has to be there to allow parallel execution of the submake
|
||||
# This always tries to compile everything, even if error occurs in the middle
|
||||
# But we return the error code at the end, to trigger travis failures
|
||||
$(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND))
|
||||
if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
|
||||
$(foreach TEST,$(TESTS),$(RUN_TEST))
|
||||
if [ -f $(ERROR_FILE) ]; then printf "$(MSG_ERRORS)" & exit 1; fi;
|
||||
endif
|
||||
|
||||
# All should compile everything
|
||||
.PHONY: all
|
||||
|
@ -526,7 +543,11 @@ test: test-all
|
|||
test-clean: test-all-clean
|
||||
|
||||
# Generate the version.h file
|
||||
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
|
||||
ifndef SKIP_GIT
|
||||
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
|
||||
else
|
||||
GIT_VERSION := NA
|
||||
endif
|
||||
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
|
||||
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h)
|
||||
$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h)
|
||||
|
|
|
@ -31,7 +31,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define BACKLIGHT_LEVELS 3
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCING_DELAY 0
|
||||
|
||||
#define MATRIX_MASKED
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# change to "no" to disable the options, or define them in the Makefile in
|
||||
# the appropriate keymap folder that will get included automatically
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
|
@ -18,4 +18,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -121,6 +121,7 @@ enum keyboard_macros {
|
|||
|
||||
#define M_CP_CT M(MACRO_COPY_CUT)
|
||||
|
||||
#define M_COPY KC_FN1
|
||||
|
||||
#define SC_UNDO LCTL(KC_Z)
|
||||
#define SC_REDO LCTL(KC_Y)
|
||||
|
@ -141,35 +142,46 @@ enum keyboard_macros {
|
|||
#define ________________ _______, _______
|
||||
#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX
|
||||
|
||||
const matrix_row_t matrix_mask[MATRIX_ROWS] =
|
||||
{
|
||||
// 1098765432109876543210987654321
|
||||
0b0000000001111111101111011111111,
|
||||
0b0000000001111111111111111111111,
|
||||
0b0000000001111111111111111111111,
|
||||
0b0000000001111111111111111111111,
|
||||
0b0000000001010111111111111111111,
|
||||
0b0000000001111101111111101011111,
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] =
|
||||
{
|
||||
/* LAYER = LAYER_QWERTY
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| FN | PRINT | SCR LK | PAUSE | | F1 | F2 | F3 | F4 | XXXXXX | F5 | F6 | F7 | F8 | XXXXXX | F9 | F10 | F11 | F12 | | VOL DN | MUTE | VOL UP | BACKLT |
|
||||
| VOL DN | MUTE | VOL UP | BACKLT | | F1 | F2 | F3 | F4 | XXXXXX | F5 | F6 | F7 | F8 | XXXXXX | F9 | F10 | F11 | F12 | | PRINT | SCR LK | PAUSE | FN |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| M1 | INS | HOME | PG UP | | ESC | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | = | BACKSP | | NUM LK | KP / | KP * | KP - |
|
||||
| NUM LK | KP / | KP * | KP - | | ESC | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | = | BACKSP | | INS | HOME | PG UP | M1 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------|--------|--------+--------|
|
||||
| M2 | DEL | END | PG DN | | TAB | TAB | Q | W | E | R | T | Y | U | I | O | P | - | \ | | KP 7 | KP 8 | KP 9 | KP + |
|
||||
| KP 7 | KP 8 | KP 9 | KP + | | TAB | TAB | Q | W | E | R | T | Y | U | I | O | P | - | \ | | DEL | END | PG DN | M2 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| o |--------|--------|--------+--------|
|
||||
| M3 | UL | UP | UR | | CAP LK | BACKSP | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | o | KP 4 | KP 5 | KP 6 | KP + |
|
||||
| KP 4 | KP 5 | KP 6 | KP + | | CAP LK | BACKSP | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | o | CP/CT | UNDO | PASTE | M3 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| o |--------|--------|--------+--------|
|
||||
| M4 | LEFT | CP/CT | RIGHT | | LSHIFT | LSHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | RSHIFT | | KP 1 | KP 2 | KP 3 | KP Ent |
|
||||
| KP 1 | KP 2 | KP 3 | KP Ent | | LSHIFT | LSHIFT | Z | X | C | V | B | N | M | , | . | / | RSHIFT | RSHIFT | | XXXXXX | UP | XXXXXX | M4 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------|--------|--------+--------|
|
||||
| M5 | DL | DOWN | DR | | LCTRL | XXXXXX | XXXXXX | LWIN | LALT | LOWER | SPACE . SPACE | UPPER | OSHIFT | RALT | APP | XXXXXX | RCTRL | | KP 0 | KP , | KP . | KP Ent |
|
||||
| KP 0 | KP , | KP . | KP Ent | | LCTRL | XXXXXX | LWIN | XXXXXX | LALT | UPPER | SPACE . SPACE | LOWER | OSHIFT | RALT | APP | XXXXXX | RCTRL | | LEFT | DOWN | RIGHT | M5 |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
*/
|
||||
KEYMAP(LAYER_QWERTY, \
|
||||
M_HELP , KC_PSCR, KC_SLCK, KC_PAUS, KC_F1 , KC_F2 , KC_F3 , KC_F4 , XXXXXXX, KC_F5 , KC_F6 , KC_F7 , KC_F8 , XXXXXXX, KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_VOLD, KC_MUTE, KC_VOLU, M_BACKL, \
|
||||
M_M1 , KC_INS , KC_HOME, KC_PGUP, KC_ESC , KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_EQL , KC_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
|
||||
M_M2 , KC_DEL , KC_END , KC_PGDN, KC_TAB , KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS, KC_BSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_PPLS, \
|
||||
M_M3 , M_UL , KC_UP , M_UR , KC_CAPS, KC_BSPC, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT , KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, \
|
||||
M_M4 , KC_LEFT, M_CP_CT, KC_RGHT, KC_LSFT, KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, KC_RSFT, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, \
|
||||
M_M5 , M_DL , KC_DOWN, M_DR , KC_LCTL, XXXXXXX, XXXXXXX, KC_LGUI, KC_LALT, M_LOWER, KC_SPC , KC_SPC , M_UPPER, OS_SHFT, KC_RALT, KC_APP , XXXXXXX, KC_RCTL, KC_KP_0, KC_PCMM, KC_PDOT, KC_PENT \
|
||||
KC_VOLD, KC_MUTE, KC_VOLU, M_BACKL, KC_F1 , KC_F2 , KC_F3 , KC_F4 , XXXXXXX, KC_F5 , KC_F6 , KC_F7 , KC_F8 , XXXXXXX, KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_PSCR, KC_SLCK, KC_PAUS, M_HELP , \
|
||||
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_ESC , KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_EQL , KC_BSPC, KC_INS , KC_HOME, KC_PGUP, M_M1 , \
|
||||
KC_KP_7, KC_KP_8, KC_KP_9, KC_PPLS, KC_TAB , KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS, KC_BSLS, KC_DEL , KC_END , KC_PGDN, M_M2 , \
|
||||
KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, KC_CAPS, KC_BSPC, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT , M_CP_CT, SC_UNDO, SC_PSTE, M_M3 , \
|
||||
KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, KC_LSFT, KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, KC_RSFT, XXXXXXX, KC_UP , XXXXXXX, M_M4 , \
|
||||
KC_KP_0, KC_PCMM, KC_PDOT, KC_PENT, KC_LCTL, XXXXXXX, KC_LGUI, XXXXXXX, KC_LALT, M_UPPER, KC_SPC , KC_SPC , M_LOWER, OS_SHFT, KC_RALT, KC_APP , XXXXXXX, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, M_M5 \
|
||||
),
|
||||
/* LAYER = LAYER_LOWER
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| ______ | ______ | ______ | ______ | | F13 | F14 | F15 | F16 | XXXXXX | F17 | F18 | F19 | F20 | XXXXXX | F21 | F22 | F23 | F24 | | ______ | MUTE A | ______ | ______ |
|
||||
| ______ | MUTE A | ______ | ______ | | F13 | F14 | F15 | F16 | XXXXXX | F17 | F18 | F19 | F20 | XXXXXX | F21 | F22 | F23 | F24 | | ______ | ______ | ______ | ______ |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
|
@ -180,20 +192,20 @@ KEYMAP(LAYER_QWERTY, \
|
|||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| o |--------|--------|--------+--------|
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | | | & | ! | ~ | ; | : | = | < | > | ? | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------|--------|--------+--------|
|
||||
| ______ | ______ | ______ | ______ | | ______ | XXXXXX | XXXXXX | ______ | ______ | ______ | ______ . ______ | LOWER | ______ | ______ | ______ | XXXXXX | ______ | | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ . ______ | LOWER | ______ | ______ | ______ | XXXXXX | ______ | | ______ | ______ | ______ | ______ |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
*/
|
||||
KEYMAP(LAYER_LOWER, \
|
||||
_______, _______, _______, _______, KC_F13 , KC_F14 , KC_F15 , KC_F16 , XXXXXXX, KC_F17 , KC_F18 , KC_F19 , KC_F20 , XXXXXXX, KC_F21 , KC_F22 , KC_F23 , KC_F24 , _______, M_MUTEA, _______, _______, \
|
||||
_______, M_MUTEA, _______, _______, KC_F13 , KC_F14 , KC_F15 , KC_F16 , XXXXXXX, KC_F17 , KC_F18 , KC_F19 , KC_F20 , XXXXXXX, KC_F21 , KC_F22 , KC_F23 , KC_F24 , _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, KC_DLR , KC_LCBR, KC_LBRC, KC_LPRN, KC_PERC, KC_HASH, KC_RPRN, KC_RBRC, KC_RCBR, KC_AT , _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, KC_CIRC, KC_ASTR, KC_PLUS, KC_MINS, KC_SLSH, KC_BSLS, KC_UNDS, KC_QUOT, KC_DQT , KC_GRV , _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, KC_PIPE, KC_AMPR, KC_EXLM, KC_TILD, KC_SCLN, KC_COLN, KC_EQL , KC_LT , KC_GT , KC_QUES, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______, M_LOWER, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______ \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, M_LOWER, _______, _______, _______, XXXXXXX, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
/* LAYER = LAYER_UPPER
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| ______ | ______ | ______ | ______ | | F13 | F14 | F15 | F16 | XXXXXX | F17 | F18 | F19 | F20 | XXXXXX | F21 | F22 | F23 | F24 | | ______ | MUTE A | ______ | ______ |
|
||||
| ______ | MUTE A | ______ | ______ | | F13 | F14 | F15 | F16 | XXXXXX | F17 | F18 | F19 | F20 | XXXXXX | F21 | F22 | F23 | F24 | | ______ | ______ | ______ | ______ |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
|
@ -204,44 +216,44 @@ KEYMAP(LAYER_LOWER, \
|
|||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| o |--------|--------|--------+--------|
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | F9 | F10 | F11 | F12 | SCR LK | KP 0 | KP 1 | KP 2 | KP 3 | KP Ent | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------|--------|--------+--------|
|
||||
| ______ | ______ | ______ | ______ | | ______ | XXXXXX | XXXXXX | ______ | ______ | UPPER | KP 0 . KP 0 | ______ | RALT | KP . | KP Ent | XXXXXX | ______ | | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | UPPER | KP 0 . KP 0 | ______ | RALT | KP . | KP Ent | XXXXXX | ______ | | ______ | ______ | ______ | ______ |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
*/
|
||||
KEYMAP(LAYER_UPPER, \
|
||||
_______, _______, _______, _______, KC_F13 , KC_F14 , KC_F15 , KC_F16 , XXXXXXX, KC_F17 , KC_F18 , KC_F19 , KC_F20 , XXXXXXX, KC_F21 , KC_F22 , KC_F23 , KC_F24 , _______, M_MUTEA, _______, _______, \
|
||||
_______, M_MUTEA, _______, _______, KC_F13 , KC_F14 , KC_F15 , KC_F16 , XXXXXXX, KC_F17 , KC_F18 , KC_F19 , KC_F20 , XXXXXXX, KC_F21 , KC_F22 , KC_F23 , KC_F24 , _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_NLCK, KC_PSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_CAPS, KC_PAST, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_SLCK, KC_KP_0, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, M_UPPER, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, XXXXXXX, _______, _______, _______, _______, _______ \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, M_UPPER, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, XXXXXXX, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
/* LAYER = LAYER_MOUSE
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| MS BT1 | MS AC0 | MS WHU | MS AC2 | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | MS AC0 | MS WHU | MS AC2 | MS BT1 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------|--------|--------+--------|
|
||||
| MS BT2 | MS WHL | MS WHD | MS WHU | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | MS WHL | MS WHD | MS WHU | MS BT2 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| o |--------|--------|--------+--------|
|
||||
| MS BT3 | MS UL | MS U | MS UR | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | o | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | o | MS BT1 | MS BT2 | MS BT3 | MS BT3 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| o |--------|--------|--------+--------|
|
||||
| MS BT4 | MS L | MS BT1 | MS R | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | ______ | | XXXXXX | MS U | XXXXXX | MS BT4 |
|
||||
|--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------|--------|--------+--------|
|
||||
| MS BT5 | MS DL | MS D | MS DR | | ______ | ______ | ______ | ______ | ______ | ______ | ______ . ______ | ______ | ______ | ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ |
|
||||
| ______ | ______ | ______ | ______ | | ______ | ______ | ______ | ______ | ______ | ______ | ______ . ______ | ______ | ______ | ______ | ______ | ______ | ______ | | MS L | MS D | MS R | MS BT5 |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
*/
|
||||
KEYMAP(LAYER_MOUSE, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
KC_BTN1, KC_ACL0, KC_WH_U, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
KC_BTN2, KC_WH_L, KC_WH_D, KC_WH_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
KC_BTN3, M_MS_UL, KC_MS_U, M_MS_UR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
KC_BTN4, KC_MS_L, KC_BTN1, KC_MS_R, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
KC_BTN5, M_MS_DL, KC_MS_D, M_MS_DR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_ACL0, KC_WH_U, KC_ACL2, KC_BTN1, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_U, KC_BTN2, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN1, KC_BTN2, KC_BTN3, KC_BTN3, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_MS_U, XXXXXXX, KC_BTN4, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN5 \
|
||||
),
|
||||
/* LAYER = LAYER_ADJUST
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| XXXXXX | XXXXXX | XXXXXX | XXXXXX | | HELP 1 | HELP 2 | HELP 3 | HELP 4 | XXXXXX | HELP 5 | HELP 6 | HELP 7 | HELP 8 | XXXXXX | HELP 9 | HELP 0 | XXXXXX | XXXXXX | | VOICE- | AUDIO | VOICE+ | MUSIC |
|
||||
| VOICE- | AUDIO | VOICE+ | MUSIC | | HELP 1 | HELP 2 | HELP 3 | HELP 4 | XXXXXX | HELP 5 | HELP 6 | HELP 7 | HELP 8 | XXXXXX | HELP 9 | HELP 0 | XXXXXX | XXXXXX | | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
|
||||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
.-----------------------------------. .-----------------------------------------------------------------------------------------------------------------------------. .-----------------------------------.
|
||||
| XXXXXX | XXXXXX | XXXXXX | XXXXXX | | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
|
||||
|
@ -256,14 +268,13 @@ KEYMAP(LAYER_MOUSE, \
|
|||
'-----------------------------------' '-----------------------------------------------------------------------------------------------------------------------------' '-----------------------------------'
|
||||
*/
|
||||
KEYMAP(LAYER_ADJUST, \
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_HELP1, M_HELP2, M_HELP3, M_HELP4, XXXXXXX, M_HELP5, M_HELP6, M_HELP7, M_HELP8, XXXXXXX, M_HELP9, M_HELP0, XXXXXXX, XXXXXXX, MUV_DE , AU_TOG , MUV_IN , MU_TOG , \
|
||||
MUV_DE , AU_TOG , MUV_IN , MU_TOG , M_HELP1, M_HELP2, M_HELP3, M_HELP4, XXXXXXX, M_HELP5, M_HELP6, M_HELP7, M_HELP8, XXXXXXX, M_HELP9, M_HELP0, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , XXXXXXX, M_MOUSE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_UPPER, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
|
||||
),
|
||||
|
||||
};
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
@ -296,6 +307,7 @@ void persistant_default_layer_set(uint16_t default_layer)
|
|||
|
||||
const uint16_t PROGMEM fn_actions[] = {
|
||||
[0] = ACTION_MODS_ONESHOT(MOD_LSFT),
|
||||
[1] = ACTION_MACRO_TAP(MACRO_COPY_CUT),
|
||||
};
|
||||
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
|
@ -305,68 +317,84 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|||
switch(id)
|
||||
{
|
||||
|
||||
case MACRO_HELP_1:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H1");
|
||||
}
|
||||
break;
|
||||
case MACRO_COPY_CUT:
|
||||
if (record->event.pressed) {
|
||||
register_code(KC_LCTL);
|
||||
if (record->tap.count == 1) {
|
||||
register_code(KC_C);
|
||||
unregister_code(KC_C);
|
||||
}
|
||||
else if (record->tap.count == 2) {
|
||||
register_code(KC_X);
|
||||
unregister_code(KC_X);
|
||||
}
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
break;
|
||||
|
||||
case MACRO_HELP_2:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H2");
|
||||
}
|
||||
break;
|
||||
|
||||
case MACRO_HELP_3:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H3");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_1:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H1");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_HELP_4:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H4");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_2:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H2");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_HELP_5:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H5");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_3:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H3");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_HELP_6:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H6");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_4:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H4");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_HELP_7:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H7");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_5:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H5");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_HELP_8:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H8");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_6:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H6");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_HELP_9:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
uprint("H9");
|
||||
}
|
||||
break;
|
||||
// case MACRO_HELP_7:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H7");
|
||||
// }
|
||||
// break;
|
||||
|
||||
// case MACRO_HELP_8:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H8");
|
||||
// }
|
||||
// break;
|
||||
|
||||
// case MACRO_HELP_9:
|
||||
// if (record->event.pressed)
|
||||
// {
|
||||
// uprint("H9");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case MACRO_BREATH_TOGGLE:
|
||||
if (record->event.pressed)
|
||||
|
@ -566,12 +594,12 @@ void led_set_user(uint8_t usb_led)
|
|||
void startup_user()
|
||||
{
|
||||
_delay_ms(10); // gets rid of tick
|
||||
PLAY_NOTE_ARRAY(tone_my_startup, false, STACCATO);
|
||||
// PLAY_NOTE_ARRAY(tone_my_startup, false, STACCATO);
|
||||
}
|
||||
|
||||
void shutdown_user()
|
||||
{
|
||||
PLAY_NOTE_ARRAY(tone_my_goodbye, false, STACCATO);
|
||||
// PLAY_NOTE_ARRAY(tone_my_goodbye, false, STACCATO);
|
||||
_delay_ms(2000);
|
||||
stop_all_notes();
|
||||
}
|
||||
|
|
336
quantum/matrix.c
336
quantum/matrix.c
|
@ -25,37 +25,65 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
|
||||
#ifndef DEBOUNCING_DELAY
|
||||
# define DEBOUNCING_DELAY 5
|
||||
#endif
|
||||
static uint8_t debouncing = DEBOUNCING_DELAY;
|
||||
|
||||
#if (DEBOUNCING_DELAY > 0)
|
||||
static uint16_t debouncing_time;
|
||||
static bool debouncing = false;
|
||||
#endif
|
||||
|
||||
#if (MATRIX_COLS <= 8)
|
||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop(matrix[i])
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#elif (MATRIX_COLS <= 16)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop16(matrix[i])
|
||||
# define ROW_SHIFTER ((uint16_t)1)
|
||||
#elif (MATRIX_COLS <= 32)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop32(matrix[i])
|
||||
# define ROW_SHIFTER ((uint32_t)1)
|
||||
#endif
|
||||
|
||||
#ifdef MATRIX_MASKED
|
||||
extern const matrix_row_t matrix_mask[];
|
||||
#endif
|
||||
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
|
||||
static matrix_row_t matrix_raw[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
#if DIODE_DIRECTION == ROW2COL
|
||||
static matrix_row_t matrix_reversed[MATRIX_COLS];
|
||||
static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS];
|
||||
#endif
|
||||
|
||||
#if MATRIX_COLS > 16
|
||||
#define SHIFTER 1UL
|
||||
#else
|
||||
#define SHIFTER 1
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
static void init_cols(void);
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
static void unselect_row(uint8_t row);
|
||||
#else // ROW2COL
|
||||
static void init_rows(void);
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
|
||||
static void unselect_cols(void);
|
||||
static void unselect_col(uint8_t col);
|
||||
static void select_col(uint8_t col);
|
||||
#endif
|
||||
|
||||
static matrix_row_t read_cols(void);
|
||||
static void init_cols(void);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_quantum(void) {
|
||||
matrix_init_kb();
|
||||
|
@ -95,7 +123,7 @@ uint8_t matrix_cols(void) {
|
|||
}
|
||||
|
||||
// void matrix_power_up(void) {
|
||||
// #if DIODE_DIRECTION == COL2ROW
|
||||
// #if (DIODE_DIRECTION == COL2ROW)
|
||||
// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
||||
// /* DDRxn */
|
||||
// _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF);
|
||||
|
@ -119,19 +147,26 @@ uint8_t matrix_cols(void) {
|
|||
// }
|
||||
|
||||
void matrix_init(void) {
|
||||
|
||||
// To use PORTF disable JTAG with writing JTD bit twice within four cycles.
|
||||
#ifdef __AVR_ATmega32U4__
|
||||
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__))
|
||||
MCUCR |= _BV(JTD);
|
||||
MCUCR |= _BV(JTD);
|
||||
#endif
|
||||
|
||||
// initialize row and col
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
unselect_rows();
|
||||
init_cols();
|
||||
#else // ROW2COL
|
||||
unselect_cols();
|
||||
init_rows();
|
||||
#endif
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = 0;
|
||||
matrix_raw[i] = 0;
|
||||
matrix_debouncing[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -141,71 +176,60 @@ void matrix_init(void) {
|
|||
uint8_t matrix_scan(void)
|
||||
{
|
||||
|
||||
#if DIODE_DIRECTION == COL2ROW
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
select_row(i);
|
||||
wait_us(30); // without this wait read unstable value.
|
||||
matrix_row_t cols = read_cols();
|
||||
if (matrix_debouncing[i] != cols) {
|
||||
matrix_debouncing[i] = cols;
|
||||
if (debouncing) {
|
||||
debug("bounce!: "); debug_hex(debouncing); debug("\n");
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
// Set row, read cols
|
||||
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row);
|
||||
|
||||
if (matrix_changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
debouncing = DEBOUNCING_DELAY;
|
||||
}
|
||||
unselect_rows();
|
||||
|
||||
# else
|
||||
read_cols_on_row(matrix, current_row);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
wait_ms(1);
|
||||
} else {
|
||||
#else // ROW2COL
|
||||
|
||||
// Set col, read rows
|
||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
bool matrix_changed = read_rows_on_col(matrix_debouncing, current_col);
|
||||
if (matrix_changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
# else
|
||||
read_rows_on_col(matrix, current_col);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
debouncing = false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (uint8_t i = 0; i < MATRIX_COLS; i++) {
|
||||
select_row(i);
|
||||
wait_us(30); // without this wait read unstable value.
|
||||
matrix_row_t rows = read_cols();
|
||||
if (matrix_reversed_debouncing[i] != rows) {
|
||||
matrix_reversed_debouncing[i] = rows;
|
||||
if (debouncing) {
|
||||
debug("bounce!: "); debug_hex(debouncing); debug("\n");
|
||||
}
|
||||
debouncing = DEBOUNCING_DELAY;
|
||||
}
|
||||
unselect_rows();
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
wait_ms(1);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < MATRIX_COLS; i++) {
|
||||
matrix_reversed[i] = matrix_reversed_debouncing[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint8_t y = 0; y < MATRIX_ROWS; y++) {
|
||||
matrix_row_t row = 0;
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
row |= ((matrix_reversed[x] & (1<<y)) >> y) << x;
|
||||
}
|
||||
matrix[y] = row;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool matrix_is_modified(void)
|
||||
{
|
||||
#if (DEBOUNCING_DELAY > 0)
|
||||
if (debouncing) return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -218,15 +242,22 @@ bool matrix_is_on(uint8_t row, uint8_t col)
|
|||
inline
|
||||
matrix_row_t matrix_get_row(uint8_t row)
|
||||
{
|
||||
// Matrix mask lets you disable switches in the returned matrix data. For example, if you have a
|
||||
// switch blocker installed and the switch is always pressed.
|
||||
#ifdef MATRIX_MASKED
|
||||
return matrix[row] & matrix_mask[row];
|
||||
#else
|
||||
return matrix[row];
|
||||
#endif
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print("\nr/c 0123456789ABCDEF\n");
|
||||
print_matrix_header();
|
||||
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
phex(row); print(": ");
|
||||
pbin_reverse16(matrix_get_row(row));
|
||||
print_matrix_row(row);
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
@ -235,63 +266,148 @@ uint8_t matrix_key_count(void)
|
|||
{
|
||||
uint8_t count = 0;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
count += bitpop16(matrix[i]);
|
||||
count += matrix_bitpop(i);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
static void init_cols(void)
|
||||
{
|
||||
#if DIODE_DIRECTION == COL2ROW
|
||||
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||
int pin = col_pins[x];
|
||||
#else
|
||||
for(int x = 0; x < MATRIX_ROWS; x++) {
|
||||
int pin = row_pins[x];
|
||||
#endif
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF);
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
uint8_t pin = col_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
static matrix_row_t read_cols(void)
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
{
|
||||
matrix_row_t result = 0;
|
||||
// Store last value of row prior to reading
|
||||
matrix_row_t last_row_value = current_matrix[current_row];
|
||||
|
||||
#if DIODE_DIRECTION == COL2ROW
|
||||
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||
int pin = col_pins[x];
|
||||
#else
|
||||
for(int x = 0; x < MATRIX_ROWS; x++) {
|
||||
int pin = row_pins[x];
|
||||
#endif
|
||||
result |= (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)) ? 0 : (SHIFTER << x);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Clear data in matrix row
|
||||
current_matrix[current_row] = 0;
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
#if DIODE_DIRECTION == COL2ROW
|
||||
for(int x = 0; x < MATRIX_ROWS; x++) {
|
||||
int pin = row_pins[x];
|
||||
#else
|
||||
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||
int pin = col_pins[x];
|
||||
#endif
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF);
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
|
||||
// Select row and wait for row selecton to stabilize
|
||||
select_row(current_row);
|
||||
wait_us(30);
|
||||
|
||||
// For each col...
|
||||
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin = col_pins[col_index];
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
}
|
||||
|
||||
// Unselect row
|
||||
unselect_row(current_row);
|
||||
|
||||
return (last_row_value == current_matrix[current_row]);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
|
||||
#if DIODE_DIRECTION == COL2ROW
|
||||
int pin = row_pins[row];
|
||||
#else
|
||||
int pin = col_pins[row];
|
||||
#endif
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF);
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF);
|
||||
uint8_t pin = row_pins[row];
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row)
|
||||
{
|
||||
uint8_t pin = row_pins[row];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
uint8_t pin = row_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
#else // ROW2COL
|
||||
|
||||
static void init_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
uint8_t pin = row_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
{
|
||||
bool matrix_changed = false;
|
||||
|
||||
// Select col and wait for col selecton to stabilize
|
||||
select_col(current_col);
|
||||
wait_us(30);
|
||||
|
||||
// For each row...
|
||||
for(uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++)
|
||||
{
|
||||
|
||||
// Store last value of row prior to reading
|
||||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
|
||||
{
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pin HI, clear col bit
|
||||
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
|
||||
}
|
||||
|
||||
// Determine if the matrix changed state
|
||||
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
|
||||
{
|
||||
matrix_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Unselect col
|
||||
unselect_col(current_col);
|
||||
|
||||
return matrix_changed;
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col)
|
||||
{
|
||||
uint8_t pin = col_pins[col];
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col)
|
||||
{
|
||||
uint8_t pin = col_pins[col];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
|
||||
static void unselect_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
uint8_t pin = col_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -241,6 +241,7 @@ You can also add extra options at the end of the make command line, after the ta
|
|||
* `make COLOR=false` - turns off color output
|
||||
* `make SILENT=true` - turns off output besides errors/warnings
|
||||
* `make VERBOSE=true` - outputs all of the gcc stuff (not interesting, unless you need to debug)
|
||||
* `make EXTRAFLAGS=-E` - Preprocess the code without doing any compiling (useful if you are trying to debug #define commands)
|
||||
|
||||
The make command itself also has some additional options, type `make --help` for more information. The most useful is probably `-jx`, which specifies that you want to compile using more than one CPU, the `x` represents the number of CPUs that you want to use. Setting that can greatly reduce the compile times, especially if you are compiling many keyboards/keymaps. I usually set it to one less than the number of CPUs that I have, so that I have some left for doing other things while it's compiling. Note that not all operating systems and make versions supports that option.
|
||||
|
||||
|
|
|
@ -379,11 +379,11 @@ static bool command_common(uint8_t code)
|
|||
debug_enable = !debug_enable;
|
||||
if (debug_enable) {
|
||||
print("\ndebug: on\n");
|
||||
debug_matrix = true;
|
||||
debug_keyboard = true;
|
||||
debug_mouse = true;
|
||||
} else {
|
||||
print("\ndebug: off\n");
|
||||
debug_matrix = false;
|
||||
debug_keyboard = false;
|
||||
debug_mouse = false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue