Added num up down support.

This commit is contained in:
t-moe
2015-04-30 23:22:30 +02:00
parent 77e6d0e061
commit 76ea9d8972
5 changed files with 170 additions and 6 deletions

View File

@@ -1,9 +1,7 @@
#include "tft.h"
#include "ll_tft.h"
#include <string.h>
//it might seems pointless to forward all the functions but we might also introduce functions which have some logic here
#include <stdarg.h>
bool tft_init() {
return ll_tft_init();
@@ -60,3 +58,11 @@ void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, ui
}
}
void tft_print_formatted(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char* format, ...) {
static char buffer[256]; //not sure if that's the best solution. It would propbably better to implement putchar and use vprintf
va_list args;
va_start (args, format);
vsprintf(buffer,format,args);
tft_print_line(x,y,color,bgcolor,font,buffer);
va_end(args);
}

View File

@@ -26,3 +26,4 @@ uint8_t tft_num_fonts();
uint8_t tft_font_height(uint8_t fontnum);
uint8_t tft_font_width(uint8_t fontnum);
void tft_print_line(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char* text);
void tft_print_formatted(uint16_t x, uint16_t y, uint16_t color, uint16_t bgcolor, uint8_t font, const char* format, ...);