Nýjir kóðar og uppfærðir gamlir kóðar fyrir arduino yfir í zephyr
This commit is contained in:
+24
-2
@@ -1,9 +1,31 @@
|
||||
#ifndef TIMER_USEC_H
|
||||
#define TIMER_USEC_H
|
||||
#include <avr/io.h>
|
||||
|
||||
struct Timer_usec {
|
||||
//#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
|
||||
|
||||
Reference in New Issue
Block a user