-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAddOnSerialBase.h
52 lines (42 loc) · 1.26 KB
/
AddOnSerialBase.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
41
42
43
44
45
46
47
48
49
50
51
#ifndef _ADDONSERIALBASE_H
#define _ADDONSERIALBASE_H
#include "Arduino.h"
#include "ESP8266WiFi.h"
#include "WiFiClient.h"
#include "SC16IS750.h"
#include "ESP8266WebServer.h"
#include "FS.h"
typedef void ProgressCallbackType(byte action, unsigned long offset, unsigned long maxValue, String message);
class AddOnSerialBase {
public:
AddOnSerialBase(SC16IS750 *expander, byte dtrPort, String hexFilename);
typedef void LogItemCallbackType(String, bool);
void Reset();
void SetLogItemCallback(LogItemCallbackType callback);
void Begin();
void SetBaudrate(unsigned long baudrate);
void SetProgressCallback(ProgressCallbackType* callback);
protected:
SC16IS750 *m_expander;
bool m_doLogging;
String m_log;
LogItemCallbackType *m_logItemCallback;
byte m_dtrPort;
ESP8266WebServer *m_server;
File m_uploadFile;
word m_currentPage;
unsigned long m_originalBaudRate;
bool m_isFlashing;
ProgressCallbackType *m_progressCallback;
String m_hexFilename;
void Log(String text, bool newLine = true);
void BeginFlash();
void Receive();
void SendBytes(byte count, ...);
void SendBytes(byte count, byte *data);
void FinishFlash();
void FlashFile(File *file);
void SendFile(File *file);
void SendPage(byte packet[128], byte size);
};
#endif