Merge pull request #6 from keyboardio/f/implicit-seal

Seal the EEPROM layout automatically
pull/365/head
Jesse Vincent 6 years ago committed by GitHub
commit ad36c4c10f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -72,6 +72,9 @@ The plugin provides the `EEPROMSettings` object, which has the following methods
> Seal the `EEPROM` layout, so no new slices can be requested. The CRC checksum > Seal the `EEPROM` layout, so no new slices can be requested. The CRC checksum
> is considered final at this time, and the `isValid()`, `crc()`, `used()` and > is considered final at this time, and the `isValid()`, `crc()`, `used()` and
> `version()` methods can be used from this point onwards. > `version()` methods can be used from this point onwards.
>
> If not called explicitly, the layout will be sealed automatically after
> `setup()` in the sketch finished.
### `update()` ### `update()`

@ -30,6 +30,13 @@ EventHandlerResult EEPROMSettings::onSetup() {
return EventHandlerResult::OK; return EventHandlerResult::OK;
} }
EventHandlerResult EEPROMSettings::beforeEachCycle() {
if (!sealed_)
seal();
return EventHandlerResult::OK;
}
bool EEPROMSettings::isValid(void) { bool EEPROMSettings::isValid(void) {
return is_valid_; return is_valid_;
} }

@ -26,6 +26,7 @@ class EEPROMSettings : public kaleidoscope::Plugin {
EEPROMSettings(void) {} EEPROMSettings(void) {}
EventHandlerResult onSetup(); EventHandlerResult onSetup();
EventHandlerResult beforeEachCycle();
static void update(void); static void update(void);
static bool isValid(void); static bool isValid(void);

Loading…
Cancel
Save