From eb884543da99f34195d1827c2b189d63a7acc536 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sun, 17 Jul 2011 02:00:02 +0200 Subject: [PATCH 1/2] Add support for r0ket.cfg (invert & mirror flags for now) --- firmware/applications/default.c | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/firmware/applications/default.c b/firmware/applications/default.c index 5f3826f..f104b0b 100644 --- a/firmware/applications/default.c +++ b/firmware/applications/default.c @@ -1,8 +1,68 @@ #include #include "basic/basic.h" +#include "lcd/lcd.h" +#include "lcd/print.h" +#include "filesystem/ff.h" +#include "usb/usbmsc.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 Date: Sun, 17 Jul 2011 02:01:51 +0200 Subject: [PATCH 2/2] Add MSC for convenience. Also change MAC --- firmware/applications/remote.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/firmware/applications/remote.c b/firmware/applications/remote.c index 5472be2..6dec093 100644 --- a/firmware/applications/remote.c +++ b/firmware/applications/remote.c @@ -6,14 +6,12 @@ #include "lcd/print.h" #include "funk/nrf24l01p.h" +#include "usb/usbmsc.h" #include /**************************************************************************/ -#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) {