feat-hal-2 (#4)
Finished working initial version Co-authored-by: Andis Zīle <andis.jarganns@gmail.com> Reviewed-on: #4 Co-authored-by: Andis Zīle <andis.jargans@gmail.com> Co-committed-by: Andis Zīle <andis.jargans@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
42
firmware/src/utils/vcounter.h
Normal file
42
firmware/src/utils/vcounter.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef VIRTUAL_COUNTER_H_
|
||||
#define VIRTUAL_COUNTER_H_
|
||||
|
||||
/**** Includes ****/
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util {
|
||||
|
||||
/**** Public definitions ****/
|
||||
class VCounter
|
||||
{
|
||||
public:
|
||||
VCounter(void);
|
||||
~VCounter(void);
|
||||
|
||||
void init(uint16_t top, uint16_t step_us);
|
||||
|
||||
uint8_t disabled;
|
||||
|
||||
void reset(void);
|
||||
void increment(void);
|
||||
uint16_t read(void);
|
||||
uint32_t read_ms(void);
|
||||
uint16_t read_top(void);
|
||||
uint32_t convert_ms(uint16_t raw);
|
||||
|
||||
#ifndef TESTING
|
||||
protected:
|
||||
#endif
|
||||
uint16_t step_us;
|
||||
uint16_t counter;
|
||||
uint16_t top;
|
||||
};
|
||||
|
||||
/**** Public function declarations ****/
|
||||
|
||||
#ifdef TESTING
|
||||
#endif
|
||||
|
||||
} //namespace
|
||||
|
||||
#endif /* VIRTUAL_COUNTER_H_ */
|
||||
Reference in New Issue
Block a user