diff --git a/firmware/applications/cbitset.h b/firmware/applications/cbitset.h new file mode 100644 index 0000000..4e76b82 --- /dev/null +++ b/firmware/applications/cbitset.h @@ -0,0 +1,53 @@ +#ifndef CBITFIELD_H +#define CBITFIELD_H + +#define BITSETCHUNKSIZE 32 + +#define one ((uint32_t)1) + +struct bitset { + uint16_t size; + uint32_t bits[BITSET_SIZE/BITSETCHUNKSIZE+1]; +}; + +static inline void bitset_set(struct bitset *bs,uint16_t index, uint8_t value) { + uint16_t base=index/BITSETCHUNKSIZE; + uint16_t offset=index%BITSETCHUNKSIZE; + if(value) { + bs->bits[base]|=(one<bits[base]&=~(one<bits[base]^=(one<bits[base]&(one<=RESY) y=RESY-1; - }else if (key ==BTN_LEFT){ + }; + if (key & BTN_LEFT){ --x;//if(--x<0) x=0; - }else if (key ==BTN_RIGHT){ + }; + if (key & BTN_RIGHT){ ++x;//if(++x>=RESX) x=RESX-1; - }else if (key ==BTN_ENTER){ + }; + if (key == BTN_ENTER){ lcdClear(); lcdPrintln("Done."); lcdDisplay(); diff --git a/firmware/applications/life.c b/firmware/applications/life.c new file mode 100644 index 0000000..bafee14 --- /dev/null +++ b/firmware/applications/life.c @@ -0,0 +1,202 @@ +#include + +#include "basic/basic.h" + +//#include "lcd/render.h" +#include "lcd/display.h" +//#include "lcd/allfonts.h" + +#define BITSET_X (RESX+2) +#define BITSET_Y (RESY+2) +#define BITSET_SIZE (BITSET_X*BITSET_Y) + +#include "cbitset.h" + +typedef uint8_t uchar; + +unsigned char rnd1(); + +void draw_rect(char x0, char y0, char x1, char y1) { + for(char x=x0; x<=x1; ++x) { + lcdSetPixel(x,y0,true); + lcdSetPixel(x,y1,true); + } + for(char y=y0+1; y1); - lcdSetPixel(x, y, pixel); + //p=fixpt(mandel.rmin+y*rs); + //q=fixpt(mandel.imin+x*is); + p=mandel.rmin+y*rs; + q=mandel.imin+x*is; + + rn=0; + r0=0; + i0=0; + iteration=0; + while ((mul(rn,rn)+mul(i0,i0))1); + lcdSetPixel(x, y, pixel); +} + +void mandelUpdate() { + int xmin,xmax,ymin,ymax; + if (mandel.dirty) { + xmin = 0; + xmax = RESX; + ymin = 0; + ymax = RESY; + mandel.dirty = false; + } else if (mandel.dleft) { + lcdShift(1,0,false); + xmin = 0; + xmax = 1; + ymin = 0; + ymax = RESY; + mandel.dleft = false; + } else if (mandel.dright) { + lcdShift(-1,0,false); + xmin = RESX-1; + xmax = RESX; + ymin = 0; + ymax = RESY; + mandel.dright = false; + } else if (mandel.dup) { + lcdShift(0,-1,true); + xmin=0; + xmax=RESX; + ymin=0; + ymax=1; + mandel.dup = false; + } else if (mandel.ddown) { + lcdShift(0,1,true); + xmin=0; + xmax=RESX; + ymin=RESY-1; + ymax=RESY; + mandel.ddown = false; + } else { + return; + } + + for (int x = xmin; x #include "basic/basic.h" -uint8_t getInput(void) { - uint8_t result = BTN_NONE; - - if (gpioGetValue(RB_BTN3)==0) { - while(gpioGetValue(RB_BTN3)==0); - result += BTN_UP; - } - - if (gpioGetValue(RB_BTN2)==0) { - while(gpioGetValue(RB_BTN2)==0); - result += BTN_DOWN; - } - - if (gpioGetValue(RB_BTN4)==0) { - while(gpioGetValue(RB_BTN4)==0); - result += BTN_ENTER; - } - - if (gpioGetValue(RB_BTN0)==0) { - while(gpioGetValue(RB_BTN0)==0); - result += BTN_LEFT; - } - - if (gpioGetValue(RB_BTN1)==0) { - while(gpioGetValue(RB_BTN1)==0); - result += BTN_RIGHT; - } - - return result; -} - uint8_t getInputRaw(void) { uint8_t result = BTN_NONE; if (gpioGetValue(RB_BTN3)==0) { - result += BTN_UP; + result |= BTN_UP; } if (gpioGetValue(RB_BTN2)==0) { - result += BTN_DOWN; + result |= BTN_DOWN; } if (gpioGetValue(RB_BTN4)==0) { - result += BTN_ENTER; + result |= BTN_ENTER; } if (gpioGetValue(RB_BTN0)==0) { - result += BTN_LEFT; + result |= BTN_LEFT; } if (gpioGetValue(RB_BTN1)==0) { - result += BTN_RIGHT; + result |= BTN_RIGHT; } return result; } +uint8_t getInput(void) { + uint8_t key = BTN_NONE; + + key=getInputRaw(); + if(key != BTN_NONE) + while(key==getInputRaw()); // Wait for any release + + return key; +} + uint8_t getInputWait(void) { uint8_t key; while ((key=getInput())==BTN_NONE) diff --git a/firmware/lcd/display.c b/firmware/lcd/display.c index e18fdaf..ca08074 100644 --- a/firmware/lcd/display.c +++ b/firmware/lcd/display.c @@ -1,3 +1,5 @@ +#include + #include #include #include "lpc134x.h" @@ -167,88 +169,86 @@ void lcdShiftH(bool right, bool wrap) { if (right) { tmp = lcdBuffer[yb*RESX]; memmove(lcdBuffer + yb*RESX,lcdBuffer + yb*RESX+1 ,RESX-1); - if (wrap) lcdBuffer[yb*RESX+(RESX-1)] = tmp; + lcdBuffer[yb*RESX+(RESX-1)] = wrap?tmp:0; } else { tmp = lcdBuffer[yb*RESX+(RESX-1)]; memmove(lcdBuffer + yb*RESX+1,lcdBuffer + yb*RESX ,RESX-1); - if (wrap) lcdBuffer[yb*RESX] = tmp; + lcdBuffer[yb*RESX] = wrap?tmp:0; } } } void lcdShiftV8(bool up, bool wrap) { uint8_t tmp[RESX]; - if (up) { - if (wrap) memmove(tmp, lcdBuffer, RESX); + if (!up) { + if (wrap) + memmove(tmp, lcdBuffer, RESX); + else + memset(tmp,0,RESX); memmove(lcdBuffer,lcdBuffer+RESX ,RESX*(RESY_B-1)); - if (wrap) memmove(lcdBuffer+RESX*(RESY_B-1),tmp,RESX); + memmove(lcdBuffer+RESX*(RESY_B-1),tmp,RESX); } else { - if (wrap) memmove(tmp, lcdBuffer+RESX*(RESY_B-1), RESX); + if (wrap) + memmove(tmp, lcdBuffer+RESX*(RESY_B-1), RESX); + else + memset(tmp,0,RESX); memmove(lcdBuffer+RESX,lcdBuffer ,RESX*(RESY_B-1)); - if (wrap) memmove(lcdBuffer,tmp,RESX); + memmove(lcdBuffer,tmp,RESX); } } void lcdShiftV(bool up, bool wrap) { uint8_t tmp[RESX]; if (up) { - if (wrap) memmove(tmp,lcdBuffer+((RESY_B-1)*RESX),RESX); + if (wrap) + memmove(tmp,lcdBuffer+((RESY_B-1)*RESX),RESX); + else + memset(tmp,0,RESX); for (int x = 0; x 0; y--){ lcdBuffer[x+(y*RESX)] = (lcdBuffer[x+(y*RESX)] << 1) |( lcdBuffer[x+((y-1)*RESX)] >> 7); } - if (wrap) lcdBuffer[x] = ( lcdBuffer[x] << 1) | ((tmp[x]>>3)&1); + lcdBuffer[x] = ( lcdBuffer[x] << 1) | ((tmp[x]>>3)&1); } } else { - if (wrap) memmove(tmp,lcdBuffer,RESX); + if (wrap) + memmove(tmp,lcdBuffer,RESX); + else + memset(tmp,0,RESX); for (int x = 0; x> 1) |( lcdBuffer[x+((y+1)*RESX)] << 7); } - if (wrap) lcdBuffer[x+((RESY_B-1)*RESX)] = ( lcdBuffer[x+((RESY_B-1)*RESX)] >> 1) | ((tmp[x]<<3)&8); + lcdBuffer[x+((RESY_B-1)*RESX)] = ( lcdBuffer[x+((RESY_B-1)*RESX)] >> 1) | ((tmp[x]<<3)&8); } } } void lcdShift(int x, int y, bool wrap) { - int yb, yr, ya; - bool dir; + bool dir=true; - if (x>0) { - for (int cx = 0; cx < x; cx++) { - lcdShiftH(true, wrap); - } - } else if (x<0) { - for (int cx = x; cx < 0; cx++) { - lcdShiftH(false, wrap); - } - } + if(x<0){ + dir=false; + x=-x; + }; + while(x-->0) + lcdShiftH(dir, wrap); - if (y != 0) { - if (y>0) { - ya = y; - yb = y/8; - yr = y%8; - dir = true; - - } else if (y<0) { - ya = -y; - yb = (-y)/8; - yr = (-y)%8; - dir = false; - } - - //for (int cyb = 0; cyb < yb; cyb++) { - // lcdShiftV8(dir, wrap); - //} - //for (int cyr = 0; cyr < yr; cyr++) { - // lcdShiftV(dir, wrap); - //} - for (int cya = 0; cya < ya; cya++) { + if(y<0){ + dir=false; + y=-y; + }else{ + dir=true; + }; + + while(y>=8){ + y-=8; + lcdShiftV8(dir, wrap); + }; + + while(y-->0) lcdShiftV(dir, wrap); - } - } } diff --git a/firmware/lcd/print.c b/firmware/lcd/print.c index 6eb241e..8466283 100644 --- a/firmware/lcd/print.c +++ b/firmware/lcd/print.c @@ -6,7 +6,15 @@ int x=0; int y=0; +void checkScroll(void){ + if(y+font->u8Height>RESY){ + lcdShift(0,y+font->u8Height-RESY,false); + y=RESY-font->u8Height; + }; +}; + void lcdPrint(const char *string){ + checkScroll(); x=DoString(x,y,string); }; @@ -20,18 +28,22 @@ void lcdPrintln(const char *string){ }; void lcdPrintInt(const int num){ + checkScroll(); x=DoInt(x,y,num); }; void lcdPrintIntHex(const int num){ + checkScroll(); x=DoIntX(x,y,num); }; void lcdPrintCharHex(const uint8_t num){ + checkScroll(); x=DoCharX(x,y,num); }; void lcdPrintShortHex(const uint16_t num){ + checkScroll(); x=DoShortX(x,y,num); }; diff --git a/simulat0r/bin/update-bridge-files.sh b/simulat0r/bin/update-bridge-files.sh index 5d74ef4..f278dc5 100755 --- a/simulat0r/bin/update-bridge-files.sh +++ b/simulat0r/bin/update-bridge-files.sh @@ -5,6 +5,13 @@ true # echo $1 } +if test ! -d simulat0r/firmware -o ! -d firmware +then +echo ERROR: +echo This script must be run from toplevel r0ket directory +exit +fi + echo "Updating directories" for i in `find firmware/ -type d ` do @@ -14,7 +21,7 @@ else mkdir -v simulat0r/$i fi done -echo "Updating bridge files" +echo "Updating bridge files for C source" for i in `find firmware/ \! -path firmware/lcd/allfonts.h -type f -iname \*.[ch]` do if test -f simulat0r/$i; @@ -25,3 +32,15 @@ do (printf "/* AUTOGENERATED SOURCE FILE */\n"; echo \#include \"`dirname $i | sed "s#[^/]*#..#g" `/../$i\") >simulat0r/$i fi done + +echo "Updating bridge files for Makefiles" +for i in `find firmware/ -type f -iname Makefile` +do + if test -f simulat0r/$i; + then + verbmsg "OK File already exists: $i" + else + echo Writing bridge file simulat0r/$i + (printf "# GENERATED INCLUDE BRIDGE/\n"; echo include `dirname $i | sed "s#[^/]*#..#g" `/../$i) >simulat0r/$i + fi +done diff --git a/simulat0r/firmware/Makefile b/simulat0r/firmware/Makefile index dd71a3a..3c50af5 100644 --- a/simulat0r/firmware/Makefile +++ b/simulat0r/firmware/Makefile @@ -1,108 +1,4 @@ -VPATH = -OBJS = main.o - -########################################################################## -# Project-specific files -########################################################################## - -VPATH += -OBJS += -OBJS += basic/basic.o basic/reinvoke_isp.o basic/delayms.o basic/voltage.o -OBJS += basic/keyin.o basic/uuid.o -LIBS += core/libcore.a lcd/liblcd.a applications/libapp.a filesystem/libfat.a usb/libusb.a - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH = . -INCLUDE_PATHS = -I$(ROOT_PATH) -I$(ROOT_PATH)/core - -include $(ROOT_PATH)/Makefile.inc - -LDFLAGS+= -Wl,--gc-sections -VPATH += lpc1xxx -OBJS += $(TARGET)_handlers.o LPC1xxx_startup.o - -########################################################################## -# Startup files -########################################################################## -LDLIBS = -lm -LDLIBS += -Lapplications -lapp -LDLIBS += -Lfunk -lfunk -LDLIBS += -Lusbcdc -lusbcdc -LDLIBS += -Lfilesystem -lfat -LDLIBS += -Lbasic -lbasic -LDLIBS += -Llcd -llcd -LDLIBS += -Lcore -lcore -LDLIBS += -Lusb -lusb - - -LD_PATH = lpc1xxx -LD_SCRIPT = $(LD_PATH)/linkscript.ld -LD_TEMP = $(LD_PATH)/memory.ld - -### User targets: - -all: $(OUTFILE).bin - -protect: $(OUTFILE).bin - $(LPCFIX) -p 2 $(OUTFILE).bin - -loadables: $(OUTFILE).bin - @cd loadable && $(MAKE) - -clean: - rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex - @cd core && $(MAKE) clean -# @cd ../tools/bootloader && $(MAKE) clean - @cd lcd && $(MAKE) clean - @cd applications && $(MAKE) clean - @cd filesystem && $(MAKE) clean - @cd usb && $(MAKE) clean - @cd loadable && $(MAKE) clean - -### Internal targets - -%.o : %.c - $(CC) $(CFLAGS) -o $@ $< - -core/libcore.a: core/projectconfig.h - cd core && $(MAKE) ROOT_PATH=../$(ROOT_PATH) - -lcd/liblcd.a lcd/render.o lcd/display.o: - cd lcd && $(MAKE) ROOT_PATH=../$(ROOT_PATH) - -applications/libapp.a: - cd applications && $(MAKE) ROOT_PATH=../$(ROOT_PATH) - -filesystem/libfat.a: - cd filesystem && $(MAKE) ROOT_PATH=../$(ROOT_PATH) - -usb/libusb.a: - cd usb && $(MAKE) ROOT_PATH=../$(ROOT_PATH) - -../tools/bootloader/lpcfix: -# cd ../tools/bootloader && $(MAKE) - -$(LD_TEMP): - -@echo "MEMORY" > $(LD_TEMP) - -@echo "{" >> $(LD_TEMP) - -@echo " flash(rx): ORIGIN = 0x00000000, LENGTH = $(FLASH)" >> $(LD_TEMP) - -@echo " sram(rwx): ORIGIN = 0x10000000+$(SRAM_USB), LENGTH = $(SRAM)-$(SRAM_USB)-$(RAMCODE)" >> $(LD_TEMP) - -@echo "}" >> $(LD_TEMP) - -@echo "INCLUDE $(LD_SCRIPT)" >> $(LD_TEMP) - -.IGNORE: $(OUTFILE).elf -$(OUTFILE).elf: $(OBJS) $(SYS_OBJS) $(LIBS) $(LPCFIX) $(LD_TEMP) - $(CC) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS) - -@echo "" -# $(SIZE) $(OUTFILE).elf -# -@echo "" - -%.bin: %.elf -# $(OBJCOPY) $(OCFLAGS) -O binary $< $@ - -@echo "" -# $(LPCFIX) -c $@ - -.PHONY: $(LD_TEMP) lcd/liblcd.a applications/libapp.a filesystem/libfat.a usb/libusb.a +# GENERATED INCLUDE BRIDGE/ +include ../../firmware/Makefile +.IGNORE: $(OUTFILE).elf $(OUTFILE).bin diff --git a/simulat0r/firmware/applications/Makefile b/simulat0r/firmware/applications/Makefile index 6d034d3..adbca02 100644 --- a/simulat0r/firmware/applications/Makefile +++ b/simulat0r/firmware/applications/Makefile @@ -1,66 +1,2 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -OBJS = default.o -OBJS += $(foreach mod,$(APP),$(mod).o) - -SRCS = $(foreach mod,$(APP),$(mod).c) - -ifndef APP -ME_OBJ=$(USERNAME) - -ifeq "$(ME_OBJ)" "" -ME_OBJ=$(USER) -endif - -ifeq "$(ME_OBJ)" "" -ME_OBJ=nouser -endif - -OBJS += $(ME_OBJ).o -endif - -WRAP=wrapper -LIBNAME=app - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH?= .. -INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. - -include $(ROOT_PATH)/Makefile.inc - -WRAPOBJ=$(WRAP).o -WRAPSRC=$(WRAP).c -LIBFILE=lib$(LIBNAME).a - -########################################################################## -# Compiler settings, parameters and flags -########################################################################## - -all: $(LIBFILE) - -$(LIBFILE): $(OBJS) $(WRAPOBJ) - $(AR) rcs $@ $(OBJS) $(WRAPOBJ) - -%.o : %.c - $(CC) $(CFLAGS) -o $@ $< - -clean: - rm -f $(OBJS) $(WRAPOBJ) $(WRAPSRC) $(LIBFILE) *.o - -%.c: - @echo - @echo "You need to create $@ first" - @echo "It should contain a single function void main_filename(void)" - @echo - @exit 1 - -$(WRAPSRC): - ./mkwrapper $(OBJS) > $@ - -.PHONY: $(LIBFILE) $(WRAPSRC) $(SRCS) - -.SUFFIXES: +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/applications/Makefile diff --git a/simulat0r/firmware/applications/cbitset.h b/simulat0r/firmware/applications/cbitset.h new file mode 100644 index 0000000..913a87e --- /dev/null +++ b/simulat0r/firmware/applications/cbitset.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/cbitset.h" diff --git a/simulat0r/firmware/applications/flame.c b/simulat0r/firmware/applications/flame.c new file mode 100644 index 0000000..2b63c47 --- /dev/null +++ b/simulat0r/firmware/applications/flame.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/flame.c" diff --git a/simulat0r/firmware/applications/loadable.c b/simulat0r/firmware/applications/loadable.c new file mode 100644 index 0000000..1700a51 --- /dev/null +++ b/simulat0r/firmware/applications/loadable.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/loadable.c" diff --git a/simulat0r/firmware/basic/Makefile b/simulat0r/firmware/basic/Makefile new file mode 100644 index 0000000..64a786e --- /dev/null +++ b/simulat0r/firmware/basic/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/basic/Makefile diff --git a/simulat0r/firmware/basic/xxtea.c b/simulat0r/firmware/basic/xxtea.c index 77604be..c315d35 100644 --- a/simulat0r/firmware/basic/xxtea.c +++ b/simulat0r/firmware/basic/xxtea.c @@ -1,2 +1,4 @@ -/* AUTOGENERATED SOURCE FILE */ +/* use SAFE version instead of ARM asm */ +#define SAFE + #include "../../../firmware/basic/xxtea.c" diff --git a/simulat0r/firmware/core/Makefile b/simulat0r/firmware/core/Makefile index ec1df9e..f85ccd8 100644 --- a/simulat0r/firmware/core/Makefile +++ b/simulat0r/firmware/core/Makefile @@ -1,56 +1,2 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -# The target, flash and ram of the LPC1xxx microprocessor. -# Use for the target the value: LPC11xx, LPC13xx or LPC17xx -TARGET = LPC13xx - -OBJS = sysinit.o -OBJS += adc/adc.o -#OBJS += cmd/cmd.o -OBJS += cpu/cpu.o -OBJS += gpio/gpio.o -OBJS += i2c/i2c.o -OBJS += iap/iap.o -OBJS += libc/ctype.o -OBJS += libc/stdio.o -OBJS += libc/string.o -OBJS += pmu/pmu.o -#OBJS += pwm/pwm.o -OBJS += ssp/ssp.o -OBJS += systick/systick.o -OBJS += timer16/timer16.o -OBJS += timer32/timer32.o -#OBJS += uart/uart.o -#OBJS += uart/uart_buf.o -#OBJS += usbcdc/cdcuser.o -#OBJS += usbcdc/cdc_buf.o -#OBJS += usbcdc/usbcore.o -#OBJS += usbcdc/usbdesc.o -#OBJS += usbcdc/usbhw.o -#OBJS += usbcdc/usbuser.o -OBJS += wdt/wdt.o - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH?= .. -INCLUDE_PATHS = -I$(ROOT_PATH) -I. - -include $(ROOT_PATH)/Makefile.inc - -########################################################################## -# Compiler settings, parameters and flags -########################################################################## - -all: libcore.a - -libcore.a: $(OBJS) - $(AR) rcs libcore.a $(OBJS) - -%.o : %.c projectconfig.h - $(CC) $(CFLAGS) -o $@ $< - -clean: - rm -f $(OBJS) libcore.a +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/core/Makefile diff --git a/simulat0r/firmware/core/i2c/i2c.c b/simulat0r/firmware/core/i2c/i2c.c index 6a27b27..cca2ebc 100644 --- a/simulat0r/firmware/core/i2c/i2c.c +++ b/simulat0r/firmware/core/i2c/i2c.c @@ -1,2 +1,34 @@ -/* AUTOGENERATED SOURCE FILE */ -#include "../../../../firmware/core/i2c/i2c.c" + +// dummy implementation instead of #include "../../../../firmware/core/i2c/i2c.c" + + +#include "i2c.h" + +volatile uint32_t I2CMasterState = I2CSTATE_IDLE; +volatile uint32_t I2CSlaveState = I2CSTATE_IDLE; + +volatile uint8_t I2CMasterBuffer[I2C_BUFSIZE]; +volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE]; +volatile uint32_t I2CReadLength; +volatile uint32_t I2CWriteLength; + +volatile uint32_t RdIndex = 0; +volatile uint32_t WrIndex = 0; + + +void I2C_IRQHandler(void) { +} + +uint32_t i2cInit( uint32_t I2cMode ) { + return( TRUE ); +} + +uint32_t i2cEngine( void ) { + return I2CSTATE_IDLE; +} + +/****************************************************************************** +** End Of File +******************************************************************************/ + + diff --git a/simulat0r/firmware/filesystem/Makefile b/simulat0r/firmware/filesystem/Makefile index 76b2d19..b6fed1f 100644 --- a/simulat0r/firmware/filesystem/Makefile +++ b/simulat0r/firmware/filesystem/Makefile @@ -1,30 +1,2 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -OBJS = - -OBJS += ff.o -OBJS += diskio.o -OBJS += iobase.o -OBJS += mmc.o -OBJS += at45db041d.o -OBJS += util.o -OBJS += select.o -OBJS += execute.o - -LIBNAME=fat - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH?= .. -INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. - -include $(ROOT_PATH)/Makefile.inc - -########################################################################## -# Actual work -########################################################################## - -include $(ROOT_PATH)/Makefile.util +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/filesystem/Makefile diff --git a/simulat0r/firmware/funk/Makefile b/simulat0r/firmware/funk/Makefile index dd2a593..e5dba98 100644 --- a/simulat0r/firmware/funk/Makefile +++ b/simulat0r/firmware/funk/Makefile @@ -1,25 +1,2 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -OBJS = - -OBJS += nrf24l01p.o -OBJS += rftransfer.o -OBJS += filetransfer.o - -LIBNAME=funk - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH?= .. -INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. - -include $(ROOT_PATH)/Makefile.inc - -########################################################################## -# Actual work -########################################################################## - -include $(ROOT_PATH)/Makefile.util +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/funk/Makefile diff --git a/simulat0r/firmware/lcd/Makefile b/simulat0r/firmware/lcd/Makefile index fe639a3..d17981e 100644 --- a/simulat0r/firmware/lcd/Makefile +++ b/simulat0r/firmware/lcd/Makefile @@ -1,45 +1,2 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -OBJS = - -OBJS += display.o -OBJS += render.o -OBJS += decoder.o -OBJS += backlight.o -OBJS += print.o - -FONTS = $(basename $(wildcard fonts/*.c)) - -LIBNAME=lcd - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH?= .. -INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. - -include $(ROOT_PATH)/Makefile.inc - -FOBJS= $(foreach ft,$(FONTS),$(ft).o) -OBJS+= $(FOBJS) - -########################################################################## -# Actual work -########################################################################## - -include $(ROOT_PATH)/Makefile.util - -all: allfonts.h - -$(FOBJS): $(foreach ft,$(FONTS),$(ft).h) fonts.h - -clean:: - rm -f fonts/*.o allfonts.h - touch allfonts.h - -.PHONY: allfonts.h - -allfonts.h: - (echo "#include ";for a in $(FONTS) ; do echo "#include "; done) > $@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/lcd/Makefile diff --git a/simulat0r/firmware/lcd/display.c b/simulat0r/firmware/lcd/display.c index 8e12c67..de1d975 100644 --- a/simulat0r/firmware/lcd/display.c +++ b/simulat0r/firmware/lcd/display.c @@ -1,56 +1,14 @@ -#if 0 -#include "../firmware/lcd/display.c" -#else +#define lcdDisplay _hideaway_lcdDisplay +#define lcdInit _hideaway_lcdInit +#include "../../../firmware/lcd/display.c" +#undef lcdDisplay +#undef lcdInit -#include "../firmware/lcd/display.h" #include "simulator.h" -uint8_t lcdBuffer[RESX*RESY_B]; -int lcd_layout = 0; -const int TYPE_DATA=0; - - -void lcdInit(void) { - fprintf(stderr,"lcdInit(void)\n"); -} - - -void lcdFill(char f){ - int x; - for(x=0;x $(LDFILE) - -@echo "{" >> $(LDFILE) - -@echo " sram(rwx): ORIGIN = 0x10002000 - $(RAMCODE), LENGTH = $(RAMCODE)" >> $(LDFILE) - -@echo "}" >> $(LDFILE) - -@echo "INCLUDE $(LDSRCFILE)" >> $(LDFILE) - -%.o : %.c - $(CC) $(CFLAGS) -o $@ $< - -%.elf: %.o $(FIRMWARE) $(LDFILE) - $(LD) $(LDFLAGS) -T $(LDFILE) -o $@ $< - $(SIZE) $@ - -%.bin: %.elf - $(OBJCOPY) $(OCFLAGS) -O binary $< $@ - -%.h: %.bin $(DIR)/bin2h.pl - $(DIR)/bin2h.pl $< - -clean: - cd $(DIR) && rm -f *.o *.elf *.bin - -.SUFFIXES: - -.PHONY: $(LDFILE) diff --git a/simulat0r/firmware/usb/Makefile b/simulat0r/firmware/usb/Makefile index d54ddf3..76d0639 100644 --- a/simulat0r/firmware/usb/Makefile +++ b/simulat0r/firmware/usb/Makefile @@ -1,36 +1,2 @@ -########################################################################## -# User configuration and firmware specific object files -########################################################################## - -OBJS = - -OBJS += usbconfig.o -OBJS += usbhid.o -OBJS += usbmsc.o - -LIBNAME=usb - -########################################################################## -# GNU GCC compiler flags -########################################################################## -ROOT_PATH?= .. -INCLUDE_PATHS = -I$(ROOT_PATH) -I../core -I. - -include $(ROOT_PATH)/Makefile.inc - -LIBFILE=lib$(LIBNAME).a -########################################################################## -# Compiler settings, parameters and flags -########################################################################## - -all: $(LIBFILE) - -$(LIBFILE): $(OBJS) - $(AR) rcs $@ $(OBJS) - -%.o : %.c - $(CC) $(CFLAGS) -o $@ $< - -clean: - rm -f $(OBJS) $(LIBFILE) - +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/usb/Makefile diff --git a/simulat0r/firmware/usbcdc/Makefile b/simulat0r/firmware/usbcdc/Makefile new file mode 100644 index 0000000..2bb4268 --- /dev/null +++ b/simulat0r/firmware/usbcdc/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/usbcdc/Makefile diff --git a/simulat0r/gui/CMakeLists.txt b/simulat0r/gui/CMakeLists.txt index 0bb9087..f209214 100644 --- a/simulat0r/gui/CMakeLists.txt +++ b/simulat0r/gui/CMakeLists.txt @@ -7,6 +7,10 @@ link_directories(${CMAKE_CURRENT_BINARY_DIR} ../../firmware/applications ../../firmware/filesystem ../../firmware/lcd +../../firmware/funk +../../firmware/basic +../../firmware/core +../../firmware/usbcdc ../../firmware/usb) include(${QT_USE_FILE}) @@ -27,28 +31,6 @@ QT_WRAP_CPP(qsimulat0r MocSources ${qsimulat0r_SRCS}) set(FIRMWARE_OBJS ../simcore/simcore.o ../simcore/misc.o - -../firmware/basic/basic.o -../firmware/basic/reinvoke_isp.o -../firmware/basic/delayms.o -../firmware/basic/uuid.o -../firmware/basic/keyin.o -../firmware/basic/voltage.o -../firmware/core/sysinit.o -../firmware/core/adc/adc.o -../firmware/core/cpu/cpu.o -../firmware/core/gpio/gpio.o -../firmware/core/i2c/i2c.o -../firmware/core/iap/iap.o -../firmware/core/libc/ctype.o -../firmware/core/libc/stdio.o -../firmware/core/libc/string.o -../firmware/core/pmu/pmu.o -../firmware/core/ssp/ssp.o -../firmware/core/systick/systick.o -../firmware/core/timer16/timer16.o -../firmware/core/timer32/timer32.o -../firmware/core/wdt/wdt.o ) @@ -62,7 +44,17 @@ add_executable(qsimulat0r ${qsimulat0r_SRCS} ${MocSources} ${FIRMWARE_OBJS} ) -target_link_libraries(qsimulat0r ${QT_LIBRARIES} libapp.a liblcd.a libusb.a libfat.a) +target_link_libraries(qsimulat0r +${QT_LIBRARIES} +libapp.a +liblcd.a +libusb.a +libfat.a +libfunk.a +libusbcdc.a +libbasic.a +libcore.a +) diff --git a/simulat0r/gui/qsimulat0r.cc b/simulat0r/gui/qsimulat0r.cc index a5ae2d9..f519766 100644 --- a/simulat0r/gui/qsimulat0r.cc +++ b/simulat0r/gui/qsimulat0r.cc @@ -27,6 +27,15 @@ extern int lcd_layout; time_t starttime; long framecount=0; +const int colorGreenLED=QColor(0,255,0).rgb(); +const int colorRedLED=QColor(255,0,0).rgb(); +const int colorOffLED=QColor(64,64,64).rgb(); + +const int colorPixelOn=QColor(255,192,0).rgb(); +const int colorPixelOff=QColor(64,64,64).rgb(); +const int colorInvertedPixelOn=QColor(128,128,128).rgb(); // inverted and on => dark +const int colorInvertedPixelOff=QColor(128,255,128).rgb(); // inverted and off => bright + class LCD : public QWidget { public: static const int ledsize=10; @@ -41,8 +50,8 @@ public: static const int dimx=RESX; //96; static const int dimy=RESY; - void drawLED(QImage& pixmap,int led, int x, int y) { - int color=simGetLED(led)?QColor(255,0,0).rgb():QColor(64,64,64).rgb(); + void drawLED(QImage& pixmap,int led, int x, int y,int colorOn) { + int color=simGetLED(led)?colorOn:colorOffLED; for(int minix=0; minix -void simlcdPrepareUpdate(); -void simlcdWrite(int ignored, int bit); -void simlcdLineFeed(); -void simlcdCompleteUpdate(); +void simlcdDisplayUpdate(); int simButtonPressed(int button);