diff --git a/ref_app/ref_app.vcxproj b/ref_app/ref_app.vcxproj
index 65c006156..9bdf0e969 100644
--- a/ref_app/ref_app.vcxproj
+++ b/ref_app/ref_app.vcxproj
@@ -2861,6 +2861,7 @@
true
+
diff --git a/ref_app/ref_app.vcxproj.filters b/ref_app/ref_app.vcxproj.filters
index 92b8007ba..2c4b545a5 100644
--- a/ref_app/ref_app.vcxproj.filters
+++ b/ref_app/ref_app.vcxproj.filters
@@ -2670,6 +2670,9 @@
src\mcal\rpi_pico2_rp2350
+
+ src\mcal_lcd
+
diff --git a/ref_app/src/math/wide_decimal/decwide_t.h b/ref_app/src/math/wide_decimal/decwide_t.h
index b4d1713a4..33bd26fd0 100644
--- a/ref_app/src/math/wide_decimal/decwide_t.h
+++ b/ref_app/src/math/wide_decimal/decwide_t.h
@@ -61,6 +61,10 @@
namespace std { using ::lround; }
#endif
+ #if (defined(__GNUC__) && (defined(__arm__) || defined(__AVR__)))
+ namespace std { using ::strtold; }
+ #endif
+
WIDE_DECIMAL_NAMESPACE_BEGIN
#if(__cplusplus >= 201703L)
diff --git a/ref_app/src/mcal_lcd/mcal_lcd_base.h b/ref_app/src/mcal_lcd/mcal_lcd_base.h
index 1a11fd194..4b5a0cabf 100644
--- a/ref_app/src/mcal_lcd/mcal_lcd_base.h
+++ b/ref_app/src/mcal_lcd/mcal_lcd_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
-// Copyright Christopher Kormanyos 2020 - 2022.
+// Copyright Christopher Kormanyos 2020 - 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)
@@ -8,10 +8,11 @@
#ifndef MCAL_LCD_BASE_2020_06_10_H // NOLINT(llvm-header-guard)
#define MCAL_LCD_BASE_2020_06_10_H
- #include
-
#include
+ #include
+ #include
+
#if(__cplusplus >= 201703L)
namespace mcal::lcd {
#else
@@ -25,9 +26,9 @@
virtual auto init() -> bool = 0;
- virtual auto write(const char* pstr,
- std::uint_fast8_t length,
- std::uint_fast8_t line_index) -> bool = 0;
+ virtual auto write(const char* pstr,
+ const std::size_t length,
+ const std::uint_fast8_t line_index) -> bool = 0;
protected:
lcd_base() = default; // LCOV_EXCL_LINE
diff --git a/ref_app/src/mcal_lcd/mcal_lcd_buffered_instance.h b/ref_app/src/mcal_lcd/mcal_lcd_buffered_instance.h
new file mode 100644
index 000000000..12f8aa15f
--- /dev/null
+++ b/ref_app/src/mcal_lcd/mcal_lcd_buffered_instance.h
@@ -0,0 +1,101 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 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)
+//
+
+#ifndef MCAL_LCD_BUFFERED_INSTANCE_2024_02_07_H // NOLINT(llvm-header-guard)
+ #define MCAL_LCD_BUFFERED_INSTANCE_2024_02_07_H
+
+ #include
+
+ #include
+ #include
+
+ #if(__cplusplus >= 201703L)
+ namespace mcal::lcd {
+ #else
+ namespace mcal { namespace lcd { // NOLINT(modernize-concat-nested-namespaces)
+ #endif
+
+ template
+ class lcd_buffered_instance : public mcal::lcd::lcd_base
+ {
+ private:
+ using backend_display_type = BackendDisplayType;
+
+ using row_array_type = std::array(WidthInCols)>;
+
+ using row_col_array_buffer_type = std::array(HeightInRows)>;
+
+ public:
+ explicit lcd_buffered_instance(backend_display_type& backend_display)
+ : my_backend_display(backend_display)
+ {
+ for(auto& row : row_col_array_buffer)
+ {
+ row.fill(' ');
+ }
+ }
+
+ lcd_buffered_instance() = delete;
+
+ ~lcd_buffered_instance() override = default;
+
+ static constexpr auto width () noexcept -> std::size_t { return std::tuple_size::value; }
+ static constexpr auto height() noexcept -> std::size_t { return std::tuple_size::value; }
+
+ auto init() -> bool override { return my_backend_display.init(); }
+
+ auto write(const char* pstr,
+ const std::size_t length,
+ const std::uint_fast8_t line_index) -> bool override
+ {
+ bool result_write_is_ok { };
+
+ if(line_index < static_cast(height()))
+ {
+ result_write_is_ok = true;
+
+ row_array_type candidate_row;
+
+ candidate_row.fill(' ');
+
+ const auto length_to_copy = (std::min)(static_cast(length), static_cast(width()));
+
+ std::copy(pstr, pstr + length_to_copy, candidate_row.begin());
+
+ if(candidate_row != row_col_array_buffer[static_cast(line_index)])
+ {
+ result_write_is_ok =
+ my_backend_display.write
+ (
+ candidate_row.data(),
+ static_cast(width()),
+ line_index
+ );
+
+ row_col_array_buffer[static_cast(line_index)] = candidate_row;
+ }
+ }
+
+ return result_write_is_ok;
+ }
+
+ private:
+ backend_display_type& my_backend_display;
+
+ row_col_array_buffer_type row_col_array_buffer { };
+ };
+
+ #if(__cplusplus >= 201703L)
+ } // namespace mcal::lcd
+ #else
+ } // namespace lcd
+ } // namespace mcal
+ #endif
+
+#endif // MCAL_LCD_BUFFERED_INSTANCE_2024_02_07_H
diff --git a/ref_app/src/mcal_lcd/mcal_lcd_console.h b/ref_app/src/mcal_lcd/mcal_lcd_console.h
index 557ad861e..8d788208b 100644
--- a/ref_app/src/mcal_lcd/mcal_lcd_console.h
+++ b/ref_app/src/mcal_lcd/mcal_lcd_console.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
-// Copyright Christopher Kormanyos 2020 - 2022.
+// Copyright Christopher Kormanyos 2020 - 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)
@@ -8,11 +8,11 @@
#ifndef MCAL_LCD_CONSOLE_2020_06_10_H // NOLINT(llvm-header-guard)
#define MCAL_LCD_CONSOLE_2020_06_10_H
+ #include
+
#include
#include
- #include
-
#if(__cplusplus >= 201703L)
namespace mcal::lcd {
#else
@@ -26,9 +26,9 @@
~lcd_console() override = default;
- auto write(const char* pstr,
- std::uint_fast8_t length, // NOLINT(bugprone-easily-swappable-parameters)
- std::uint_fast8_t line_index) -> bool override
+ auto write(const char* pstr,
+ const std::size_t length, // NOLINT(bugprone-easily-swappable-parameters)
+ const std::uint_fast8_t line_index) -> bool override
{
static_cast(line_index);
diff --git a/ref_app/src/mcal_lcd/mcal_lcd_generic_st7066.h b/ref_app/src/mcal_lcd/mcal_lcd_generic_st7066.h
index 58dfd20fc..012a212ef 100644
--- a/ref_app/src/mcal_lcd/mcal_lcd_generic_st7066.h
+++ b/ref_app/src/mcal_lcd/mcal_lcd_generic_st7066.h
@@ -8,15 +8,14 @@
#ifndef MCAL_LCD_GENERIC_ST7066_2020_05_07_H // NOLINT(llvm-header-guard)
#define MCAL_LCD_GENERIC_ST7066_2020_05_07_H
- #include
- #include
- #include
-
#include
#include
#include
+ #include
+ #include
+
#if(__cplusplus >= 201703L)
namespace mcal::lcd {
#else
@@ -80,9 +79,9 @@
return write_clear_lines_is_ok;
}
- auto write(const char* pstr,
- std::uint_fast8_t length,
- std::uint_fast8_t line_index) -> bool override
+ auto write(const char* pstr,
+ const std::size_t length,
+ const std::uint_fast8_t line_index) -> bool override
{
std::uint_fast8_t char_index = 0U;
@@ -93,13 +92,13 @@
// Write the line at line_index.
for( ; char_index < (std::min)(lcd_line_width, length); ++char_index)
{
- write(std::uint8_t(pstr[char_index]));
+ write(std::uint8_t { pstr[char_index] });
}
}
for( ; char_index < lcd_line_width; ++char_index)
{
- write(std::uint8_t(char(' ')));
+ write(std::uint8_t { ' ' });
}
return true;
diff --git a/ref_app/src/util/STL/span b/ref_app/src/util/STL/span
index 62fcd2bfd..1c5d121e3 100644
--- a/ref_app/src/util/STL/span
+++ b/ref_app/src/util/STL/span
@@ -27,7 +27,7 @@
using byte = unsigned char;
STL_LOCAL_CONSTEXPR std::size_t dynamic_extent =
- (std::numeric_limits::max)();
+ static_cast((std::numeric_limits::max)());
template