// Minimal init in order to display the welcome message // not mandatory void TScreen::Welcome() { ILI9341_due::begin(); // for Print // some default welcome = true; setRotation(iliRotation270); // landscape fillScreen(ILI9341_DARKBLUE); setFontMode(gTextFontModeTransparent); setFont(Arial_bold_14); setTextColor(ILI9341_WHITE, ILI9341_NAVY); }
void Matrix::writeString(char* _c, bool _m, uint16_t _t, int16_t _xy) { setFontMode(_m); int c1 = (_m ? getWidth() : getHeight()) * 8; int c2 = -(_m ? getStringWidth(_c) : getStringHeight(_c)) - c1; for (int a = c1; a > c2; a--) { setCursor((_m ? a : _xy), (_m ? _xy : a)); print(_c); delay(_t); #ifdef WDT wdt_reset(); #endif } }
Matrix::Matrix(uint8_t (*_addr)[8]) { // uint8_t (*p)[10]=_addr; uint8_t _x = 0, _y = 0; for(uint8_t a=0;a<8;a++) //判断第一层 { if(_addr[0][a] == 0){ break; //NULL,结束当前层判断 } else{ _x = a+1; for(uint8_t b=0;b<8;b++) { //判断第二层 if(_addr[b][a] == 0){ break; //NULL,结束当前层判断 } else { _y = b+1; } } } } this->_numX = _x; this->_numY = _y; this->_matrixNum = this->_numX * this->_numY; led = new LedControl[this->_matrixNum]; this->cursor_y = 0; this->cursor_x = 0; uint8_t _p[64]; for (int a = 0; a < this->_numY; a++) { for (int b = 0; b < this->_numX ; b++) { uint8_t _s = b + a * this->_numX ; _p[_s]=_addr[a][b]; } } setDeviceAddr(_p); clearFastMode(); clearColor(); setFontMode(true); }