pando_timer.h 860 B

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