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

This commit is contained in:
bernd 2011-08-04 13:38:22 +02:00
commit 7ab8a63a54
5 changed files with 29 additions and 18 deletions

2
firmware/.gitignore vendored
View File

@ -4,3 +4,5 @@ lpc1xxx/memory.ld
applications/wrapper.c applications/wrapper.c
lcd/allfonts.h lcd/allfonts.h
Makefile.dep Makefile.dep
table.c
table.h

View File

@ -1,4 +1,4 @@
*.elf *.elf
*.bin *.bin
*.h usetable.h
loadable.ld loadable.ld

View File

@ -42,7 +42,7 @@ $(LDFILE):
$(OBJCOPY) $(OCFLAGS) -O binary $< $@ $(OBJCOPY) $(OCFLAGS) -O binary $< $@
clean: clean:
rm -f *.o *.elf *.bin rm -f *.o *.elf *.bin usetable.h
IDIR=/cygdrive/f IDIR=/cygdrive/f
install: install:
@ -50,6 +50,9 @@ install:
$(OBJS): usetable.h $(OBJS): usetable.h
usetable.h:
./mktable.pl
.SUFFIXES: .SUFFIXES:
.PHONY: $(LDFILE) .PHONY: $(LDFILE)

View File

@ -65,9 +65,9 @@ void ChkBattery(void) {
lcdNl(); lcdNl();
lcdPrintln("Chrg_stat:"); lcdPrintln("Chrg_stat:");
if(gpioGetValue(RB_PWR_CHRG)){ if(gpioGetValue(RB_PWR_CHRG)){
lcdPrintln("1"); lcdPrintln("not charging");
}else{ }else{
lcdPrintln("0"); lcdPrintln(" CHARGING");
}; };
lcdRefresh(); lcdRefresh();
delayms_queue(100); delayms_queue(100);

View File

@ -8,13 +8,14 @@
#include "fonts/smallfonts.h" #include "fonts/smallfonts.h"
#include "filesystem/ff.h" #include "filesystem/ff.h"
#include "render.h"
/* Global Variables */ /* Global Variables */
const struct FONT_DEF * font = NULL; const struct FONT_DEF * font = NULL;
struct EXTFONT efont; struct EXTFONT efont;
FIL file; /* current font file */ static FIL file; /* current font file */
/* Exported Functions */ /* Exported Functions */
@ -36,10 +37,17 @@ void setExtFont(const char *fname){
int getFontHeight(void){ int getFontHeight(void){
if(font) if(font)
return font->u8Height; return font->u8Height;
return 8; // XXX: Should be done right. return 8; // XXX: Should be done right.
}; };
static uint8_t read_byte (void)
{
UINT readbytes;
uint8_t byte;
f_read(&file, &byte, sizeof(uint8_t), &readbytes);
return byte;
}
int _getFontData(int type, int offset){ int _getFontData(int type, int offset){
UINT readbytes; UINT readbytes;
@ -51,10 +59,10 @@ int _getFontData(int type, int offset){
if(efont.type == FONT_EXTERNAL){ if(efont.type == FONT_EXTERNAL){
if (type == START_FONT){ if (type == START_FONT){
res = f_read(&file, &efont.def.u8Width, sizeof(uint8_t), &readbytes); efont.def.u8Width = read_byte ();
res = f_read(&file, &efont.def.u8Height, sizeof(uint8_t), &readbytes); efont.def.u8Height = read_byte ();
res = f_read(&file, &efont.def.u8FirstChar, sizeof(uint8_t), &readbytes); efont.def.u8FirstChar = read_byte ();
res = f_read(&file, &efont.def.u8LastChar, sizeof(uint8_t), &readbytes); efont.def.u8LastChar = read_byte ();
res = f_read(&file, &extras, sizeof(uint16_t), &readbytes); res = f_read(&file, &extras, sizeof(uint16_t), &readbytes);
return 0; return 0;
}; };
@ -72,9 +80,7 @@ int _getFontData(int type, int offset){
return 0; return 0;
}; };
if(type == GET_WIDTH || type == GET_DATA){ if(type == GET_WIDTH || type == GET_DATA){
uint8_t width; return read_byte ();
res = f_read(&file, &width, sizeof(uint8_t), &readbytes);
return width;
}; };
if(type == SEEK_DATA){ if(type == SEEK_DATA){
character=offset; character=offset;
@ -87,7 +93,7 @@ int _getFontData(int type, int offset){
}; };
if(type == PEEK_DATA){ if(type == PEEK_DATA){
uint8_t width; uint8_t width;
res = f_read(&file, &width, sizeof(uint8_t), &readbytes); width = read_byte ();
f_lseek(&file,6+ f_lseek(&file,6+
(extras*sizeof(uint16_t))+ (extras*sizeof(uint16_t))+
((extras+font->u8LastChar-font->u8FirstChar)*sizeof(uint8_t))+ ((extras+font->u8LastChar-font->u8FirstChar)*sizeof(uint8_t))+
@ -138,7 +144,7 @@ int _getFontData(int type, int offset){
return 0; return 0;
}; };
int _getIndex(int c){ static int _getIndex(int c){
#define ERRCHR (font->u8FirstChar+1) #define ERRCHR (font->u8FirstChar+1)
/* Does this font provide this character? */ /* Does this font provide this character? */
if(c<font->u8FirstChar) if(c<font->u8FirstChar)
@ -240,10 +246,10 @@ int DoChar(int sx, int sy, int c){
UINT res; UINT res;
UINT readbytes; UINT readbytes;
uint8_t testbyte; uint8_t testbyte;
res = f_read(&file, &testbyte, sizeof(uint8_t), &readbytes); testbyte = read_byte ();
if(testbyte>>4 ==15){ if(testbyte>>4 ==15){
res = f_read(&file, &preblank, sizeof(uint8_t), &readbytes); preblank = read_byte ();
res = f_read(&file, &postblank, sizeof(uint8_t), &readbytes); postblank = read_byte ();
width-=3; width-=3;
width/=height; width/=height;
res = f_read(&file, charBuf, width*height, &readbytes); res = f_read(&file, charBuf, width*height, &readbytes);