furi_hal_delay.h 785 B

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