29 lines
593 B
C++

#include <sta/devices/stm32/init.hpp>
#include <sta/assert.hpp>
#ifdef STA_STM32_DELAY_US_TIM
#ifndef HAL_TIM_MODULE_ENABLED
# error "STM32 HAL TIM module not enabled!"
#endif // HAL_TIM_MODULE_ENABLED
#include <tim.h>
#endif // STA_STM32_DELAY_US_TIM
namespace sta
{
void initHAL()
{
#ifdef STA_STM32_DELAY_US_TIM
// Validate TIM used for delayUs
extern bool isValidDelayUsTIM();
STA_ASSERT(isValidDelayUsTIM());
// Start timer base
HAL_TIM_Base_Start(&STA_STM32_DELAY_US_TIM);
#endif // STA_STM32_DELAY_US_TIM
}
} // namespace sta