pando_timer.h 890 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*********************************************************
  2. * File name: pando_timer.h
  3. * Author: xiaoxiao
  4. * Versions: 1.0
  5. * Description: declare the types.
  6. * History:
  7. * 1.Date: Oct 28, 2015
  8. * Author: xiaoxiao
  9. * Modification:
  10. *********************************************************/
  11. #ifndef _PANDO_TIMER_H_
  12. #define _PANDO_TIMER_H_
  13. #include "pando_types.h"
  14. #include "stm32f1xx_hal.h"
  15. typedef int8_t (*expiry_cb)(void* arg);
  16. //define the timer structure
  17. struct pd_timer
  18. {
  19. //the timer interval (millisecond)
  20. uint16_t interval;
  21. //whether repeat
  22. uint8_t repeated;
  23. uint8_t timer_no;
  24. //the function pointer to callback if expiry
  25. expiry_cb timer_cb;
  26. void* arg;
  27. };
  28. void pando_timer_init(struct pd_timer * timer);
  29. void pando_timer_start(struct pd_timer * timer);
  30. void pando_timer_stop(struct pd_timer * timer);
  31. #endif /* _PANDO_TIMER_H_ */