timer.h 512 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef __TIMER_Hx__
  2. #define __TIMER_Hx__
  3. #include "FreeRTOS.h"
  4. #include "task.h"
  5. #include <timers.h>
  6. typedef void (*timer_fn_t)(void *arg, int last);
  7. typedef struct {
  8. TimerHandle_t timer;
  9. int times;
  10. int times_max;
  11. timer_fn_t fn;
  12. void *arg;
  13. int inited;
  14. }timer_handle_t;
  15. timer_handle_t* x_timer_init(void);
  16. void x_timer_deinit(timer_handle_t * h);
  17. int x_timer_start(timer_handle_t *h, int t, int times, timer_fn_t fn, void *arg);
  18. int x_timer_stop(timer_handle_t* h);
  19. #endif