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.

30 lines
522 B

  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include "board.h"
  4. #include "main.h"
  5. #include "usart.h"
  6. /**
  7. * @brief printf
  8. *
  9. * @param ch
  10. * @param stream
  11. * @return int
  12. */
  13. int fputc(int ch, FILE* stream) {
  14. uint8_t c = ch;
  15. HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100);
  16. return ch;
  17. }
  18. /**
  19. * @brief ticket辅助方法
  20. */
  21. uint32_t port_haspassedms(uint32_t ticket) {
  22. uint32_t nowticket = HAL_GetTick();
  23. if (nowticket >= ticket) {
  24. return nowticket - ticket;
  25. }
  26. return UINT32_MAX - ticket + nowticket;
  27. }