diff --git a/firmware/applications/default.c b/firmware/applications/default.c index 0c29759..ea52100 100644 --- a/firmware/applications/default.c +++ b/firmware/applications/default.c @@ -108,6 +108,7 @@ void tick_default(void) { EVERY(50,0){ + /* if(GLOBAL(chargeled)){ IOCON_PIO1_11 = 0x0; gpioSetDir(RB_LED3, gpioDirection_Output); @@ -116,6 +117,7 @@ void tick_default(void) { else gpioSetValue (RB_LED3, 0); }; + */ if(GetVoltage()<3600){ IOCON_PIO1_11 = 0x0; diff --git a/firmware/applications/serial/serial.c b/firmware/applications/serial/serial.c index 30ffae2..9e52869 100644 --- a/firmware/applications/serial/serial.c +++ b/firmware/applications/serial/serial.c @@ -415,9 +415,21 @@ static int process(char * input){ puts_plus(" "); puts_plus(IntToStrX( uint8ptouint32(buf+8),8 )); }else if(type=='b'){ - if(filter) + if(filter=='.' || filter=='u') if(uint8ptouint32(buf+8)!=uint8ptouint32(filterdata)) continue; + if(filter=='0' && buf[3] != 0x00) + continue; + if(filter=='5' && buf[3] != 0x55) + continue; + if(filter=='a' && buf[3] != 0xaa) + continue; + if(filter=='A' && buf[3] != 0xaa) + continue; + if(filter=='f' && buf[3] != 0xff) + continue; + if(filter=='F' && buf[3] != 0xff) + continue; puts_plus("R "); puts_plus(IntToStrX( buf[0],2 )); puts_plus(" "); diff --git a/firmware/basic/config.c b/firmware/basic/config.c index e0eba99..6ae9cdc 100644 --- a/firmware/basic/config.c +++ b/firmware/basic/config.c @@ -28,7 +28,7 @@ struct CDESC the_config[]= { {"flamemaxw", 255, 1, 255, 1, CFG_TYPE_FLAME}, {"flameminw", 0x8f, 1, 255, 1, CFG_TYPE_FLAME}, {"l0nick", 0, 0, 1 , 0, 0}, - {"chargeled", 0, 0, 1 , 0, 0}, + {"chargeled", 0, 0, 1 , 0, CFG_TYPE_GONE}, {"positionleds", 0, 0, 1 , 0, 0}, { NULL, 0, 0, 0 , 0, 0}, }; diff --git a/firmware/basic/config.h b/firmware/basic/config.h index e3a678f..299abb7 100644 --- a/firmware/basic/config.h +++ b/firmware/basic/config.h @@ -18,6 +18,7 @@ struct CDESC { #define CFG_TYPE_BASIC 0 #define CFG_TYPE_DEVEL 1 #define CFG_TYPE_FLAME 2 +#define CFG_TYPE_GONE 3 #define MAXNICK 17 extern struct CDESC the_config[]; diff --git a/firmware/l0dable/EXPORTS b/firmware/l0dable/EXPORTS index 42a8b76..d4936d2 100644 --- a/firmware/l0dable/EXPORTS +++ b/firmware/l0dable/EXPORTS @@ -104,14 +104,14 @@ systickGetTicks uint32touint8p uint8ptouint32 #Add stuff here -o_init -o_path_new -o_move_to -o_line_to -o_curve_to -o_close -o_set_gray -o_fill -o_set_shader -o_identity -o_transform +#o_init +#o_path_new +#o_move_to +#o_line_to +#o_curve_to +#o_close +#o_set_gray +#o_fill +#o_set_shader +#o_identity +#o_transform diff --git a/firmware/l0dable/Makefile b/firmware/l0dable/Makefile index 121c4f5..dfffde4 100644 --- a/firmware/l0dable/Makefile +++ b/firmware/l0dable/Makefile @@ -24,9 +24,13 @@ LDSRCFILE=ram.ld LDFILE=loadable.ld CFLAGS+=-mlong-calls -fno-toplevel-reorder -CRYPT=cp +DOCRYPT=0 +CRYPT=../../tools/crypto/xxtea CRYPTFLAGS=-p +skey=`cd .. && ./getkey.pl l0dable_sign` +ekey=`cd .. && ./getkey.pl l0dable_crypt` + all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int debug.int $(LDFILE): @@ -47,7 +51,13 @@ $(LDFILE): $(OBJCOPY) $(OCFLAGS) -O binary $< $@ %.c0d: %.bin - $(CRYPT) $(CRYPTFLAGS) $< $@ +ifeq "$(DOCRYPT)" "1" + $(CRYPT) -e -k $(ekey) -o $<.tmp $< + $(CRYPT) -s -k $(skey) -o $@ $<.tmp + rm -f $<.tmp +else + cp $< $@ +endif %.nik: .PHONY @a=$@;a=nick_$${a%.nik}.c0d;echo mv $$a $@;mv $$a $@ diff --git a/firmware/l0dable/rockets.c b/firmware/l0dable/rockets.c.disabled similarity index 99% rename from firmware/l0dable/rockets.c rename to firmware/l0dable/rockets.c.disabled index 6eb9c0a..fe291b3 100644 --- a/firmware/l0dable/rockets.c +++ b/firmware/l0dable/rockets.c.disabled @@ -27,6 +27,7 @@ void ram (void) int angle; int scale; int velocity = 0; + frame_no=0; while ((inpt = getInputRaw()) != BTN_ENTER) { diff --git a/firmware/l0dable/showlcd.c b/firmware/l0dable/showlcd.c new file mode 100644 index 0000000..fc6b72a --- /dev/null +++ b/firmware/l0dable/showlcd.c @@ -0,0 +1,67 @@ +#include + +#include "basic/basic.h" +#include "lcd/lcd.h" +#include "lcd/print.h" +#include "filesystem/ff.h" + +#include "usetable.h" + +//shows *.lcd +void ram(void) +{ + char filename[13]; + char key; + int i=500; + + // Image or Animation? + lcdClear(); + lcdPrintln("Image | Anim?"); + lcdPrintln("Up=Image"); + lcdPrintln("Down=Anim"); + lcdRefresh(); + key = getInputWait(); + delayms(230); + + // Show file + if( key == BTN_DOWN ){ + // Choose animation speed + while ( key != BTN_ENTER ){ + lcdClear(); + lcdPrintln("Choose speed:"); + lcdPrintln(""); + lcdPrint(" "); + lcdPrint(IntToStr(i,5,0)); + lcdPrintln("ms"); + lcdRefresh(); + key = getInputWait(); + if ( key == BTN_UP ){ + if ( i < 60000 ) + i+=10; + } else if ( key == BTN_DOWN ){ + if ( i > 10 ) + i-=10; + } + delayms(100); + } + // Select file + lcdClear(); + delayms(230); + selectFile(filename,"LCD"); + // Load as animation + lcdShowAnim(filename, i); + } else if ( key == BTN_UP ){ + // Select file + lcdClear(); + delayms(230); + selectFile(filename,"LCD"); + // Load as image + lcdLoadImage(filename); + lcdRefresh(); + } else { + // Exit + return; + } + getInputWait(); +} + diff --git a/firmware/l0dable/snake.c b/firmware/l0dable/snake.c new file mode 100644 index 0000000..9422712 --- /dev/null +++ b/firmware/l0dable/snake.c @@ -0,0 +1,194 @@ +#include +#include "basic/basic.h" +#include "basic/config.h" + +#include "lcd/lcd.h" +#include "lcd/print.h" +#include "usetable.h" + +struct elem +{ + int x,y; +}; + +void reset(struct elem snake[],size_t *snake_size,int *dirc, +int*speed, int*points,int*point_s); +void o_rectangle (int x0, int y0, int width, int height); +struct elem rnd(void); + +#define MAX_SNAKE_LEN (40) +#define SNAKE_DEM (3) +#define MIN_SPEED (25) +#define MAX_SPEED (3) +#define SIZE_X (RESX) +#define SIZE_Y (RESY) + +void ram(void) +{ + int inpt,dirc,c,grows = 0,dx,dy,points,point_s=1; + size_t n = 0, snake_size = 5, speed=MIN_SPEED; + struct elem snake[MAX_SNAKE_LEN], food; + char test[512]; /* scratch space */ + o_init (test, sizeof(test)); + + reset(snake,&snake_size,&dirc,&speed,&points,&point_s); + + food = rnd(); + + while (1) + { + head: + if(!(++c % speed)) + { + + +inpt = getInputRaw(); + +dx=DoString(0,0,IntToStrX(points,2)); + dx=(SIZE_X-dx)/2; + if(dx<0) + dx=0; + dy=(SIZE_Y-getFontHeight())/2; + + lcdFill(255); + o_rectangle(1,0,SIZE_X-2,SIZE_Y-2); + o_set_gray (0); + o_fill (); + + //o_identity (); /* reset tranforms */ + + o_set_gray (50); + + setExtFont("UBUNTU29"); + + lcdSetPixel(1,1,1); + DoString(dx,dy,IntToStrX(points,2)); + + o_set_gray (255); + + + for(n=0;n SIZE_Y/SNAKE_DEM-1 || +t.x > SIZE_X/SNAKE_DEM) + { + reset(snake,&snake_size,&dirc,&speed,&points,&point_s); + goto head; + } + + for(n=0;n MAX_SPEED) --speed; + food = rnd(); + } + } + + if(!grows) + { + for(n=0;n