libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
stm32_dac.hpp
1#include "main.h"
2
3#if defined(HAL_DAC_MODULE_ENABLED)
4
5#ifdef DAC
6#undef DAC
7#endif
8
9#include "dac.hpp"
10
11namespace LibXR
12{
13
17class STM32DAC : public DAC
18{
19 public:
23 STM32DAC(DAC_HandleTypeDef* hdac, uint32_t channel, float init_voltage = 0.0f,
24 float vref = 3.3f);
25
32 ErrorCode Write(float voltage) override;
33
34 private:
35 DAC_HandleTypeDef* hdac_;
36 uint32_t channel_;
37 float vref_;
38 uint32_t align_;
39 uint16_t resolution_;
40};
41
42} // namespace LibXR
43
44#endif
数字模拟转换器(DAC)基类 Abstract base class for Digital-to-Analog Converter (DAC)
Definition dac.hpp:18
STM32 DAC 驱动实现 / STM32 DAC driver implementation.
Definition stm32_dac.hpp:18
ErrorCode Write(float voltage) override
输出电压 / Output analog voltage
Definition stm32_dac.cpp:27
STM32DAC(DAC_HandleTypeDef *hdac, uint32_t channel, float init_voltage=0.0f, float vref=3.3f)
构造 DAC 对象 / Construct DAC object
Definition stm32_dac.cpp:7
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes