Add a version to the settings struct

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago
parent eca8be7b57
commit 212861173c

@ -54,9 +54,26 @@ namespace KaleidoscopePlugins {
return _isValid;
}
void
EEPROMSettings::invalidate (void) {
_isValid = false;
}
void
EEPROMSettings::update (void) {
EEPROM.put (0, settings);
_isValid = true;
}
uint8_t
EEPROMSettings::version (void) {
return settings.version;
}
void
EEPROMSettings::version (uint8_t ver) {
settings.version = ver;
update ();
}
};

@ -35,11 +35,15 @@ namespace KaleidoscopePlugins {
static uint16_t endOfSettings (void);
static void update (void);
static bool isValid (void);
static void invalidate (void);
static uint8_t version (void);
static void version (uint8_t ver);
private:
static bool _isValid;
static struct settings {
char magic[2];
uint8_t version;
uint16_t endOfSettings;
} settings;
};

Loading…
Cancel
Save