Merge git://github.com/r0ket/r0ket

This commit is contained in:
bernd 2011-08-04 02:20:02 +02:00
commit e39bed8182
11 changed files with 109 additions and 14 deletions

View File

@ -71,6 +71,21 @@ $(LOBJ):
OBJS += $(LOBJ)
endif
ifeq "$(APP)" "l0dable"
ifndef LAPP
LAPP=blinktest
endif
LSRC=../l0dable/$(LAPP).c
LOBJ=l0dable_$(LAPP).o
.PHONY: $(LOBJ)
$(LOBJ):
$(CC) $(CFLAGS) -o $@ $(LSRC)
OBJS += $(LOBJ)
endif
ifeq "$(wildcard $(APP))" "$(APP)"
ifndef TYPE
TYPE=$(APP)

View File

@ -151,7 +151,6 @@ void init_flame(void) {
#include "lcd/print.h"
//# MENU debug ChkFlame
void ChkFlame(void) {
do{
lcdClear();

View File

@ -199,6 +199,15 @@ void m_choose(){
lcdPrint(":");
lcdPrint(IntToStr(tm->tm_sec,2,F_LONG|F_ZEROS));
lcdNl();
if(tmm[i]=='T'){
lcdPrint(IntToStr(tm->tm_mday,2,F_LONG));
lcdPrint(".");
lcdPrint(IntToStr(tm->tm_mon+1,2,0));
lcdPrint(".");
lcdPrint(IntToStr(tm->tm_year+YEAR0,4,F_LONG|F_ZEROS));
lcdNl();
};
};
char *foo=(char *)MO_BODY(meshbuffer[j].pkt);
while(strlen(foo)>13){

View File

@ -0,0 +1,43 @@
#include <sysinit.h>
#include <string.h>
#include "basic/basic.h"
#include "lcd/lcd.h"
#include "lcd/print.h"
#include "usb/usbmsc.h"
/**************************************************************************/
void gotoISP(void) {
DoString(0,0,"Enter ISP!");
lcdDisplay();
ISPandReset();
}
void msc_menu(void){
DoString(0,8,"MSC Enabled.");
lcdDisplay();
usbMSCInit();
while(!getInputRaw())delayms(10);
DoString(0,16,"MSC Disabled.");
usbMSCOff();
};
extern void (*ram)(void);
static const struct MENU mainmenu = {"Mainmenu", {
{"Run Loadable", &ram},
{"Invoke ISP", &gotoISP},
{"MSC", &msc_menu},
{NULL,NULL}
}};
/**************************************************************************/
void main_l0dable(void) {
lcdClear();
lcdDisplay();
handleMenu(&mainmenu);
gotoISP();
};

View File

@ -3,6 +3,7 @@
for a in $* ; do
case $a in
loadable_*) continue;;
l0dable_*) continue;;
*/*) continue;;
esac
base=${a%.o}
@ -16,6 +17,7 @@ echo "void wrapper(void){"
for a in $* ; do
case $a in
loadable_*) continue;;
l0dable_*) continue;;
*/*) continue;;
esac
base=${a%.o}
@ -29,6 +31,7 @@ echo "void tick_wrapper(void){"
for a in $* ; do
case $a in
loadable_*) continue;;
l0dable_*) continue;;
*/*) continue;;
esac
base=${a%.o}

View File

@ -65,3 +65,5 @@ meshGetMessage
nickname
uint32touint8p
uint8ptouint32
memset
nrf_config_set

View File

@ -27,7 +27,6 @@ void uuid(void);
static const struct MENU submenu_debug={ "debug", {
{ "ChkBattery", &ChkBattery},
// { "ChkFlame", &ChkFlame},
{ "ChkLight", &ChkLight},
{ "MeshInfo", &m_time},
{ "Qstatus", &Qstatus},
@ -118,10 +117,10 @@ void uuid(void) {
iap_return = iapReadSerialNumber();
lcdClear();
lcdPrintln("UUID:");
lcdPrintIntHex(iap_return.Result[0]); lcdNl();
lcdPrintIntHex(iap_return.Result[1]); lcdNl();
lcdPrintIntHex(iap_return.Result[2]); lcdNl();
lcdPrintIntHex(iap_return.Result[3]); lcdNl();
lcdPrintln(IntToStrX(iap_return.Result[0],8));
lcdPrintln(IntToStrX(iap_return.Result[1],8));
lcdPrintln(IntToStrX(iap_return.Result[2],8));
lcdPrintln(IntToStrX(iap_return.Result[3],8));
lcdNl();
lcdPrintln("Beacon ID:");
lcdPrintln(IntToStrX(GetUUID32(),8));
@ -227,4 +226,3 @@ void m_time(void){
delayms_queue(50);
}while ((getInputRaw())==BTN_NONE);
};

View File

@ -24,9 +24,20 @@
uint8_t mac[5] = {1,2,3,2,1};
struct NRF_CFG config = {
.channel= 81,
.txmac= "\x1\x2\x3\x2\x1",
.nrmacs=1,
.mac0= "\x1\x2\x3\x2\x1",
.maclen ="\x20",
};
void ram(void)
{
memset(0,0,0);
nrf_config_set(&config);
if( sendKeys() )
return;

View File

@ -30,12 +30,23 @@
//#include "lcd/print.h"
void sendFile(char *filename);
uint8_t mac[5] = {1,2,3,2,1};
struct NRF_CFG config = {
.channel= 81,
.txmac= "\x1\x2\x3\x2\x1",
.nrmacs=1,
.mac0= "\x1\x2\x3\x2\x1",
.maclen ="\x20",
};
void ram(void)
{
nrf_config_set(&config);
char file[13];
selectFile(file,"TXT");
sendFile(file);
@ -43,7 +54,8 @@ void ram(void)
void sendR(uint8_t *rx, uint8_t *ry)
{
uint8_t exp[2 + 4*NUMWORDS + 2];
//uint8_t exp[2 + 4*NUMWORDS + 2];
uint8_t exp[32];
exp[0] = 'R';
for(int i=0; i<4*NUMWORDS; i++)
exp[2+i] = rx[i];
@ -54,6 +66,7 @@ void sendR(uint8_t *rx, uint8_t *ry)
for(int i=0; i<4*NUMWORDS; i++)
exp[2+i] = ry[i];
nrf_snd_pkt_crc(32, exp);
delayms(10);
}

View File

@ -1,3 +1,4 @@
size_t strlen(const char *s);
char * strcpy(char * restrict dst, const char * restrict src);
void * memcpy(void *dst, const void *src, size_t len);
char strcpy(char * restrict dst, const char * restrict src);
void memcpy(void *dst, const void *src, size_t len);
void memset(void *s, int c, size_t n);

View File

@ -432,9 +432,9 @@ int DoInt(int sx, int sy, int num){
#undef mxlen
};
#define MAX 8
int DoIntXn(int sx, int sy, unsigned int num, unsigned int mxlen){
char s[(mxlen+1)];
char * o=s;
char s[(MAX+1)];
int len;
s[mxlen]=0;
for (len=(mxlen-1);len>=0;len--){
@ -443,8 +443,9 @@ int DoIntXn(int sx, int sy, unsigned int num, unsigned int mxlen){
s[len]+='A'-'9'-1;
num/=16;
};
return DoString(sx,sy,o);
return DoString(sx,sy,s);
};
#undef MAX
int DoIntX(int sx, int sy, unsigned int num){
return DoIntXn(sx, sy, num, 8);