Adding NVS to project

This commit is contained in:
2025-01-01 21:15:01 +01:00
parent dd9f59e418
commit 968d078c07
19 changed files with 812 additions and 28 deletions
+36
View File
@@ -0,0 +1,36 @@
/**
* @file countDown.hpp
* @author Gustice
* @brief Classes for typical index manipulation
*
* @copyright Copyright (c) 2020
*/
#pragma once
class CountDown {
public:
CountDown(unsigned max) : Max(max) {}
void Tick() {
_cnt++;
if (_cnt >= Max) {
_cnt = 0;
_pFlag = true;
}
}
bool GetVolatileFlag() {
if (!_pFlag)
return false;
// Reset _pFlag in any case, so it only be consumed once
// hence volatile
_pFlag = false;
return true;
}
private:
const unsigned Max;
unsigned _cnt;
bool _pFlag;
};