Skip to content

Commit 989c220

Browse files
committed
modify library name to upload
1 parent d3c7a02 commit 989c220

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

NexDownload.cpp renamed to NexUpload.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file NexDownload.cpp
2+
* @file NexUpload.cpp
33
*
44
* The implementation of download tft file for nextion.
55
*
@@ -13,7 +13,7 @@
1313
* the License, or (at your option) any later version.
1414
*/
1515

16-
#include "NexDownload.h"
16+
#include "NexUpload.h"
1717
#include <SoftwareSerial.h>
1818

1919
//#define USE_SOFTWARE_SERIAL
@@ -32,19 +32,19 @@ SoftwareSerial dbSerial(3, 2); /* RX:D3, TX:D2 */
3232
#define dbSerialBegin(a) do{}while(0)
3333
#endif
3434

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)
3636
{
3737
_file_name = file_name;
3838
_SD_chip_select = SD_chip_select;
3939
_download_baudrate = download_baudrate;
4040
}
4141

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)
4343
{
44-
NexDownload(file_Name.c_str(),SD_chip_select,download_baudrate);
44+
NexUpload(file_Name.c_str(),SD_chip_select,download_baudrate);
4545
}
4646

47-
void NexDownload::startDownload(void)
47+
void NexUpload::upload(void)
4848
{
4949
dbSerialBegin(9600);
5050
if(!_checkFile())
@@ -70,7 +70,7 @@ void NexDownload::startDownload(void)
7070
dbSerialPrintln("download ok\r\n");
7171
}
7272

73-
uint16_t NexDownload::_getBaudrate(void)
73+
uint16_t NexUpload::_getBaudrate(void)
7474
{
7575
uint32_t baudrate_array[7] = {115200,19200,9600,57600,38400,4800,2400};
7676
for(uint8_t i = 0; i < 7; i++)
@@ -85,7 +85,7 @@ uint16_t NexDownload::_getBaudrate(void)
8585
return _baudrate;
8686
}
8787

88-
bool NexDownload::_checkFile(void)
88+
bool NexUpload::_checkFile(void)
8989
{
9090
dbSerialPrintln("start _checkFile");
9191
if(!SD.begin(_SD_chip_select))
@@ -105,7 +105,7 @@ bool NexDownload::_checkFile(void)
105105
return 1;
106106
}
107107

108-
bool NexDownload::_searchBaudrate(uint32_t baudrate)
108+
bool NexUpload::_searchBaudrate(uint32_t baudrate)
109109
{
110110
String string = String("");
111111
nexSerial.begin(baudrate);
@@ -119,7 +119,7 @@ bool NexDownload::_searchBaudrate(uint32_t baudrate)
119119
return 0;
120120
}
121121

122-
void NexDownload::sendCommand(const char* cmd)
122+
void NexUpload::sendCommand(const char* cmd)
123123
{
124124

125125
while (nexSerial.available())
@@ -133,7 +133,7 @@ void NexDownload::sendCommand(const char* cmd)
133133
nexSerial.write(0xFF);
134134
}
135135

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)
137137
{
138138
uint16_t ret = 0;
139139
uint8_t c = 0;
@@ -167,7 +167,7 @@ uint16_t NexDownload::recvRetString(String &string, uint32_t timeout,bool recv_f
167167
return ret;
168168
}
169169

170-
bool NexDownload::_setDownloadBaudrate(uint32_t baudrate)
170+
bool NexUpload::_setDownloadBaudrate(uint32_t baudrate)
171171
{
172172
String string = String("");
173173
String cmd = String("");
@@ -189,7 +189,7 @@ bool NexDownload::_setDownloadBaudrate(uint32_t baudrate)
189189
return 0;
190190
}
191191

192-
bool NexDownload::_downloadTftFile(void)
192+
bool NexUpload::_downloadTftFile(void)
193193
{
194194
uint8_t c;
195195
uint16_t send_timer = 0;

NexDownload.h renamed to NexUpload.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* @file NexDownload.h
2+
* @file NexUpload.h
33
*
4-
* The definition of class NexDownload.
4+
* The definition of class NexUpload.
55
*
66
* @author Chen Zengpeng (email:<zengpeng.chen@itead.cc>)
77
* @date 2016/3/29
@@ -13,8 +13,8 @@
1313
* published by the Free Software Foundation; either version 2 of
1414
* the License, or (at your option) any later version.
1515
*/
16-
#ifndef __NEXDOWNLOAD_H__
17-
#define __NEXDOWNLOAD_H__
16+
#ifndef __NEXUPLOAD_H__
17+
#define __NEXUPLOAD_H__
1818
#include <Arduino.h>
1919
#include <SPI.h>
2020
#include <SD.h>
@@ -29,7 +29,7 @@
2929
*
3030
* Provides the API for nextion to download the ftf file.
3131
*/
32-
class NexDownload
32+
class NexUpload
3333
{
3434
public: /* methods */
3535

@@ -40,7 +40,7 @@ class NexDownload
4040
* @param SD_chip_select - sd chip select pin.
4141
* @download_baudrate - set download baudrate.
4242
*/
43-
NexDownload(const char *file_name,const uint8_t SD_chip_select,uint32_t download_baudrate);
43+
NexUpload(const char *file_name,const uint8_t SD_chip_select,uint32_t download_baudrate);
4444

4545
/**
4646
* Constructor.
@@ -49,20 +49,20 @@ class NexDownload
4949
* @param SD_chip_select - sd chip select pin.
5050
* @download_baudrate - set download baudrate.
5151
*/
52-
NexDownload(const String file_Name,const uint8_t SD_chip_select,uint32_t download_baudrate);
52+
NexUpload(const String file_Name,const uint8_t SD_chip_select,uint32_t download_baudrate);
5353

5454
/**
5555
* destructor.
5656
*
5757
*/
58-
~NexDownload(){}
58+
~NexUpload(){}
5959

6060
/*
6161
* start download.
6262
*
6363
* @return none.
6464
*/
65-
void startDownload();
65+
void upload();
6666

6767
private: /* methods */
6868

examples/Download/Download.ino renamed to examples/Upload/Upload.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "NexDownload.h"
2-
NexDownload nex_download("nex.tft",10,115200);
2+
NexUpload nex_download("nex.tft",10,115200);
33
void setup() {
44
// put your setup code here, to run once:
5-
nex_download.startDownload();
5+
nex_download.upload();
66
}
77

88
void loop() {

0 commit comments

Comments
 (0)