63 lines
1.5 KiB
C
63 lines
1.5 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file : hal_delay.c
|
|
* @brief : Delay hardware abstraction layer source file
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
|
|
#include "hal.h"
|
|
#include "hal_delay.h"
|
|
|
|
/**
|
|
* @brief Initialize delay module
|
|
*/
|
|
void hal_delay_init(void) {
|
|
/* Call architecture specific delay initialization */
|
|
#if HAL_TARGET_ARCH == HAL_ARCH_STM32F4
|
|
hal_stm32f4_delay_init();
|
|
#else
|
|
#error "Unsupported HAL architecture"
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* @brief Delay in milliseconds
|
|
* @param ms: Delay time in milliseconds
|
|
*/
|
|
void hal_delay_ms(uint32_t ms) {
|
|
/* Call architecture specific delay implementation */
|
|
#if HAL_TARGET_ARCH == HAL_ARCH_STM32F4
|
|
hal_stm32f4_delay_ms(ms);
|
|
#else
|
|
#error "Unsupported HAL architecture"
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* @brief Delay in microseconds
|
|
* @param us: Delay time in microseconds
|
|
*/
|
|
void hal_delay_us(uint32_t us) {
|
|
/* Call architecture specific delay implementation */
|
|
#if HAL_TARGET_ARCH == HAL_ARCH_STM32F4
|
|
hal_stm32f4_delay_us(us);
|
|
#else
|
|
#error "Unsupported HAL architecture"
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* @brief Get current system tick count in milliseconds
|
|
* @return Current tick count in milliseconds
|
|
*/
|
|
uint32_t hal_get_tick(void) {
|
|
/* Call architecture specific tick implementation */
|
|
#if HAL_TARGET_ARCH == HAL_ARCH_STM32F4
|
|
return hal_stm32f4_get_tick();
|
|
#else
|
|
#error "Unsupported HAL architecture"
|
|
#endif
|
|
}
|