default: we only have one file open
This commit is contained in:
parent
cf9a19de17
commit
84d09d8fb9
|
@ -11,7 +11,7 @@ FATFS FatFs[_VOLUMES]; /* File system object for logical drive */
|
||||||
|
|
||||||
#define CONFIGLEN 2
|
#define CONFIGLEN 2
|
||||||
int lcdInitConfig(){
|
int lcdInitConfig(){
|
||||||
FIL file[2]; /* File objects */
|
FIL file; /* File objects */
|
||||||
BYTE buf[CONFIGLEN];
|
BYTE buf[CONFIGLEN];
|
||||||
UINT readbytes;
|
UINT readbytes;
|
||||||
int res;
|
int res;
|
||||||
|
@ -24,13 +24,13 @@ int lcdInitConfig(){
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
res=f_open(&file[0], "r0ket.cfg", FA_OPEN_EXISTING|FA_READ);
|
res=f_open(&file, "r0ket.cfg", FA_OPEN_EXISTING|FA_READ);
|
||||||
lcdPrint("open:");
|
lcdPrint("open:");
|
||||||
lcdPrintln(f_get_rc_string(res));
|
lcdPrintln(f_get_rc_string(res));
|
||||||
if(res){
|
if(res){
|
||||||
lcdPrintln("new r0ket.cfg...");
|
lcdPrintln("new r0ket.cfg...");
|
||||||
|
|
||||||
res=f_open(&file[0], "r0ket.cfg", FA_OPEN_ALWAYS|FA_WRITE);
|
res=f_open(&file, "r0ket.cfg", FA_OPEN_ALWAYS|FA_WRITE);
|
||||||
lcdPrint("create:");
|
lcdPrint("create:");
|
||||||
lcdPrintln(f_get_rc_string(res));
|
lcdPrintln(f_get_rc_string(res));
|
||||||
if(res){
|
if(res){
|
||||||
|
@ -39,7 +39,7 @@ int lcdInitConfig(){
|
||||||
|
|
||||||
buf[0]='0';
|
buf[0]='0';
|
||||||
buf[1]='0';
|
buf[1]='0';
|
||||||
res = f_write(&file[0], buf, 2, &readbytes);
|
res = f_write(&file, buf, 2, &readbytes);
|
||||||
lcdPrint("write:");
|
lcdPrint("write:");
|
||||||
lcdPrintln(f_get_rc_string(res));
|
lcdPrintln(f_get_rc_string(res));
|
||||||
if(res){
|
if(res){
|
||||||
|
@ -50,7 +50,7 @@ int lcdInitConfig(){
|
||||||
lcdPrintInt(readbytes);
|
lcdPrintInt(readbytes);
|
||||||
lcdPrintln("b");
|
lcdPrintln("b");
|
||||||
|
|
||||||
res=f_close(&file[0]);
|
res=f_close(&file);
|
||||||
lcdPrint("close:");
|
lcdPrint("close:");
|
||||||
lcdPrintln(f_get_rc_string(res));
|
lcdPrintln(f_get_rc_string(res));
|
||||||
if(res){
|
if(res){
|
||||||
|
@ -62,7 +62,7 @@ int lcdInitConfig(){
|
||||||
for(int i=0;i<CONFIGLEN;i++)
|
for(int i=0;i<CONFIGLEN;i++)
|
||||||
buf[i]=0;
|
buf[i]=0;
|
||||||
|
|
||||||
res = f_read(&file[0], buf, 2, &readbytes);
|
res = f_read(&file, buf, 2, &readbytes);
|
||||||
lcdPrint("read:");
|
lcdPrint("read:");
|
||||||
lcdPrintln(f_get_rc_string(res));
|
lcdPrintln(f_get_rc_string(res));
|
||||||
if(res){
|
if(res){
|
||||||
|
@ -79,7 +79,7 @@ int lcdInitConfig(){
|
||||||
if(buf[1] == '1')
|
if(buf[1] == '1')
|
||||||
lcdToggleFlag(LCD_MIRRORX);
|
lcdToggleFlag(LCD_MIRRORX);
|
||||||
|
|
||||||
res=f_close(&file[0]);
|
res=f_close(&file);
|
||||||
lcdPrint("close:");
|
lcdPrint("close:");
|
||||||
lcdPrintln(f_get_rc_string(res));
|
lcdPrintln(f_get_rc_string(res));
|
||||||
if(res){
|
if(res){
|
||||||
|
|
Loading…
Reference in New Issue