|
|
@ -1,6 +1,6 @@
|
|
|
|
/* -*- mode: c++ -*-
|
|
|
|
/* -*- mode: c++ -*-
|
|
|
|
* Kaleidoscope-EEPROM-Settings -- Basic EEPROM settings plugin for Kaleidoscope.
|
|
|
|
* Kaleidoscope-EEPROM-Settings -- Basic EEPROM settings plugin for Kaleidoscope.
|
|
|
|
* Copyright (C) 2017 Gergely Nagy
|
|
|
|
* Copyright (C) 2017, 2018 Gergely Nagy
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
@ -26,11 +26,9 @@ bool EEPROMSettings::is_valid_;
|
|
|
|
bool EEPROMSettings::sealed_;
|
|
|
|
bool EEPROMSettings::sealed_;
|
|
|
|
uint16_t EEPROMSettings::next_start_ = sizeof(EEPROMSettings::settings);
|
|
|
|
uint16_t EEPROMSettings::next_start_ = sizeof(EEPROMSettings::settings);
|
|
|
|
|
|
|
|
|
|
|
|
EEPROMSettings::EEPROMSettings(void) {
|
|
|
|
EventHandlerResult EEPROMSettings::onSetup() {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EEPROMSettings::begin(void) {
|
|
|
|
|
|
|
|
EEPROM.get(0, settings_);
|
|
|
|
EEPROM.get(0, settings_);
|
|
|
|
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool EEPROMSettings::isValid(void) {
|
|
|
|
bool EEPROMSettings::isValid(void) {
|
|
|
@ -65,6 +63,9 @@ uint16_t EEPROMSettings::requestSlice(uint16_t size) {
|
|
|
|
if (sealed_)
|
|
|
|
if (sealed_)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Serial.print("requestSlice; size=");
|
|
|
|
|
|
|
|
Serial.println(size);
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t start = next_start_;
|
|
|
|
uint16_t start = next_start_;
|
|
|
|
next_start_ += size;
|
|
|
|
next_start_ += size;
|
|
|
|
|
|
|
|
|
|
|
@ -97,6 +98,13 @@ void EEPROMSettings::version(uint8_t ver) {
|
|
|
|
update();
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Legacy V1 API
|
|
|
|
|
|
|
|
#if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API
|
|
|
|
|
|
|
|
void EEPROMSettings::begin() {
|
|
|
|
|
|
|
|
::EEPROMSettings.onSetup();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kaleidoscope::EEPROMSettings EEPROMSettings;
|
|
|
|
kaleidoscope::EEPROMSettings EEPROMSettings;
|
|
|
|