starting to think about mice

pull/18/head
Jesse Vincent 11 years ago
parent 292b390fbb
commit d0196b32b1

@ -21,13 +21,13 @@ typedef struct {
byte rawKey; byte rawKey;
} Key; } Key;
#define KEY_FLAGS B000000 #define KEY_FLAGS B0000000
#define CTRL_HELD B000001 #define CTRL_HELD B0000001
#define ALT_HELD B000010 #define ALT_HELD B0000010
#define SHIFT_HELD B000100 #define SHIFT_HELD B0000100
#define GUI_HELD B001000 #define GUI_HELD B0001000
#define SWITCH_TO_LAYER B010000 #define SWITCH_TO_LAYER B0010000
#define MOMENTARY_LAYER B100000 #define MOMENTARY B1000000
#define LAYER_0 0 #define LAYER_0 0
#define LAYER_1 1 #define LAYER_1 1
@ -328,7 +328,7 @@ typedef struct {
#define META_NEXT_KEYMAP_MOMENTARY 0xFF #define META_NEXT_KEYMAP_MOMENTARY 0xFF
#define Key_NextKeymapMomentary (Key){ KEY_FLAGS | MOMENTARY_LAYER, LAYER_1 } #define Key_NextKeymapMomentary (Key){ KEY_FLAGS | MOMENTARY, LAYER_1 }

@ -113,10 +113,16 @@ void scan_matrix() {
for (int col = 0; col < COLS; col++) { for (int col = 0; col < COLS; col++) {
//If we see an electrical connection on I->J, //If we see an electrical connection on I->J,
currentMatrix[row][col] = !digitalRead(colPins[col]); currentMatrix[row][col] = !digitalRead(colPins[col]);
// while we're inspecting the electrical matrix, we look to see if the key being held is a firmware level metakey, so we can act on it, lest we only discover that we should be looking at a seconary keymap halfway through the matrix scan // while we're inspecting the electrical matrix, we look
// to see if the key being held is a firmware level
// metakey, so we can act on it, lest we only discover
// that we should be looking at a seconary keymap halfway through the matrix scan
if (previousMatrix[row][col] != currentMatrix[row][col]) { if (previousMatrix[row][col] != currentMatrix[row][col]) {
if (keymaps[current_keymap][row][col].flags & MOMENTARY_LAYER ){
Key currentKey = keymaps[current_keymap][row][col];
if (currentKey.flags & MOMENTARY ){
if (currentMatrix[row][col]) { if (currentMatrix[row][col]) {
current_keymap++; current_keymap++;
} else { } else {

Loading…
Cancel
Save