Add debug view
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#define DATAFIELD_HPP
|
||||
|
||||
#include "touchgfx/TypedText.hpp"
|
||||
#include "touchgfx/Unicode.hpp"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -20,17 +21,51 @@ CountedEnum(DataFieldType, size_t, DF_TSState, DF_ASState, DF_ActiveMission,
|
||||
DF_TSSoC, DF_LVSoC, DF_TSCurrent, DF_TSVoltageBat, DF_TSVoltageVeh,
|
||||
DF_Speed, DF_BBal);
|
||||
|
||||
enum class DataFieldKind { Numeric, Bool, Text };
|
||||
enum class DataFieldKind { Float, Bool, Text, Int };
|
||||
|
||||
struct DataFieldDescription {
|
||||
DataFieldKind kind;
|
||||
touchgfx::TypedText title;
|
||||
const char *title;
|
||||
size_t int_digits;
|
||||
size_t decimal_digits;
|
||||
|
||||
void* (*getValue)(void);
|
||||
void *(*getValue)(void);
|
||||
};
|
||||
|
||||
extern DataFieldDescription dataFieldDescs[];
|
||||
|
||||
class DataField {
|
||||
public:
|
||||
virtual ~DataField() {}
|
||||
|
||||
void setType(DataFieldType type);
|
||||
DataFieldType getType();
|
||||
|
||||
virtual void updateValue();
|
||||
|
||||
protected:
|
||||
touchgfx::Unicode::UnicodeChar titleBuffer[16];
|
||||
touchgfx::Unicode::UnicodeChar valueBuffer[16];
|
||||
|
||||
DataFieldType type;
|
||||
const DataFieldDescription *desc;
|
||||
union {
|
||||
float f;
|
||||
int b;
|
||||
int i;
|
||||
} fieldValue;
|
||||
|
||||
virtual void typeUpdated() = 0;
|
||||
virtual void titleBufferUpdated() = 0;
|
||||
virtual void valueBufferUpdated() = 0;
|
||||
|
||||
private:
|
||||
void setFloatValue(float floatValue);
|
||||
void setBoolValue(int boolValue);
|
||||
void setIntValue(int intValue);
|
||||
void setStrValue(const char *strValue);
|
||||
|
||||
void updateValueBuffer();
|
||||
};
|
||||
|
||||
#endif // DATAFIELD_HPP
|
||||
|
||||
Reference in New Issue
Block a user