including tftp based shell and sockets from different project
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user