furi_hal_delay.h 958 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @file furi_hal_delay.h
  3. * Delay HAL API
  4. */
  5. #pragma once
  6. #include <stdint.h>
  7. #include <stdbool.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /** Init Delay subsystem */
  12. void furi_hal_delay_init();
  13. /** Get instructions per microsecond count */
  14. uint32_t furi_hal_delay_instructions_per_microsecond();
  15. /** Get current tick counter
  16. *
  17. * System uptime, may overflow.
  18. *
  19. * @return Current ticks in milliseconds
  20. */
  21. uint32_t furi_hal_get_tick(void);
  22. /** Convert milliseconds to ticks
  23. *
  24. * @param[in] milliseconds time in milliseconds
  25. * @return time in ticks
  26. */
  27. uint32_t furi_hal_ms_to_ticks(float milliseconds);
  28. /** Delay in milliseconds
  29. * @warning Cannot be used from ISR
  30. *
  31. * @param[in] milliseconds milliseconds to wait
  32. */
  33. void furi_hal_delay_ms(float milliseconds);
  34. /** Delay in microseconds
  35. *
  36. * @param[in] microseconds microseconds to wait
  37. */
  38. void furi_hal_delay_us(float microseconds);
  39. #ifdef __cplusplus
  40. }
  41. #endif