43 template<auto Context, u8 Index, u32 Offset, u32 MaxValue>
74 constexpr
auto Channel = getHALChannel();
75 HAL_DAC_SetValue(Context, Channel, DAC_ALIGN_12B_R,
u32(std::max(value * MaxValue - Offset, 0.0F)));
76 HAL_DAC_Start(Context, Channel);
84 operator float() const noexcept {
85 constexpr
auto Channel = getHALChannel();
87 return float(std::max(HAL_DAC_GetValue(Context, Channel) + Offset, 0)) / MaxValue;
98 constexpr
static u32 getHALChannel() {
100 case 1:
return DAC_CHANNEL_1;
101 case 2:
return DAC_CHANNEL_2;
102 default: bsp::unreachable();
109 template<auto,
template<auto, u8, u32, u32>
typename>