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.

28 lines
510 B

3 years ago
3 years ago
  1. /**
  2. * @file port.c
  3. * @author Finny (tianjialong0106@163.com)
  4. * @brief
  5. * @version 0.1
  6. * @date 2022-09-26
  7. *
  8. * @copyright Copyright (c) 2022
  9. *
  10. */
  11. #include "port.h"
  12. #include "driver/gpio.h"
  13. #include "esp_log.h"
  14. uint32_t port_get_ticket() { return esp_log_timestamp(); }
  15. uint32_t port_haspassedms(uint32_t ticket) { return port_get_ticket() - ticket; }
  16. uint32_t port_delay_ms(uint32_t ms)
  17. {
  18. uint32_t now = port_get_ticket();
  19. while (port_get_ticket() - now < ms)
  20. {
  21. }
  22. return 0;
  23. }