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.

37 lines
1.3 KiB

  1. #include "zport.h"
  2. #include <stdint.h>
  3. #include <stdio.h>
  4. #include "zboard.h"
  5. static uint32_t sys_haspassedms(uint32_t ticket)
  6. {
  7. uint32_t nowticket = HAL_GetTick();
  8. if (nowticket >= ticket)
  9. {
  10. return nowticket - ticket;
  11. }
  12. return UINT32_MAX - ticket + nowticket;
  13. }
  14. ///**********************************************************************************************************************
  15. // * ===================================================printf重定向=================================================== *
  16. // **********************************************************************************************************************/
  17. int fputc(int ch, FILE *stream)
  18. {
  19. uint8_t c = ch;
  20. HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100);
  21. return ch;
  22. }
  23. ///***********************************************************************************************************************
  24. // * ====================================================调试指示灯===================================================== *
  25. // ***********************************************************************************************************************/
  26. void port_do_debug_light_state(void)
  27. {
  28. static uint32_t lastprocess = 0;
  29. if (sys_haspassedms(lastprocess) > 300)
  30. {
  31. lastprocess = HAL_GetTick();
  32. HAL_GPIO_TogglePin(DEBUG_LIGHT_PORT, DEBUG_LIGHT_PIN);
  33. }
  34. }