* Use SysTick as OS tick timer * Use LPTIM2 as tickless idle timer * Remove dummy LPTIM2 IRQ handler * Clean up clock init code * Rename os timer to idle timer * Advance hal ticks along with FreeRTOS's * Improve SysTick control during tickless idle * Improve idle timer precision * Correct SysTick IRQ priority * Main, FuriHal: move system startup to separate thread * Minor code cleanup Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
		
			
				
	
	
		
			52 lines
		
	
	
		
			958 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			958 B
		
	
	
	
		
			C
		
	
	
	
	
	
/**
 | 
						|
 * @file furi_hal_delay.h
 | 
						|
 * Delay HAL API
 | 
						|
 */
 | 
						|
 | 
						|
#pragma once
 | 
						|
 | 
						|
#include <stdint.h>
 | 
						|
#include <stdbool.h>
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/** Init Delay subsystem */
 | 
						|
void furi_hal_delay_init();
 | 
						|
 | 
						|
/** Get instructions per microsecond count */
 | 
						|
uint32_t furi_hal_delay_instructions_per_microsecond();
 | 
						|
 | 
						|
/** Get current tick counter
 | 
						|
 *
 | 
						|
 * System uptime, may overflow.
 | 
						|
 *
 | 
						|
 * @return     Current ticks in milliseconds
 | 
						|
 */
 | 
						|
uint32_t furi_hal_get_tick(void);
 | 
						|
 | 
						|
/** Convert milliseconds to ticks
 | 
						|
 *
 | 
						|
 * @param[in]   milliseconds    time in milliseconds
 | 
						|
 * @return      time in ticks
 | 
						|
 */
 | 
						|
uint32_t furi_hal_ms_to_ticks(float milliseconds);
 | 
						|
 | 
						|
/** Delay in milliseconds
 | 
						|
 * @warning    Cannot be used from ISR
 | 
						|
 *
 | 
						|
 * @param[in]  milliseconds  milliseconds to wait
 | 
						|
 */
 | 
						|
void furi_hal_delay_ms(float milliseconds);
 | 
						|
 | 
						|
/** Delay in microseconds
 | 
						|
 *
 | 
						|
 * @param[in]  microseconds  microseconds to wait
 | 
						|
 */
 | 
						|
void furi_hal_delay_us(float microseconds);
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 |