diff --git a/game-ctrl/config.c b/game-ctrl/config.c index 200290f..1efb952 100644 --- a/game-ctrl/config.c +++ b/game-ctrl/config.c @@ -38,6 +38,15 @@ static void configHandleResetHighScore() { } } +static void configHandleResetGameCounter() { + displaySetValue(eepromReadGameCounter()); + + if (buttonsConfig2Pressed()) { + configChanged = true; + eepromClearGameCounter(0); + } +} + static void configHandleBrightness() { displaySetValue(eepromReadBrightness()); stoneDrawConfigPattern(); @@ -71,8 +80,13 @@ static void configHandleAmplitude() { } } -void (*configHandler[])(void) = { configHandleResetHighScore, configHandleFlash, configHandleBrightness, configHandleAmplitude }; - +void (*configHandler[])(void) = { + configHandleResetHighScore, + configHandleResetGameCounter, + configHandleFlash, + configHandleBrightness, + configHandleAmplitude +}; void configExec(void *handle) { static uint8_t configState = 0; diff --git a/game-ctrl/eeprom.c b/game-ctrl/eeprom.c index b665292..e9606cd 100644 --- a/game-ctrl/eeprom.c +++ b/game-ctrl/eeprom.c @@ -137,9 +137,17 @@ void eepromSetAmplitude(uint8_t v) { buf.v.amplitude = v; } +uint16_t eepromReadGameCounter() { + return buf.v.gameCounter; +} + void eepromIncGameCounter() { buf.v.gameCounter += 1; writeBuf(); } +void eepromClearGameCounter() { + buf.v.gameCounter = 0; +} + diff --git a/game-ctrl/eeprom.h b/game-ctrl/eeprom.h index c44c558..f5c741e 100644 --- a/game-ctrl/eeprom.h +++ b/game-ctrl/eeprom.h @@ -16,6 +16,8 @@ void eepromSetBrightness(uint8_t v); uint8_t eepromReadAmplitude(); void eepromSetAmplitude(uint8_t v); void eepromIncGameCounter(); +uint16_t eepromReadGameCounter(); +void eepromClearGameCounter();