Skip to content

Commit

Permalink
Repair host LED console print
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Nov 23, 2024
1 parent 3a34d9f commit 235bf82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ref_app/src/mcal/host/mcal_led.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -10,7 +10,7 @@

auto mcal::led::led0() -> mcal::led::led_base&
{
static mcal::led::led_console local_led0(static_cast<std::uint_fast8_t>(UINT8_C(0)));
static mcal::led::led_console local_led0;

return local_led0;
}
12 changes: 6 additions & 6 deletions ref_app/src/mcal_led/mcal_led_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@
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;

auto toggle() -> void override
{
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<unsigned>(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
Expand Down

0 comments on commit 235bf82

Please sign in to comment.