Files
Cpp-in-Embedded-Systems/Chapter14/sequencer/hal/adc/inc/adc_stm32.hpp
Amar Mahmutbegovic b378383cf5 add Chapter14
2024-11-19 21:29:22 +01:00

22 lines
452 B
C++

#pragma once
#include <adc.hpp>
#include <units.hpp>
#include <stm32f0xx_hal.h>
#include <stm32f072xb.h>
namespace hal
{
class adc_stm32 : public adc{
public:
adc_stm32(units::voltage ref_voltage) : ref_voltage_(ref_voltage) {}
void init() override;
std::expected<units::voltage, adc::error> get_reading() override;
private:
ADC_HandleTypeDef adc_handle_;
units::voltage ref_voltage_;
};
};