lcd upload function

This commit is contained in:
Siwat Sirichai 2023-11-13 15:11:10 +07:00
parent c0854fd6df
commit 91fb96f596
2 changed files with 42 additions and 1 deletions

View File

@ -34,4 +34,40 @@ void lcd_init()
lcd_reset();
delay(750);
#endif
}
bool lcd_upload_start(size_t size)
{
Serial.begin(115200);
lcd_send_stop_bit();
Serial.print("rest");
lcd_send_stop_bit();
Serial.print("connect");
lcd_send_stop_bit();
delay(1000);
Serial.print("whmi-wri 1024,115200,res0");
lcd_send_stop_bit();
lcd_wait_ack();
}
bool lcd_upload_write(uint8_t *data, size_t size)
{
for (int i = 0; i < size; i++)
{
Serial.write(data[i]);
}
}
bool lcd_wait_ack()
{
bool data_ok = false;
for (int i; i < 50; i++)
{
if (Serial.read() == 0x05)
{
data_ok = true;
break;
}
delay(100);
}
return data_ok;
}

View File

@ -2,8 +2,13 @@
#include <ESPMegaPRO.h>
void lcd_send_stop_bit();
void lcd_send_command(String command);
String lcd_wait_response();
void lcd_reset();
void lcd_init();
void lcd_init();
bool lcd_upload_start(size_t size);
bool lcd_upload_write(uint8_t* data, size_t size);
bool lcd_wait_ack();