sta-core/include/sta/hal/delay.hpp
2022-04-24 13:42:34 +02:00

43 lines
826 B
C++

/**
* @brief Delay functions.
*
* Configuration:
* STA_HAL_DELAY_ENABLE: Enable module
* STA_HAL_DELAY_US_TIM: 1 MHz TIM instance used by `sta::delayUs`
*
* NOTE: TIM time base must be started before use of `sta::delayUs` by calling `sta::initHAL`.
* When using startup system task this is handled automatically.
*/
#ifndef STA_HAL_DELAY_HPP
#define STA_HAL_DELAY_HPP
#include <sta/config.hpp>
#ifdef STA_HAL_DELAY_ENABLE
#include <cstdint>
namespace sta
{
/**
* @brief Millisecond delay.
*
* @param ms Milliseconds
*/
void delayMs(uint32_t ms);
#ifdef STA_HAL_DELAY_US_TIM
/**
* @brief Microsecond delay.
*
* @param us Microseconds
*/
void delayUs(uint32_t us);
#endif // STA_HAL_DELAY_US_TIM
} // namespace sta
#endif // STA_HAL_DELAY_TIM
#endif // STA_HAL_DELAY_HPP