|
|
@ -21,25 +21,25 @@
|
|
|
|
#include <Kaleidoscope-Focus.h>
|
|
|
|
#include <Kaleidoscope-Focus.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
namespace KaleidoscopePlugins {
|
|
|
|
uint16_t EEPROMKeymap::keymapBase;
|
|
|
|
uint16_t EEPROMKeymap::keymapBase;
|
|
|
|
uint8_t EEPROMKeymap::maxLayers;
|
|
|
|
uint8_t EEPROMKeymap::maxLayers;
|
|
|
|
|
|
|
|
|
|
|
|
EEPROMKeymap::EEPROMKeymap (void) {
|
|
|
|
EEPROMKeymap::EEPROMKeymap (void) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
EEPROMKeymap::begin (void) {
|
|
|
|
EEPROMKeymap::begin (void) {
|
|
|
|
USE_PLUGINS (&::EEPROMSettings);
|
|
|
|
USE_PLUGINS (&::EEPROMSettings);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
EEPROMKeymap::reserveSpace (uint8_t layers) {
|
|
|
|
EEPROMKeymap::reserveSpace (uint8_t layers) {
|
|
|
|
maxLayers = layers;
|
|
|
|
maxLayers = layers;
|
|
|
|
keymapBase = ::EEPROMSettings.requestSlice (maxLayers * ROWS * COLS * 2);
|
|
|
|
keymapBase = ::EEPROMSettings.requestSlice (maxLayers * ROWS * COLS * 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
EEPROMKeymap::getKey (uint8_t layer, byte row, byte col) {
|
|
|
|
EEPROMKeymap::getKey (uint8_t layer, byte row, byte col) {
|
|
|
|
Key key;
|
|
|
|
Key key;
|
|
|
|
|
|
|
|
|
|
|
|
if (layer >= maxLayers)
|
|
|
|
if (layer >= maxLayers)
|
|
|
@ -51,45 +51,45 @@ namespace KaleidoscopePlugins {
|
|
|
|
key.keyCode = EEPROM.read (keymapBase + pos + 1);
|
|
|
|
key.keyCode = EEPROM.read (keymapBase + pos + 1);
|
|
|
|
|
|
|
|
|
|
|
|
return key;
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
EEPROMKeymap::getKeyOverride (uint8_t layer, byte row, byte col) {
|
|
|
|
EEPROMKeymap::getKeyOverride (uint8_t layer, byte row, byte col) {
|
|
|
|
Key key;
|
|
|
|
Key key;
|
|
|
|
|
|
|
|
|
|
|
|
key = getKey (layer, row, col);
|
|
|
|
key = getKey (layer, row, col);
|
|
|
|
if (key == Key_Transparent)
|
|
|
|
if (key == Key_Transparent)
|
|
|
|
key = Layer.getKeyFromPROGMEM (layer, row, col);
|
|
|
|
key = Layer.getKeyFromPROGMEM (layer, row, col);
|
|
|
|
return key;
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
uint16_t
|
|
|
|
EEPROMKeymap::base (void) {
|
|
|
|
EEPROMKeymap::base (void) {
|
|
|
|
return keymapBase;
|
|
|
|
return keymapBase;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
EEPROMKeymap::updateKey (uint16_t basePos, Key key) {
|
|
|
|
EEPROMKeymap::updateKey (uint16_t basePos, Key key) {
|
|
|
|
EEPROM.update (keymapBase + basePos * 2, key.flags);
|
|
|
|
EEPROM.update (keymapBase + basePos * 2, key.flags);
|
|
|
|
EEPROM.update (keymapBase + basePos * 2 + 1, key.keyCode);
|
|
|
|
EEPROM.update (keymapBase + basePos * 2 + 1, key.keyCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Key
|
|
|
|
Key
|
|
|
|
EEPROMKeymap::parseKey (void) {
|
|
|
|
EEPROMKeymap::parseKey (void) {
|
|
|
|
Key key;
|
|
|
|
Key key;
|
|
|
|
|
|
|
|
|
|
|
|
key.raw = Serial.parseInt ();
|
|
|
|
key.raw = Serial.parseInt ();
|
|
|
|
|
|
|
|
|
|
|
|
return key;
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
EEPROMKeymap::printKey (Key k) {
|
|
|
|
EEPROMKeymap::printKey (Key k) {
|
|
|
|
::Focus.printNumber (k.raw);
|
|
|
|
::Focus.printNumber (k.raw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
EEPROMKeymap::focusKeymap (const char *command) {
|
|
|
|
EEPROMKeymap::focusKeymap (const char *command) {
|
|
|
|
if (strcmp_P (command, PSTR ("keymap.map")) != 0)
|
|
|
|
if (strcmp_P (command, PSTR ("keymap.map")) != 0)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
@ -114,10 +114,10 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
EEPROMKeymap::focusKeymapTransfer (const char *command) {
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
@ -133,7 +133,7 @@ namespace KaleidoscopePlugins {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|