#include <lib/tinyprintf.h>
#include <lib/fonts/wogfont.h>
+#include <drivers/uart.h>
#include <drivers/st7735s.h>
#define TIMEOUT 500
/* Scroll the buffer */
memcpy(tftscreen.textmemptr, tftscreen.textmemptr + 21, BUFFER - 21);
- for (int i = 21; i >= 0; i--)
- tftscreen.buf[BUFFER - 21] = '\0';
+ //for (int i = 21; i >= 0; i--)
+ tftscreen.buf[BUFFER - 21] = '\0';
tftscreen.x = 0;
tftscreen.y = 0;
tftscreen.cpos = 0;
-
+
+ //for (int i = 0; i < 320; i++) {
+ // uart_putc(tftscreen.buf[i]);
+ //}
+
tft_puts(tftscreen.buf); // CHECK: ending
- tft_clrln();
+ //tftscreen.y = 14;
+ //tft_puts(" ");
+ tftscreen.y = 14;
+ tftscreen.x = 0;
+ tftscreen.cpos = BUFFER - 21;
+ // DINOSAUR tft_clrln();
}
-void tft_linefill() {
+void tft_nl() {
- // TODO
+ uint8_t blanks = 21 - tftscreen.x;
+
+ // filler with blank spaces
+ for (int i = 0; i < blanks; i++) {
+ tft_putc(0xFFFF, 0x0000, ' ');
+ }
}
int row = 0;
uint8_t current;
+
+ //if ((c == '\n') && (tftscreen.y == 14)) {
+ // tft_nl();
+ // tft_scroll2();
+ // return 1;
+ //}
+
+ if (c == '\n') {
+ if (tftscreen.y == 14) {
+ tft_nl();
+ return 1;
+ }
+ else {
+ tft_nl();
+ //if (tftscreen.y < 15)
+ return 1;
+ }
+ }
+ //// else {
+ //// tft_putc(0xFFFF, 0x0000, 'o');
+ //// }
+ // //else {
+ // // ENDFLAG = true;
+ // //}
+ //}
+
if (tftscreen.y >= 15) {
tft_scroll();
+ //if (ENDFLAG) {
+ // ENDFLAG = false;
+ // return 1;
+ //}
}
tft_command(TFT_CASET, 4, 0x00, STARTX + XPOS(tftscreen.x), 0x00, (STARTX + 4) + XPOS(tftscreen.x));