Add a `getKeyOverride` method

This method uses the EEPROM only to augment the PROGMEM keymap: if EEPROM is
transparent, then PROGMEM is used. As such, the keymap in EEPROM is only an
overlay in this case.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago
parent 0f3dddae98
commit 379a2d483b

@ -54,9 +54,9 @@ void setup () {
Focus.addHook (FOCUS_HOOK_HELP);
Focus.addHook (FOCUS_HOOK_VERSION);
Layer.getKey = EEPROMKeymap.getKey;
Layer.getKey = EEPROMKeymap.getKeyOverride;
EEPROMKeymap.reserveSpace (2);
EEPROMKeymap.reserveSpace (1);
EEPROMSettings.seal ();
}

@ -53,6 +53,16 @@ namespace KaleidoscopePlugins {
return key;
}
Key
EEPROMKeymap::getKeyOverride (uint8_t layer, byte row, byte col) {
Key key;
key = getKey (layer, row, col);
if (key == Key_Transparent)
key = Layer.getKeyFromPROGMEM (layer, row, col);
return key;
}
uint16_t
EEPROMKeymap::base (void) {
return keymapBase;

@ -32,6 +32,7 @@ namespace KaleidoscopePlugins {
static uint16_t base (void);
static Key getKey (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 focusKeymapTransfer (const char *command);

Loading…
Cancel
Save