crashtest-r0ket/firmware/lcd/print.c

83 lines
1.2 KiB
C
Raw Normal View History

2011-07-12 23:13:19 +00:00
#include <display.h>
#include <render.h>
#include <fonts.h>
2011-07-16 18:09:08 +00:00
#include <print.h>
2011-08-01 22:03:37 +00:00
#include <fonts/smallfonts.h>
2011-07-12 23:13:19 +00:00
int x=0;
int y=0;
2011-07-21 20:31:26 +00:00
void checkScroll(void){
if(y+font->u8Height>RESY){
lcdShift(0,y+font->u8Height-RESY,false);
y=RESY-font->u8Height;
};
};
2011-07-12 23:13:19 +00:00
void lcdPrint(const char *string){
2011-07-21 20:31:26 +00:00
checkScroll();
2011-07-12 23:13:19 +00:00
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){
2011-07-21 20:31:26 +00:00
checkScroll();
2011-07-12 23:13:19 +00:00
x=DoInt(x,y,num);
};
void lcdPrintIntHex(const int num){
2011-07-21 20:31:26 +00:00
checkScroll();
2011-07-12 23:13:19 +00:00
x=DoIntX(x,y,num);
};
2011-07-16 18:09:08 +00:00
void lcdPrintCharHex(const uint8_t num){
2011-07-21 20:31:26 +00:00
checkScroll();
2011-07-16 18:09:08 +00:00
x=DoCharX(x,y,num);
};
void lcdPrintShortHex(const uint16_t num){
2011-07-21 20:31:26 +00:00
checkScroll();
2011-07-16 18:09:08 +00:00
x=DoShortX(x,y,num);
};
2011-07-12 23:13:19 +00:00
void lcdClear(){
x=0;y=0;
lcdFill(0);
};
void lcdRefresh(){
lcdDisplay();
2011-07-12 23:13:19 +00:00
};
2011-07-13 00:15:47 +00:00
void lcdMoveCrsr(signed int dx,signed int dy){
x+=dx;
y+=dy;
};
void lcdSetCrsr(int dx,int dy){
x=dx;
y=dy;
};
2011-07-16 18:09:08 +00:00
void lcdSetCrsrX(int dx){
x=dx;
};
2011-08-01 22:03:37 +00:00
void setSystemFont(void){
setIntFont(&Font_7x8);
};
int lcdGetVisibleLines(void){
return (RESY/getFontHeight()); // subtract title line
};