32 lines
473 B
C++
32 lines
473 B
C++
/*
|
||
* timer_sw.hpp
|
||
*
|
||
* Created on: 13 мар. 2023 г.
|
||
* Author: sychev
|
||
*/
|
||
|
||
#ifndef FREE_RTOS_TIMER_SW_TIMER_SW_HPP_
|
||
#define FREE_RTOS_TIMER_SW_TIMER_SW_HPP_
|
||
|
||
#include <cstdint>
|
||
|
||
class TimerSw {
|
||
public:
|
||
void start(uint32_t period);
|
||
|
||
void stop();
|
||
|
||
bool tick(uint32_t ticks);
|
||
|
||
bool is_started() { return enable_; }
|
||
|
||
private:
|
||
bool enable_ = false;
|
||
uint32_t cnt_ = 0;
|
||
uint32_t prd_ = 0;
|
||
};
|
||
|
||
|
||
|
||
#endif /* FREE_RTOS_TIMER_SW_TIMER_SW_HPP_ */
|