Skip to content

Commit

Permalink
Add focus hook for writing a single key at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnvc committed Oct 25, 2017
1 parent c8c5cc0 commit 5065230
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Kaleidoscope/EEPROM-Keymap-Focus.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@

#define FOCUS_HOOK_KEYMAP_TRANSFER FOCUS_HOOK(EEPROMKeymap.focusKeymapTransfer, \
"keymap.transfer")

#define FOCUS_HOOK_KEYMAP_INCREMENTAL FOCUS_HOOK(EEPROMKeymap.focusKeymapIncremental, \
"keymap.map.key")
15 changes: 15 additions & 0 deletions src/Kaleidoscope/EEPROM-Keymap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ bool EEPROMKeymap::focusKeymap(const char *command) {
return true;
}

bool EEPROMKeymap::focusKeymapIncremental(const char *command) {
if (strcmp_P(command, PSTR("keymap.map.key")) != 0)
return false;


uint8_t layer = Serial.parseInt();
uint8_t index = Serial.parseInt();
Key newKey = parseKey();
uint16_t loc = keymap_base_ + (((layer * ROWS * COLS) + index) * 2);
EEPROM.update(loc, key.flags);
EEPROM.update(loc + 1, key.keyCode);

return true;
}

bool EEPROMKeymap::focusKeymapTransfer(const char *command) {
if (strcmp_P(command, PSTR("keymap.transfer")) != 0)
return false;
Expand Down

0 comments on commit 5065230

Please sign in to comment.