47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
|
#include <Arduino.h>
|
||
|
#include <ESPMegaPRO_OOP.hpp>
|
||
|
class ESPMegaDisplay
|
||
|
{
|
||
|
public:
|
||
|
ESPMegaDisplay(HardwareSerial *displayAdapter, ESPMegaPRO *espmega);
|
||
|
void begin();
|
||
|
void loop();
|
||
|
void reset();
|
||
|
void setBrightness(int value);
|
||
|
void jumpToPage(int page);
|
||
|
void setString(char* component, char* value);
|
||
|
void setNumber(char* component, int value);
|
||
|
char* getString(char* component);
|
||
|
int getNumber(char* component);
|
||
|
void bindInputPage(uint8_t card_id);
|
||
|
void bindOutputPage(uint8_t card_id);
|
||
|
void handlePwmStateChange(uint8_t pin, uint16_t value);
|
||
|
void handleInputStateChange(uint8_t pin, bool state);
|
||
|
void registerPushCallback(std::function<void(uint8_t, uint8_t)> callback);
|
||
|
void registerPopCallback(std::function<void(uint8_t, uint8_t)> callback);
|
||
|
void registerPageChangeCallback(std::function<void(uint8_t)> callback);
|
||
|
void unregisterPushCallback();
|
||
|
void unregisterPopCallback();
|
||
|
void unregisterPageChangeCallback();
|
||
|
private:
|
||
|
uint8_t inputCardId;
|
||
|
uint8_t outputCardId;
|
||
|
uint8_t currentPage;
|
||
|
uint8_t rx_buffer_index;
|
||
|
char rx_buffer[256];
|
||
|
char tx_buffer[256];
|
||
|
void recieveSerialCommand();
|
||
|
void processSerialCommand();
|
||
|
void processTouchPayload();
|
||
|
void processPageReportPayload();
|
||
|
void sendStopBytes();
|
||
|
void sendCommand(char* command);
|
||
|
void refreshPage();
|
||
|
void refreshInputPage();
|
||
|
void refreshOutputPage();
|
||
|
HardwareSerial *displayAdapter;
|
||
|
ESPMegaPRO *espmega;
|
||
|
std::function<void(uint8_t, uint8_t)> pushCallback;
|
||
|
std::function<void(uint8_t, uint8_t)> popCallback;
|
||
|
std::function<void(uint8_t)> pageChangeCallback;
|
||
|
};
|