-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNextionFirmware.h
40 lines (33 loc) · 1.06 KB
/
NextionFirmware.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef __NEXTIONFIRMWARE_H__
#define __NEXTIONFIRMWARE_H__
#include <Arduino.h>
#include <NeoICSerial.h>
class NextionFirmware
{
public:
NextionFirmware(NeoICSerial * nextion);
bool upload_init(uint32_t fwsize,uint32_t download_baudrate);
long upload_chunk(Stream* stream,long bytes);
bool wait_acknowledge(Stream* stream);
void sendCommand(const char* cmd);
void send0Command();
NeoICSerial* _nextion;
bool _searchBaudrate(uint32_t baudrate);
void DebugOut(const char *msg);
static bool bdebug;
void SerialDbgRecv();
private:
uint32_t _getBaudrate(void);
bool _setDownloadBaudrate(uint32_t baudrate);
uint16_t recvRetString( uint32_t timeout = 100L,bool ack_flag = false);
private: /* data */
static uint32_t _baudrate; /*nextion serail baudrate*/
static uint32_t _fwsize; /*undownload byte of tft file*/
static uint32_t _download_baudrate; /*download baudrate*/
static char recv[180];
static int recv_len;
};
/**
* @}
*/
#endif /* #ifndef __NEXTIONFIRMWARE_H__ */