multi_timer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2016 Zibin Zheng <[email protected]>
  3. * All rights reserved
  4. */
  5. #ifndef _MULTI_TIMER_H_
  6. #define _MULTI_TIMER_H_
  7. //#include "stdint.h"
  8. #include "TypeDef.h"
  9. #include "string.h"
  10. #define TIMER_TICK 10
  11. #define TIMER_MAX 60000 //86400000 //
  12. typedef struct Timer
  13. {
  14. uint32_t timeout;
  15. uint32_t repeat;
  16. void ( *timeout_cb ) ( void );
  17. struct Timer* next;
  18. } Timer;
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. extern void timer_init_Head ( void );
  23. extern void timer_init ( struct Timer* handle, void ( *timeout_cb ) (), uint32_t timeout, uint32_t repeat );
  24. extern int timer_start ( struct Timer* handle );
  25. extern void timer_stop ( struct Timer* handle );
  26. extern void timer_ticks ( void );
  27. extern void timer_loop ( void );
  28. extern void timer_app ( struct Timer* handle, void ( *timeout_cb ) (), uint32_t timeout, uint32_t repeat );
  29. // void timer_again(struct Timer* handle);
  30. // void timer_set_repeat(struct Timer* handle, uint32_t repeat);
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif