lcd upload function
This commit is contained in:
parent
c0854fd6df
commit
91fb96f596
|
@ -35,3 +35,39 @@ void lcd_init()
|
||||||
delay(750);
|
delay(750);
|
||||||
#endif
|
#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;
|
||||||
|
}
|
|
@ -2,8 +2,13 @@
|
||||||
|
|
||||||
#include <ESPMegaPRO.h>
|
#include <ESPMegaPRO.h>
|
||||||
|
|
||||||
|
|
||||||
void lcd_send_stop_bit();
|
void lcd_send_stop_bit();
|
||||||
void lcd_send_command(String command);
|
void lcd_send_command(String command);
|
||||||
String lcd_wait_response();
|
String lcd_wait_response();
|
||||||
void lcd_reset();
|
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();
|
Loading…
Reference in New Issue