From cc2855d44e90aa2318f5e04298a5697d4a389cab Mon Sep 17 00:00:00 2001 From: fabiangottstein <75617853+fabiangottstein@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:26:29 +0100 Subject: [PATCH] feat: DigitalToAnalogPinImplStm improvements (#471) * Define tag types as constexpr * Zero-initialize handle structure --- hal_st/stm32fxxx/DigitalToAnalogPinStm.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hal_st/stm32fxxx/DigitalToAnalogPinStm.hpp b/hal_st/stm32fxxx/DigitalToAnalogPinStm.hpp index 7f3a2338..7350c165 100644 --- a/hal_st/stm32fxxx/DigitalToAnalogPinStm.hpp +++ b/hal_st/stm32fxxx/DigitalToAnalogPinStm.hpp @@ -21,10 +21,9 @@ namespace hal public: #if defined(DAC_CHIPCONNECT_BOTH) // clang-format off - static const struct Internal{} internal; - static const struct External{} external; - static const struct Both{} both; - + static constexpr struct Internal{} internal{}; + static constexpr struct External{} external{}; + static constexpr struct Both{} both{}; // clang-format on enum struct Channel : uint32_t @@ -66,7 +65,7 @@ namespace hal friend class DigitalToAnalogPinImplStm; uint8_t index; - DAC_HandleTypeDef handle; + DAC_HandleTypeDef handle{}; }; }