From d0b2e0c7ca60ea1f259f2d1212f6167e699836da Mon Sep 17 00:00:00 2001 From: Arjan van Vught Date: Fri, 19 May 2023 12:20:32 +0200 Subject: [PATCH] Minor code cleanup --- lib-display/include/i2c/display.h | 1 + lib-display/src/i2c/display.cpp | 10 ++++------ lib-display/src/i2c/hd44780.cpp | 2 +- lib-display/src/i2c/ssd1306.cpp | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib-display/include/i2c/display.h b/lib-display/include/i2c/display.h index 9c9583ade..700117078 100644 --- a/lib-display/include/i2c/display.h +++ b/lib-display/include/i2c/display.h @@ -36,6 +36,7 @@ #include #include "displayset.h" +#include "display7segment.h" #include "hal_i2c.h" #include "hardware.h" diff --git a/lib-display/src/i2c/display.cpp b/lib-display/src/i2c/display.cpp index 7ab8563f3..649b43b9a 100644 --- a/lib-display/src/i2c/display.cpp +++ b/lib-display/src/i2c/display.cpp @@ -41,9 +41,7 @@ #include "hal_i2c.h" -using namespace display; - -Display *Display::s_pThis = nullptr; +Display *Display::s_pThis; Display::Display() : m_nMillis(Hardware::Get()->Millis()), m_I2C(display::segment7::I2C_ADDRESS) { assert(s_pThis == nullptr); @@ -60,7 +58,7 @@ Display::Display() : m_nMillis(Hardware::Get()->Millis()), m_I2C(display::segmen Detect7Segment(); if (m_LcdDisplay != nullptr) { - timeout::gpio_init(); + display::timeout::gpio_init(); } PrintInfo(); @@ -75,7 +73,7 @@ Display::Display(uint32_t nRows) : m_nMillis(Hardware::Get()->Millis()), m_I2C(d Detect7Segment(); if (m_LcdDisplay != nullptr) { - timeout::gpio_init(); + display::timeout::gpio_init(); } PrintInfo(); @@ -90,7 +88,7 @@ Display::Display(display::Type type): m_tType(type), m_nMillis(Hardware::Get()-> Detect7Segment(); if (m_LcdDisplay != nullptr) { - timeout::gpio_init(); + display::timeout::gpio_init(); } PrintInfo(); diff --git a/lib-display/src/i2c/hd44780.cpp b/lib-display/src/i2c/hd44780.cpp index c1726a23a..070476ecd 100644 --- a/lib-display/src/i2c/hd44780.cpp +++ b/lib-display/src/i2c/hd44780.cpp @@ -128,7 +128,7 @@ void Hd44780::PutChar(int c) { void Hd44780::PutString(const char *pString) { const char *p = pString; - for (uint32_t i = 0; *p != '\0'; i++) { + while (*p != '\0') { Hd44780::PutChar(static_cast(*p)); p++; } diff --git a/lib-display/src/i2c/ssd1306.cpp b/lib-display/src/i2c/ssd1306.cpp index 58d0fab28..670e0c998 100644 --- a/lib-display/src/i2c/ssd1306.cpp +++ b/lib-display/src/i2c/ssd1306.cpp @@ -363,7 +363,7 @@ void Ssd1306::PutChar(int c) { void Ssd1306::PutString(const char *pString) { const char *p = pString; - for (uint32_t i = 0; *p != '\0'; i++) { + while (*p != '\0') { Ssd1306::PutChar(static_cast(*p)); p++; }