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

This commit is contained in:
schneider 2011-07-17 02:03:08 +02:00
commit bc3fa885f5
2 changed files with 83 additions and 6 deletions

View File

@ -1,8 +1,67 @@
#include <sysinit.h>
#include "basic/basic.h"
#include "lcd/lcd.h"
#include "lcd/print.h"
#include "filesystem/ff.h"
/**************************************************************************/
FATFS FatFs[_VOLUMES]; /* File system object for logical drive */
#define CONFIGLEN 2
int lcdInitConfig(){
FIL file[2]; /* File objects */
BYTE buf[CONFIGLEN];
UINT readbytes;
int res;
lcdFill(0); // clear display buffer
res=f_mount(0, &FatFs[0]);
lcdPrint("mount:");
lcdPrintln(f_get_rc_string(res));
if(res){
return 1;
};
res=f_open(&file[0], "r0ket.cfg", FA_OPEN_EXISTING|FA_READ);
lcdPrint("open:");
lcdPrintln(f_get_rc_string(res));
if(res){
lcdPrintln("r0ket.cfg missing!");
return 1;
};
for(int i=0;i<CONFIGLEN;i++)
buf[i]=0;
res = f_read(&file[0], buf, 2, &readbytes);
lcdPrint("read:");
lcdPrintln(f_get_rc_string(res));
if(res){
return 1;
};
lcdPrint("r: ");
lcdPrintCharHex(buf[0]);
lcdPrintCharHex(buf[1]);
lcdNl();
if(buf[0] == '1')
lcdToggleFlag(LCD_INVERTED);
if(buf[1] == '1')
lcdToggleFlag(LCD_MIRRORX);
res=f_close(&file[0]);
lcdPrint("close:");
lcdPrintln(f_get_rc_string(res));
if(res){
return 1;
};
return 0;
};
void main_default(void) {
systickInit(10);
@ -10,6 +69,15 @@ void main_default(void) {
ISPandReset(7);
};
font=&Font_7x8;
if(lcdInitConfig()){
lcdDisplay(0);
getInputWait();
}else{
lcdDisplay(0);
delayms(300);
};
return;
};

View File

@ -6,14 +6,12 @@
#include "lcd/print.h"
#include "funk/nrf24l01p.h"
#include "usb/usbmsc.h"
#include <string.h>
/**************************************************************************/
#define CHANNEL_BEACON 81
#define MAC_BEACON "\x1\x2\x3\x2\1"
uint32_t const testkey[4] = {
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff
};
@ -23,9 +21,9 @@ void f_init(void){
struct NRF_CFG config = {
.channel= 81,
.txmac= "\x1\x2\x3\x2\x1",
.txmac= "REMOT",
.nrmacs=1,
.mac0= "\x1\x2\x3\x2\x1",
.mac0= "REMOT",
.maclen ="\x10",
};
@ -132,6 +130,15 @@ void adc_check(void) {
dx=DoString(0,dy,"Done.");
};
void msc_menu(void){
DoString(0,8,"MSC Enabled.");
lcdDisplay(0);
usbMSCInit();
while(!getInputRaw())delayms(10);
DoString(0,16,"MSC Disabled.");
usbMSCOff();
};
/**************************************************************************/
const struct MENU_DEF menu_ISP = {"Invoke ISP", &gotoISP};
@ -141,6 +148,7 @@ const struct MENU_DEF menu_snd = {"F Send", &f_send};
//const struct MENU_DEF menu_cfg = {"F Cfg", &f_cfg};
const struct MENU_DEF menu_mirror = {"Mirror", &lcd_mirror};
const struct MENU_DEF menu_volt = {"Akku", &adc_check};
const struct MENU_DEF menu_msc = {"MSC", &msc_menu};
const struct MENU_DEF menu_nop = {"---", NULL};
static menuentry menu[] = {
@ -151,6 +159,8 @@ static menuentry menu[] = {
&menu_nop,
&menu_mirror,
&menu_volt,
&menu_msc,
&menu_nop,
&menu_ISP,
NULL,
};
@ -159,7 +169,6 @@ static const struct MENU mainmenu = {"Mainmenu", menu};
void main_remote(void) {
backlightInit();
font=&Font_7x8;
while (1) {