37 lines
923 B
C++
37 lines
923 B
C++
#ifndef LCDDISPLAY_HPP
|
|
#define LCDDISPLAY_HPP
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
class LCDDisplay {
|
|
private:
|
|
uint8_t _lcd;
|
|
char linebuf[4][40];
|
|
void writeStr(std::string str); // do not use
|
|
void writeLines(std::array<std::string, 4> lines); // do not use
|
|
|
|
public:
|
|
LCDDisplay(std::string dev, uint32_t baud = 0010002); // from termios-baud.h, B115200
|
|
~LCDDisplay();
|
|
|
|
// custom char array
|
|
char cc[8] = {'\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7'};
|
|
|
|
void clear();
|
|
|
|
void setContrast(uint8_t contrast);
|
|
void setBacklight(bool enabled);
|
|
void setCursor(uint8_t row, uint8_t col);
|
|
void setCustomChar(uint8_t index, std::array<uint8_t, 8> cchar);
|
|
|
|
void writeBuf(uint8_t row, uint8_t col, std::string str);
|
|
void clearBuf();
|
|
void flushBuf();
|
|
|
|
char bar(uint8_t char_id, double value);
|
|
};
|
|
|
|
#endif |