Add method to allow upload of keymap for individual layer

pull/365/head
James N. V. Cash 7 years ago
parent c8c5cc0b02
commit 0f00b4a9a9

@ -23,5 +23,8 @@
#define FOCUS_HOOK_KEYMAP FOCUS_HOOK(EEPROMKeymap.focusKeymap, "keymap.map") #define FOCUS_HOOK_KEYMAP FOCUS_HOOK(EEPROMKeymap.focusKeymap, "keymap.map")
#define FOCUS_HOOK_KEYMAP_LAYER FOCUS_HOOK(EEPROMKeymap.focusKeymapLayer, \
"keymap.layer")
#define FOCUS_HOOK_KEYMAP_TRANSFER FOCUS_HOOK(EEPROMKeymap.focusKeymapTransfer, \ #define FOCUS_HOOK_KEYMAP_TRANSFER FOCUS_HOOK(EEPROMKeymap.focusKeymapTransfer, \
"keymap.transfer") "keymap.transfer")

@ -107,6 +107,22 @@ bool EEPROMKeymap::focusKeymap(const char *command) {
return true; return true;
} }
bool EEPROMKeymap::focusKeymapLayer(const char *command) {
if (strcmp_P(command, PSTR("keymap.layer")) != 0) {
return false;
}
uint8_t layer = Serial.parseInt();
uint16_t keysPerLayer = ROWS * COLS;
uint16_t offset = layer * keysPerLayer;
for (uint16_t k = 0; (k < keysPerLayer) && (Serial.peek() != '\n'); k++) {
updateKey(layer + k, parseKey());
}
return true;
}
bool EEPROMKeymap::focusKeymapTransfer(const char *command) { bool EEPROMKeymap::focusKeymapTransfer(const char *command) {
if (strcmp_P(command, PSTR("keymap.transfer")) != 0) if (strcmp_P(command, PSTR("keymap.transfer")) != 0)
return false; return false;

@ -36,6 +36,7 @@ class EEPROMKeymap : public KaleidoscopePlugin {
static Key getKeyOverride(uint8_t layer, byte row, byte col); static Key getKeyOverride(uint8_t layer, byte row, byte col);
static bool focusKeymap(const char *command); static bool focusKeymap(const char *command);
static bool focusKeymapLayer(const char *command);
static bool focusKeymapTransfer(const char *command); static bool focusKeymapTransfer(const char *command);
static void updateKey(uint16_t base_pos, Key key); static void updateKey(uint16_t base_pos, Key key);

Loading…
Cancel
Save