mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Add HAL init
This commit is contained in:
parent
867d884d67
commit
f940dd9710
17
include/sta/hal/init.hpp
Normal file
17
include/sta/hal/init.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @brief Global HAL initialization.
|
||||
*/
|
||||
#ifndef STA_HAL_INIT_HPP
|
||||
#define STA_HAL_INIT_HPP
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
/**
|
||||
* @brief Initialize global HAL objects.
|
||||
*/
|
||||
void initHAL();
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_HAL_INIT_HPP
|
22
src/hal/init.cpp
Normal file
22
src/hal/init.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <sta/hal/init.hpp>
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
|
||||
#ifdef STA_HAL_DELAY_US_TIM
|
||||
#include <tim.h>
|
||||
#endif // STA_HAL_DELAY_US_TIM
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
void initHAL()
|
||||
{
|
||||
#ifdef STA_HAL_DELAY_US_TIM
|
||||
// Validate TIM used for delayUs
|
||||
extern bool isValidDelayUsTIM();
|
||||
STA_ASSERT(isValidDelayUsTIM());
|
||||
// Start timer base
|
||||
HAL_TIM_Base_Start(&STA_HAL_DELAY_US_TIM);
|
||||
#endif // STA_HAL_DELAY_US_TIM
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user