You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
351 B

  1. #include "tick.h"
  2. #include "main.h"
  3. #include <stdint.h>
  4. /**
  5. * @description:
  6. * @param {uint32_t} lastime
  7. * @return {*}
  8. */
  9. uint32_t pass_time(uint32_t lastime) {
  10. uint32_t nowtime = HAL_GetTick();
  11. int32_t passtime;
  12. passtime = nowtime - lastime;
  13. if (passtime >= 0)
  14. return passtime;
  15. else
  16. return HAL_MAX_DELAY - lastime + nowtime;
  17. }