32 lines
547 B
C++
32 lines
547 B
C++
#ifndef TIMER_USEC_H
|
|
#define TIMER_USEC_H
|
|
|
|
//#include <avr/io.h>
|
|
|
|
#include <stdint.h>
|
|
#include <zephyr/kernel.h>
|
|
|
|
// struct Timer_usec {
|
|
// Timer_usec();
|
|
// void init(uint16_t period_us);
|
|
//};
|
|
|
|
class Timer_usec {
|
|
public:
|
|
using callback_t = void (*)(void *context);
|
|
|
|
Timer_usec();
|
|
|
|
void set_callback(callback_t callback, void *context);
|
|
void init(uint16_t period_us);
|
|
|
|
private:
|
|
struct k_timer timer;
|
|
callback_t callback;
|
|
void *callback_context;
|
|
|
|
static void expiry_handler(struct k_timer *timer);
|
|
};
|
|
|
|
#endif
|