Use the EEPROM-Settings plugin

Use the EEPROM-Settings plugin to figure out where to store the EEPROM settings.

Fixes #2.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent baa8252e67
commit 0f6f095be2

@ -17,11 +17,10 @@
*/
#include <Kaleidoscope/HostOS.h>
#include <Kaleidoscope-EEPROM-Settings.h>
#include <EEPROM.h>
#define EEPROM_HOSTOS_TYPE_LOCATION 2
namespace KaleidoscopePlugins {
namespace HostOS {
void
@ -29,13 +28,15 @@ namespace KaleidoscopePlugins {
if (isConfigured)
return;
eepromSlice = ::EEPROMSettings.requestSlice (sizeof (osType));
isConfigured = true;
if (osType != AUTO) {
return;
}
if ((osType = (Type)EEPROM.read (EEPROM_HOSTOS_TYPE_LOCATION)) != AUTO)
if ((osType = (Type)EEPROM.read (eepromSlice)) != AUTO)
return;
autoDetect ();
@ -52,7 +53,7 @@ namespace KaleidoscopePlugins {
void
Base::os (HostOS::Type osType_) {
osType = osType_;
EEPROM.update (EEPROM_HOSTOS_TYPE_LOCATION, osType);
EEPROM.update (eepromSlice, osType);
}
};
};

@ -43,6 +43,7 @@ namespace KaleidoscopePlugins {
Type osType;
private:
uint16_t eepromSlice;
bool isConfigured = false;
};
};

Loading…
Cancel
Save