Update to use the new EEPROM-Settings library

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago
parent 4e1a579136
commit 5a7601bb30

@ -48,11 +48,15 @@ void setup () {
USE_PLUGINS (&EEPROMKeymap, &Focus); USE_PLUGINS (&EEPROMKeymap, &Focus);
Focus.addHook (FOCUS_HOOK_SETTINGS);
Focus.addHook (FOCUS_HOOK_KEYMAP); Focus.addHook (FOCUS_HOOK_KEYMAP);
Focus.addHook (FOCUS_HOOK_HELP); Focus.addHook (FOCUS_HOOK_HELP);
Focus.addHook (FOCUS_HOOK_VERSION); Focus.addHook (FOCUS_HOOK_VERSION);
Layer.getKey = EEPROMKeymap.getKey; Layer.getKey = EEPROMKeymap.getKey;
EEPROMKeymap.reserveSpace (2);
EEPROMSettings.seal ();
} }
void loop () { void loop () {

@ -29,10 +29,12 @@ namespace KaleidoscopePlugins {
void void
EEPROMKeymap::begin (void) { EEPROMKeymap::begin (void) {
USE_PLUGINS (&::EEPROMSettings); USE_PLUGINS (&::EEPROMSettings);
}
uint16_t layerSize = ROWS * COLS * 2; void
maxLayers = (E2END - ::EEPROMSettings.endOfSettings ()) / layerSize; EEPROMKeymap::reserveSpace (uint8_t layers) {
keymapBase = ::EEPROMSettings.endOfSettings () + 1; maxLayers = layers;
keymapBase = ::EEPROMSettings.requestSlice (maxLayers * ROWS * COLS * 2);
} }
Key Key

@ -28,8 +28,11 @@ namespace KaleidoscopePlugins {
virtual void begin (void) final; virtual void begin (void) final;
static Key getKey (uint8_t layer, byte row, byte col); static void reserveSpace (uint8_t layers);
static uint16_t base (void); static uint16_t base (void);
static Key getKey (uint8_t layer, byte row, byte col);
static bool focusKeymap (const char *command); static bool focusKeymap (const char *command);
private: private:

Loading…
Cancel
Save