mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
45 lines
872 B
C++
45 lines
872 B
C++
#ifndef STA_CORE_STM32_ADC_HPP
|
|
#define STA_CORE_STM32_ADC_HPP
|
|
|
|
#include <sta/config.hpp>
|
|
#ifdef STA_PLATFORM_STM32
|
|
# include <sta/devices/stm32/hal.hpp>
|
|
# ifdef HAL_ADC_MODULE_ENABLED
|
|
# define STA_STM32_ADC_ENABLED
|
|
# endif
|
|
#endif
|
|
|
|
#if defined(STA_STM32_ADC_ENABLED) || defined(DOXYGEN)
|
|
|
|
namespace sta
|
|
{
|
|
class STM32ADC
|
|
{
|
|
public:
|
|
/**
|
|
* @param handle A handle to a STM32 ADC.
|
|
*/
|
|
STM32ADC(ADC_HandleTypeDef * handle);
|
|
|
|
/**
|
|
* @brief Starts conversion of the incoming analog signal.
|
|
*/
|
|
void start();
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* @param timeout
|
|
*/
|
|
void poll(uint32_t timeout);
|
|
|
|
uint32_t getValue();
|
|
private:
|
|
ADC_HandleTypeDef * handle_;
|
|
};
|
|
} // namespace sta
|
|
|
|
#endif // STA_STM32_ADC_ENABLED
|
|
|
|
#endif // STA_CORE_STM32_ADC_HPP
|