luat_timer.h 479 B

123456789101112131415161718192021222324252627282930
  1. #ifndef LUAT_TIMER_H
  2. #define LUAT_TIMER_H
  3. #include "luat_base.h"
  4. #ifdef __LUATOS__
  5. #include "luat_msgbus.h"
  6. #endif
  7. typedef struct luat_timer
  8. {
  9. void* os_timer;
  10. size_t id;
  11. size_t timeout;
  12. size_t type;
  13. int repeat;
  14. #ifdef __LUATOS__
  15. luat_msg_handler func;
  16. #endif
  17. }luat_timer_t;
  18. int luat_timer_start(luat_timer_t* timer);
  19. int luat_timer_stop(luat_timer_t* timer);
  20. luat_timer_t* luat_timer_get(size_t timer_id);
  21. int luat_timer_mdelay(size_t ms);
  22. #endif