e3c7201a20
* Furi: rename and move core * Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest * Furi: CMSIS_OS drop and refactoring. * Furi: refactoring, remove cmsis legacy * Furi: fix incorrect assert on queue deallocation, cleanup timer * Furi: improve delay api, get rid of floats * hal: dropped furi_hal_crc * Furi: move DWT based delay to cortex HAL * Furi: update core documentation Co-authored-by: hedger <hedger@nanode.su>
62 lines
1.3 KiB
C
62 lines
1.3 KiB
C
#pragma once
|
|
|
|
#include "core/base.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef void (*FuriTimerCallback)(void* context);
|
|
|
|
typedef enum {
|
|
FuriTimerTypeOnce = 0, ///< One-shot timer.
|
|
FuriTimerTypePeriodic = 1 ///< Repeating timer.
|
|
} FuriTimerType;
|
|
|
|
typedef void FuriTimer;
|
|
|
|
/** Allocate timer
|
|
*
|
|
* @param[in] func The callback function
|
|
* @param[in] type The timer type
|
|
* @param context The callback context
|
|
*
|
|
* @return The pointer to FuriTimer instance
|
|
*/
|
|
FuriTimer* furi_timer_alloc(FuriTimerCallback func, FuriTimerType type, void* context);
|
|
|
|
/** Free timer
|
|
*
|
|
* @param instance The pointer to FuriTimer instance
|
|
*/
|
|
void furi_timer_free(FuriTimer* instance);
|
|
|
|
/** Start timer
|
|
*
|
|
* @param instance The pointer to FuriTimer instance
|
|
* @param[in] ticks The ticks
|
|
*
|
|
* @return The furi status.
|
|
*/
|
|
FuriStatus furi_timer_start(FuriTimer* instance, uint32_t ticks);
|
|
|
|
/** Stop timer
|
|
*
|
|
* @param instance The pointer to FuriTimer instance
|
|
*
|
|
* @return The furi status.
|
|
*/
|
|
FuriStatus furi_timer_stop(FuriTimer* instance);
|
|
|
|
/** Is timer running
|
|
*
|
|
* @param instance The pointer to FuriTimer instance
|
|
*
|
|
* @return 0: not running, 1: running
|
|
*/
|
|
uint32_t furi_timer_is_running(FuriTimer* instance);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|