#ifndef STA_CORE_STM32_ADC_HPP #define STA_CORE_STM32_ADC_HPP #include #ifdef STA_PLATFORM_STM32 # include # ifdef HAL_ADC_MODULE_ENABLED # define STA_STM32_ADC_ENABLED # endif #endif #if defined(STA_STM32_ADC_ENABLED) || defined(DOXYGEN) namespace sta { /** * @brief A wrapper class for the STM32 ADC peripheral. * * @ingroup sta_core_stm32 */ 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 Polls for the converted analog signal. * * @param timeout */ void poll(uint32_t timeout); /** * @brief Get the value of the converted analog signal. * * @return uint32_t */ uint32_t getValue(); private: ADC_HandleTypeDef * handle_; }; } // namespace sta #endif // STA_STM32_ADC_ENABLED #endif // STA_CORE_STM32_ADC_HPP