diff --git a/avrtft.c b/avrtft.c index b0c8f82..2852e96 100644 --- a/avrtft.c +++ b/avrtft.c @@ -111,19 +111,16 @@ // enable global interrupts sei(); + + initDisplay(); while (true) { // show a demo once at the start if (!once && ints >= INTS_SEC) { // setFrame(0x00); - initDisplay(); - // writeBitmap(0, 140, BLUSH); hackDemo(); - updateDisplay(); - // max resolution image - // writeBitmap(0, 0, PHOTO); - // display(); + writeBitmap(0, 88, BLUSH); once = true; } diff --git a/cmd.c b/cmd.c index e2cb33c..d6761ba 100644 --- a/cmd.c +++ b/cmd.c @@ -65,20 +65,12 @@ } /** - * Updates the display. - */ -static void update(void) { - display(); -} - -/** * Writes the Hack demo. */ static void demo(void) { setFrame(0x00); - // writeBitmap(1, 198, TUX); hackDemo(); - display(); + writeBitmap(0, 88, BLUSH); } void handleCmd(char *data) { @@ -89,7 +81,6 @@ case CMD_TEXT: text(data); break; case CMD_BITMAP: bitmap(data); break; case CMD_DEMO: demo(); break; - case CMD_UPDATE: update(); break; default: break; } } diff --git a/display.c b/display.c index cea82e5..9264149 100644 --- a/display.c +++ b/display.c @@ -57,18 +57,10 @@ void hackDemo(void) { const __flash Font *hack = &hackFont; - // writeString(0 * hack->height, 0, hack, "ö"); - writeDisplay(16, 0, hack->glyphs[3].bitmap, 8, 16, COLOR_GREY4); - -// for (uint8_t i = 0; i < HACK_DEMO_SIZE; i++) { -// const __flash char *line = demoTextLines[i]; -// char buf[HACK_DEMO_LINE_SIZE]; -// strlcpy_P(buf, line, HACK_DEMO_LINE_SIZE - 1); -// writeString(i * hack->height, 0, hack, buf); -// } -} - -void display() { - initDisplay(); - updateDisplay(); + for (uint8_t i = 0; i < HACK_DEMO_SIZE; i++) { + const __flash char *line = demoTextLines[i]; + char buf[HACK_DEMO_LINE_SIZE]; + strlcpy_P(buf, line, HACK_DEMO_LINE_SIZE - 1); + writeString(i * hack->height, 0, hack, buf); + } } diff --git a/display.h b/display.h index 5a1cc84..631874c 100644 --- a/display.h +++ b/display.h @@ -49,6 +49,4 @@ */ void hackDemo(void); -void display(void); - #endif /* DISPLAY_H */ diff --git a/hack.c b/hack.c index 71737db..18f7ae0 100644 --- a/hack.c +++ b/hack.c @@ -22,19 +22,20 @@ #define WIDTH 8 #define HEIGHT 16 -static const __flash char demo1[] = "Hello Hack!"; -static const __flash char demo2[] = "!\"#$%&'()*+,-./0123"; +static const __flash char demo1[] = "Hello Hack! \"#$%"; +static const __flash char demo2[] = "&'()*+,-./0123456789"; static const __flash char demo3[] = "ABCDEFGHIJKLMNOPQRST"; -static const __flash char demo4[] = ":;<=>?@[\\]^_`{|}~×÷"; -static const __flash char demo5[] = "abcdefghijklmnopqrst"; +static const __flash char demo4[] = "UVWXYZabcdefghijklmn"; +static const __flash char demo5[] = "opqrstuvwxyz "; static const __flash char demo6[] = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ"; static const __flash char demo7[] = "àáâãäåæçèéêëìíîïðñòó"; +static const __flash char demo8[] = ":;<=>?@[\\]^_`{|}~×÷ "; /** * Demo text. */ const __flash char* demoTextLines[HACK_DEMO_SIZE] = { - demo1, demo2, demo3, demo4, demo5, demo6, demo7 + demo1, demo2, demo3, demo4, demo5, demo6, demo7, demo8 }; static const __flash uint8_t SPACE[] = { diff --git a/hack.h b/hack.h index ea9844c..df0086d 100644 --- a/hack.h +++ b/hack.h @@ -19,7 +19,7 @@ #include "font.h" -#define HACK_DEMO_SIZE 7 +#define HACK_DEMO_SIZE 8 #define HACK_DEMO_LINE_SIZE 64 /** diff --git a/tft.c b/tft.c index 98d4270..a82876b 100644 --- a/tft.c +++ b/tft.c @@ -108,6 +108,16 @@ displayData(0b01110110); displayDes(); + // DISPON + displaySel(); + displayCmd(DISPON); + displayDes(); + + // SLPIN + // displaySel(); + // displayCmd(SLPIN); + // displayDes(); + printString("done initializing display\r\n"); } @@ -115,8 +125,6 @@ const __flash uint8_t *bitmap, width_t width, height_t height, uint8_t color) { - - uint16_t bytes = width * height * 2; // CASET uint16_t ys = col; @@ -146,12 +154,14 @@ displaySetData(); if (color == COLOR_RGB16) { + uint16_t bytes = width * height * 2; for (uint16_t i = 0; i < bytes; i++) { transmit(bitmap[i]); } } if (color == COLOR_GREY4) { + uint16_t bytes = width * height / 2; for (uint16_t i = 0; i < bytes; i++) { uint8_t rgb[4]; fourBitGreyTo16BitRGB(bitmap[i], rgb); @@ -163,18 +173,3 @@ displayDes(); } - -void updateDisplay(void) { - - // DISPON - displaySel(); - displayCmd(DISPON); - displayDes(); - - // SLPIN - // displaySel(); - // displayCmd(SLPIN); - // displayDes(); - - printString("done updating display\r\n"); -} \ No newline at end of file diff --git a/tft.h b/tft.h index 576e6e6..52c610d 100644 --- a/tft.h +++ b/tft.h @@ -61,9 +61,4 @@ width_t width, height_t height, uint8_t color); -/** - * Updates the display. - */ -void updateDisplay(void); - #endif /* TFT_H */