[FL-2818] FuriHal: add FuriHalCortexTimer, use it for i2c bus timeouts (#1900)
* FuriHal: add FuriHalCortexTimer, use it for i2c bus timeouts * Furi: cleanup FuriHalCortexTimer sources and headers
This commit is contained in:
@@ -6,11 +6,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Cortex timer provides high precision low level expiring timer */
|
||||
typedef struct {
|
||||
uint32_t start;
|
||||
uint32_t value;
|
||||
} FuriHalCortexTimer;
|
||||
|
||||
/** Early init stage for cortex
|
||||
*/
|
||||
void furi_hal_cortex_init_early();
|
||||
@@ -27,6 +34,28 @@ void furi_hal_cortex_delay_us(uint32_t microseconds);
|
||||
*/
|
||||
uint32_t furi_hal_cortex_instructions_per_microsecond();
|
||||
|
||||
/** Get Timer
|
||||
*
|
||||
* @param[in] timeout_us The expire timeout in us
|
||||
*
|
||||
* @return The FuriHalCortexTimer
|
||||
*/
|
||||
FuriHalCortexTimer furi_hal_cortex_timer_get(uint32_t timeout_us);
|
||||
|
||||
/** Check if timer expired
|
||||
*
|
||||
* @param[in] cortex_timer The FuriHalCortexTimer
|
||||
*
|
||||
* @return true if expired
|
||||
*/
|
||||
bool furi_hal_cortex_timer_is_expired(FuriHalCortexTimer cortex_timer);
|
||||
|
||||
/** Wait for timer expire
|
||||
*
|
||||
* @param[in] cortex_timer The FuriHalCortexTimer
|
||||
*/
|
||||
void furi_hal_cortex_timer_wait(FuriHalCortexTimer cortex_timer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user