Save data from serial port to file in flash memory.
Note: This function can't run in commands set.
This function will finish writing data to file until:
Warning: If the file name already exist in flash memory, this operation will over write the old one.
Direct: |
"fSAVEfilename ",following with 3 bytes MSB of file length(bytes) |
Arduino: |
char saveFile(const char *fname, uint8_t *data) |
C: |
char Digole_saveFile(const char *fname, uint8_t *data) |
fname
Specify the file name in flash memory.
data
The pointer to data string going to be saved.
Return value 17 when finishing file writing. Can be used to determine if writing finished, then send other commands to display
uint8_t data[]={......};
mydisp.saveFile("hello.txt",data);
serial.writeString("fSAVEhello.txt ");
serial.write(0xff); //MSB of length, can be the maximum value if don't know the accurate length
serial.write(0xff);
serial.write(0xff); //LSB of length
for(char i=0;i<64;i++){
serial.write(i);
}
delay(300); //this delay will terminate the writing to file, and the file length of "hello.txt" only 64 bytes, the file contents are 0~64
Version | Description |
---|---|
V7 | function was added. |