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/fonts.h"
#include "lcd/render.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(); the_menu->entries[menuselection]->callback();
break; break;
case BTN_ENTER: case BTN_ENTER:
lcdFill(0); lcdClear();
DoString(0,0,"Called...."); lcdPrintln("Called...");
lcdDisplay(0); lcdRefresh();
if (the_menu->entries[menuselection]->callback!=NULL) if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback(); the_menu->entries[menuselection]->callback();
lcdDisplay(0); lcdDisplay(0);

View File

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

View File

@ -12,7 +12,8 @@
uint8_t lcdBuffer[RESX*RESY_B]; uint8_t lcdBuffer[RESX*RESY_B];
int lcd_layout = 0; 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_CMD 0
#define TYPE_DATA 1 #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();