refactore
all components now have a base class compnent for loop functions
This commit is contained in:
2023-08-18 10:47:35 +02:00
parent 25d37e3970
commit 11d21e2e89
35 changed files with 303 additions and 511 deletions
+4 -7
View File
@@ -15,6 +15,7 @@
#include <iostream>
#include <LiquidCrystal_I2C.h>
#include <displayWrapper.h>
#include <component.h>
#define DISPLAY_WRAPPER_ROWS 16
#define DISPLAY_WRAPPER_LINES 2
@@ -28,7 +29,7 @@ typedef void (*LcdWrapperCallback) (const char data[][DISPLAY_WRAPPER_ROWS], uin
* The class takes the information to print from any thread. The
* loop function has to be called to print the data.
*/
class LcdWrapper : public DisplayWrapper {
class LcdWrapper : public DisplayWrapper, public Component {
public:
/**
* @brief Construct a new Lcd Wrapper object
@@ -37,12 +38,6 @@ class LcdWrapper : public DisplayWrapper {
*/
LcdWrapper(LiquidCrystal_I2C* lcd);
/**
* @brief Print the saved data
*
*/
void loop();
/**
* @brief Empty the buffer
*
@@ -67,6 +62,8 @@ class LcdWrapper : public DisplayWrapper {
private:
void run() override;
LiquidCrystal_I2C* lcd;
LcdWrapperCallback callback = nullptr;
char data[DISPLAY_WRAPPER_LINES][DISPLAY_WRAPPER_ROWS];