Official Arduino Library for DWIN DGUS T5L HMI Display.
Supporting Features till date:
getHWVersion()
restartHMI()
setPage()
getPage()
setBrightness()
getBrightness()
setVP()
setText()
beepHMI()
listenEvents()
Please use the component manager command add-dependency to add the dwin-hmi-esp
to your project's dependency, during the CMake step the component will be downloaded automatically.
idf.py add-dependency "hayschan/dwin-hmi-esp"
#include "DWIN.h"
Construct and initialize the DWIN hmi object with:
- UART port number
- RX pin
- TX pin
- Baud rate
// Create an instance of the DWIN class
DWIN hmi(UART_NUM_1, RX_PIN, TX_PIN, DGUS_BAUD);
// Event Occurs when response comes from HMI
void onHMIEvent(std::string address, int lastByte, std::string message, std::string response)
{
ESP_LOGI("HMIEvent", "OnEvent : [ A : %s | D : %02X | M : %s | R : %s ]", address.c_str(), lastByte, message.c_str(), response.c_str());
if (address == "1002") {
// Take your custom action call
}
}
hmi.echoEnabled(false);
hmi.hmiCallBack(onHMIEvent);
hmi.setPage(1);
Listen to HMI Events.
hmi.listen();