diff --git a/ref_app/src/mcal/host/mcal_led.cpp b/ref_app/src/mcal/host/mcal_led.cpp index 115716660..5ff98bfd1 100644 --- a/ref_app/src/mcal/host/mcal_led.cpp +++ b/ref_app/src/mcal/host/mcal_led.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Copyright Christopher Kormanyos 2007 - 2020. +// Copyright Christopher Kormanyos 2007 - 2024. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -10,7 +10,7 @@ auto mcal::led::led0() -> mcal::led::led_base& { - static mcal::led::led_console local_led0(static_cast(UINT8_C(0))); + static mcal::led::led_console local_led0; return local_led0; } diff --git a/ref_app/src/mcal_led/mcal_led_console.h b/ref_app/src/mcal_led/mcal_led_console.h index 5aee4d640..9f6b00d7d 100644 --- a/ref_app/src/mcal_led/mcal_led_console.h +++ b/ref_app/src/mcal_led/mcal_led_console.h @@ -18,8 +18,8 @@ class led_console final : public mcal::led::led_boolean_state_base // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { public: - explicit constexpr led_console(const std::uint_fast8_t i) - : my_index(i) { } + explicit constexpr led_console(const std::uint_fast8_t idx = std::uint_fast8_t { UINT8_C(0) }) + : my_index(idx) { } ~led_console() override = default; @@ -27,18 +27,18 @@ { using base_class_type = mcal::led::led_boolean_state_base; - // Print the LED state. + base_class_type::toggle(); + + // Print the LED state to the console. std::cout << "LED" << static_cast(my_index) << " is " << (base_class_type::state_is_on() ? "on" : "off") << std::endl; - - base_class_type::toggle(); } private: - const std::uint_fast8_t my_index; + const std::uint_fast8_t my_index { }; }; } // namespace led