From 81815b1eef1d0a4f4562c7401ae6ed885d6bffe5 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 00:21:20 +0200 Subject: [PATCH 1/4] Try to be more iggy-friendly --- firmware/l0dable/Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/firmware/l0dable/Makefile b/firmware/l0dable/Makefile index c97d8de..3799bb0 100644 --- a/firmware/l0dable/Makefile +++ b/firmware/l0dable/Makefile @@ -5,6 +5,8 @@ SRCS = $(wildcard *.c) OBJS = $(foreach mod,$(SRCS),$(subst .c,.o,$(mod))) ELFS = $(foreach mod,$(SRCS),$(subst .c,.elf,$(mod))) BINS = $(foreach mod,$(SRCS),$(subst .c,.bin,$(mod))) +CODS = $(foreach mod,$(SRCS),$(subst .c,.c0d,$(mod))) +NIKS = $(foreach mod,$(wildcard nick_*.c),$(subst .c,.nik,$(subst nick_,,$(mod)))) ########################################################################## # GNU GCC compiler flags @@ -22,7 +24,10 @@ LDSRCFILE=ram.ld LDFILE=loadable.ld CFLAGS+=-mlong-calls -fno-toplevel-reorder -all: $(OBJS) $(ELFS) $(BINS) +CRYPT=cp +CRYPTFLAGS=-p + +all: $(OBJS) $(ELFS) $(BINS) $(CODS) $(NIKS) 1boot.int $(LDFILE): -@echo "MEMORY" > $(LDFILE) @@ -41,6 +46,15 @@ $(LDFILE): %.bin: %.elf $(OBJCOPY) $(OCFLAGS) -O binary $< $@ +%.c0d: %.bin + $(CRYPT) $(CRYPTFLAGS) $< $@ + +%.nik: .PHONY + @a=$@;a=nick_$${a%.nik}.c0d;echo mv $$a $@;mv $$a $@ + +1boot.int: 1boot.c0d .PHONY + mv $< $@ + clean: rm -f *.o *.elf *.bin usetable.h From c2d7656a1e903339a46056a620be9e2864bcc2fd Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 00:24:50 +0200 Subject: [PATCH 2/4] Make getInputWaitTimeout use microseconds --- firmware/basic/keyin.c | 2 +- firmware/basic/menu.c | 2 +- firmware/l0dable/invaders.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firmware/basic/keyin.c b/firmware/basic/keyin.c index cc4cecb..fc51ac5 100644 --- a/firmware/basic/keyin.c +++ b/firmware/basic/keyin.c @@ -54,7 +54,7 @@ uint8_t getInputWaitTimeout(int timeout) { uint8_t key; if(timeout==0) return getInputWait(); - int end=_timectr+timeout*(1000/SYSTICKSPEED); + int end=_timectr+timeout/SYSTICKSPEED; while ((key=getInputRaw())==BTN_NONE){ if(_timectr>end) break; diff --git a/firmware/basic/menu.c b/firmware/basic/menu.c index b4824f0..fc1fe48 100644 --- a/firmware/basic/menu.c +++ b/firmware/basic/menu.c @@ -46,7 +46,7 @@ void handleMenu(const struct MENU *the_menu) { } lcdRefresh(); - switch (getInputWaitTimeout((menuflags&MENU_TIMEOUT)?15:0)) { + switch (getInputWaitTimeout((menuflags&MENU_TIMEOUT)?15000:0)) { case BTN_UP: menuselection--; if (menuselection < current_offset) { diff --git a/firmware/l0dable/invaders.c b/firmware/l0dable/invaders.c index c2f6062..e405664 100644 --- a/firmware/l0dable/invaders.c +++ b/firmware/l0dable/invaders.c @@ -127,7 +127,7 @@ static bool screen_intro() { DoString (0, 9, highnick); lcdDisplay(); step = !step; - key=getInputWaitTimeout(1); + key=getInputWaitTimeout(1000); } return !(key==BTN_LEFT); } @@ -142,7 +142,7 @@ static bool screen_gameover() { if (highscore_set(game.score, GLOBAL(nickname))) DoString (0,9,"HIGHSCORE!"); lcdDisplay(); - key=getInputWaitTimeout(5); + key=getInputWaitTimeout(5000); } return !(key==BTN_LEFT); } From 09eb3b0ea1440afceb4ec4f2877f1f727db66113 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 00:26:39 +0200 Subject: [PATCH 3/4] Make exiting easier --- firmware/lcd/image.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firmware/lcd/image.c b/firmware/lcd/image.c index 6d6b90a..3356197 100644 --- a/firmware/lcd/image.c +++ b/firmware/lcd/image.c @@ -34,7 +34,11 @@ uint8_t lcdShowAnim(char *fname, uint32_t framems) { continue; }; lcdDisplay(); - state=delayms_queue_plus(framems,0); + if(framems<100){ + state=delayms_queue_plus(framems,0); + }else{ + getInputWaitTimeout(framems); + }; } if(state) From ccb45a6fc2448b6f48bdeec554d6699293d5083f Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Fri, 5 Aug 2011 00:34:55 +0200 Subject: [PATCH 4/4] nick-loadable to display nick.lcd by default --- firmware/l0dable/.gitignore | 3 +++ firmware/l0dable/EXPORTS | 2 ++ firmware/l0dable/nick_image.c | 12 ++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 firmware/l0dable/nick_image.c diff --git a/firmware/l0dable/.gitignore b/firmware/l0dable/.gitignore index ca79c34..47ffa2a 100644 --- a/firmware/l0dable/.gitignore +++ b/firmware/l0dable/.gitignore @@ -2,3 +2,6 @@ *.bin usetable.h loadable.ld +*.nik +*.c0d +*.int diff --git a/firmware/l0dable/EXPORTS b/firmware/l0dable/EXPORTS index b3a3e8d..dcc9397 100644 --- a/firmware/l0dable/EXPORTS +++ b/firmware/l0dable/EXPORTS @@ -84,3 +84,5 @@ readFile writeFile input saveConfig +lcdShowAnim +lcdLoadImage diff --git a/firmware/l0dable/nick_image.c b/firmware/l0dable/nick_image.c new file mode 100644 index 0000000..4f395df --- /dev/null +++ b/firmware/l0dable/nick_image.c @@ -0,0 +1,12 @@ +#include + +#include "basic/basic.h" +#include "lcd/lcd.h" +#include "filesystem/ff.h" + +#include "usetable.h" + +void ram(void) { + char fname[FILENAMELEN]; + lcdShowAnim("nick.lcd",1000); +};