1
1
/* *
2
- * @file NexDownload .cpp
2
+ * @file NexUpload .cpp
3
3
*
4
4
* The implementation of download tft file for nextion.
5
5
*
13
13
* the License, or (at your option) any later version.
14
14
*/
15
15
16
- #include " NexDownload .h"
16
+ #include " NexUpload .h"
17
17
#include < SoftwareSerial.h>
18
18
19
19
// #define USE_SOFTWARE_SERIAL
@@ -32,19 +32,19 @@ SoftwareSerial dbSerial(3, 2); /* RX:D3, TX:D2 */
32
32
#define dbSerialBegin (a ) do {}while (0 )
33
33
#endif
34
34
35
- NexDownload::NexDownload (const char *file_name,const uint8_t SD_chip_select,uint32_t download_baudrate)
35
+ NexUpload::NexUpload (const char *file_name,const uint8_t SD_chip_select,uint32_t download_baudrate)
36
36
{
37
37
_file_name = file_name;
38
38
_SD_chip_select = SD_chip_select;
39
39
_download_baudrate = download_baudrate;
40
40
}
41
41
42
- NexDownload::NexDownload (const String file_Name,const uint8_t SD_chip_select,uint32_t download_baudrate)
42
+ NexUpload::NexUpload (const String file_Name,const uint8_t SD_chip_select,uint32_t download_baudrate)
43
43
{
44
- NexDownload (file_Name.c_str (),SD_chip_select,download_baudrate);
44
+ NexUpload (file_Name.c_str (),SD_chip_select,download_baudrate);
45
45
}
46
46
47
- void NexDownload::startDownload (void )
47
+ void NexUpload::upload (void )
48
48
{
49
49
dbSerialBegin (9600 );
50
50
if (!_checkFile ())
@@ -70,7 +70,7 @@ void NexDownload::startDownload(void)
70
70
dbSerialPrintln (" download ok\r\n " );
71
71
}
72
72
73
- uint16_t NexDownload ::_getBaudrate (void )
73
+ uint16_t NexUpload ::_getBaudrate (void )
74
74
{
75
75
uint32_t baudrate_array[7 ] = {115200 ,19200 ,9600 ,57600 ,38400 ,4800 ,2400 };
76
76
for (uint8_t i = 0 ; i < 7 ; i++)
@@ -85,7 +85,7 @@ uint16_t NexDownload::_getBaudrate(void)
85
85
return _baudrate;
86
86
}
87
87
88
- bool NexDownload ::_checkFile (void )
88
+ bool NexUpload ::_checkFile (void )
89
89
{
90
90
dbSerialPrintln (" start _checkFile" );
91
91
if (!SD.begin (_SD_chip_select))
@@ -105,7 +105,7 @@ bool NexDownload::_checkFile(void)
105
105
return 1 ;
106
106
}
107
107
108
- bool NexDownload ::_searchBaudrate (uint32_t baudrate)
108
+ bool NexUpload ::_searchBaudrate (uint32_t baudrate)
109
109
{
110
110
String string = String (" " );
111
111
nexSerial.begin (baudrate);
@@ -119,7 +119,7 @@ bool NexDownload::_searchBaudrate(uint32_t baudrate)
119
119
return 0 ;
120
120
}
121
121
122
- void NexDownload ::sendCommand (const char * cmd)
122
+ void NexUpload ::sendCommand (const char * cmd)
123
123
{
124
124
125
125
while (nexSerial.available ())
@@ -133,7 +133,7 @@ void NexDownload::sendCommand(const char* cmd)
133
133
nexSerial.write (0xFF );
134
134
}
135
135
136
- uint16_t NexDownload ::recvRetString (String &string, uint32_t timeout,bool recv_flag)
136
+ uint16_t NexUpload ::recvRetString (String &string, uint32_t timeout,bool recv_flag)
137
137
{
138
138
uint16_t ret = 0 ;
139
139
uint8_t c = 0 ;
@@ -167,7 +167,7 @@ uint16_t NexDownload::recvRetString(String &string, uint32_t timeout,bool recv_f
167
167
return ret;
168
168
}
169
169
170
- bool NexDownload ::_setDownloadBaudrate (uint32_t baudrate)
170
+ bool NexUpload ::_setDownloadBaudrate (uint32_t baudrate)
171
171
{
172
172
String string = String (" " );
173
173
String cmd = String (" " );
@@ -189,7 +189,7 @@ bool NexDownload::_setDownloadBaudrate(uint32_t baudrate)
189
189
return 0 ;
190
190
}
191
191
192
- bool NexDownload ::_downloadTftFile (void )
192
+ bool NexUpload ::_downloadTftFile (void )
193
193
{
194
194
uint8_t c;
195
195
uint16_t send_timer = 0 ;
0 commit comments