Merge branch 'master' of github.com:r0ket/r0ket

This commit is contained in:
schneider 2011-07-17 10:26:58 +02:00
commit 2e338dff8a
2 changed files with 35 additions and 4 deletions

View File

@ -28,8 +28,35 @@ int lcdInitConfig(){
lcdPrint("open:"); lcdPrint("open:");
lcdPrintln(f_get_rc_string(res)); lcdPrintln(f_get_rc_string(res));
if(res){ if(res){
lcdPrintln("r0ket.cfg missing!"); lcdPrintln("new r0ket.cfg...");
return 1;
res=f_open(&file[0], "r0ket.cfg", FA_OPEN_ALWAYS|FA_WRITE);
lcdPrint("create:");
lcdPrintln(f_get_rc_string(res));
if(res){
return 1;
};
buf[0]='0';
buf[1]='0';
res = f_write(&file[0], buf, 2, &readbytes);
lcdPrint("write:");
lcdPrintln(f_get_rc_string(res));
if(res){
return 1;
};
lcdPrint("wrote:");
lcdPrintInt(readbytes);
lcdPrintln("b");
res=f_close(&file[0]);
lcdPrint("close:");
lcdPrintln(f_get_rc_string(res));
if(res){
return 1;
};
return 2; // created. Still show screen
}; };
for(int i=0;i<CONFIGLEN;i++) for(int i=0;i<CONFIGLEN;i++)

View File

@ -67,12 +67,13 @@ void f_recv(void){
void f_send(void){ void f_send(void){
int ctr=1; int ctr=1;
__attribute__ ((aligned (4))) uint8_t buf[32]; __attribute__ ((aligned (4))) uint8_t buf[32];
int len;
int status; int status;
while(1){ while(1){
buf[0]=0x10; // Length: 16 bytes buf[0]=0x10; // Length: 16 bytes
buf[1]='C'; // Proto - fixed at 0x17? buf[1]='C'; // Proto
buf[2]=getInputRaw(); buf[2]=getInputRaw();
buf[3]=0x00; // Unused buf[3]=0x00; // Unused
@ -101,7 +102,10 @@ void f_send(void){
if(buf[2]==BTN_ENTER) if(buf[2]==BTN_ENTER)
break; break;
lcdDisplay(0); lcdDisplay(0);
delayms(10); len=nrf_rcv_pkt_time_encr(10,sizeof(buf),buf,testkey);
if(len>0){
lcdPrint("Got!");
};
}; };