From 1a99603c45433b09ff4649bebdb6c08ecf2c63ea Mon Sep 17 00:00:00 2001 From: Computer construction kit SmartyKit <42343604+smartykit@users.noreply.github.com> Date: Wed, 27 Apr 2022 22:13:27 +0300 Subject: [PATCH] Update Smarty_TFT.cpp Added ASCII art support --- .../Smarty_TFT.cpp | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/SmartyKit 1 basic drivers/SmartyKit1_VideoDriverBasic_TFT2.8_TV/Smarty_TFT.cpp b/SmartyKit 1 basic drivers/SmartyKit1_VideoDriverBasic_TFT2.8_TV/Smarty_TFT.cpp index 3b80898..b2b78fe 100644 --- a/SmartyKit 1 basic drivers/SmartyKit1_VideoDriverBasic_TFT2.8_TV/Smarty_TFT.cpp +++ b/SmartyKit 1 basic drivers/SmartyKit1_VideoDriverBasic_TFT2.8_TV/Smarty_TFT.cpp @@ -107,13 +107,40 @@ void SmartyKit_DisplayDriver::setup(uint16_t setupColor, uint16_t setupBgColor, bCursorOn = false; setCursor(0,0); clearScreen(bgColor); + // test ASCII art (a person) +// print(' ',color);print('o', color);print(' ', color); print('\n', color); +// print('/',color);print('|', color);print('\\', color); print('\n', color); +// print('/',color);print(' ', color);print('\\', color); print('\n', color); // startup ASCII art - print(' ',color);print('o', color);print(' ', color); print('\n', color); - print('/',color);print('|', color);print('\\', color); print('\n', color); - print('/',color);print(' ', color);print('\\', color); print('\n', color); + ASCIIart(); } +void SmartyKit_DisplayDriver::ASCIIart(void) +{ + + char c = '\0'; + char* ptrBuffer; + + for (int i = 0; i < SCREEN_ROWS; i++) + { + ptrBuffer = (char*) malloc(2*SCREEN_COLS); + if (ptrBuffer != NULL) + { + //reading current string from PROGMEM to RAM + strcpy_P(ptrBuffer, (char *)pgm_read_word(&(string_table[i]))); + + for (int j = 0; j < SCREEN_COLS; j++) + { + c = ptrBuffer[j]; + print(c,color); + } + free(ptrBuffer); + } + } + return; +} + void SmartyKit_DisplayDriver::initSPI(void) { if (_cs >= 0) {