Add lcd/print.c for easier lcd output

This commit is contained in:
Stefan `Sec` Zehl 2011-07-13 01:13:19 +02:00
parent d25d57313c
commit 02b45cdce2
5 changed files with 50 additions and 4 deletions

View File

@ -4,6 +4,7 @@
#include "lcd/fonts.h"
#include "lcd/render.h"
#include "lcd/print.h"
/**************************************************************************/
@ -72,9 +73,9 @@ void handleMenu(const struct MENU *the_menu) {
the_menu->entries[menuselection]->callback();
break;
case BTN_ENTER:
lcdFill(0);
DoString(0,0,"Called....");
lcdDisplay(0);
lcdClear();
lcdPrintln("Called...");
lcdRefresh();
if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback();
lcdDisplay(0);

View File

@ -8,6 +8,7 @@ OBJS += display.o
OBJS += render.o
OBJS += decoder.o
OBJS += backlight.o
OBJS += print.o
FONTS = $(basename $(wildcard fonts/*.c))

View File

@ -12,7 +12,8 @@
uint8_t lcdBuffer[RESX*RESY_B];
int lcd_layout = 0;
uint32_t intstatus;
uint32_t intstatus; // Caches USB interrupt state
// (need to disable MSC while displaying)
#define TYPE_CMD 0
#define TYPE_DATA 1

36
firmware/lcd/print.c Normal file
View File

@ -0,0 +1,36 @@
#include <display.h>
#include <render.h>
#include <fonts.h>
int x=0;
int y=0;
void lcdPrint(const char *string){
x=DoString(x,y,string);
};
void lcdNl(void){
x=0;y+=font->u8Height;
};
void lcdPrintln(const char *string){
lcdPrint(string);
lcdNl();
};
void lcdPrintInt(const int num){
x=DoInt(x,y,num);
};
void lcdPrintIntHex(const int num){
x=DoIntX(x,y,num);
};
void lcdClear(){
x=0;y=0;
lcdFill(0);
};
void lcdRefresh(){
lcdDisplay(0);
};

7
firmware/lcd/print.h Normal file
View File

@ -0,0 +1,7 @@
void lcdPrint(const char *string);
void lcdNl(void);
void lcdPrintln(const char *string);
void lcdPrintInt(const int num);
void lcdPrintIntHex(const int num);
void lcdClear();
void lcdRefresh();