void Screen_HX8353E::begin() { #if defined(__LM4F120H5QR__) SPI.setModule(2); #endif SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV2); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); if (_pinReset!=NULL) pinMode(_pinReset, OUTPUT); if (_pinBacklight!=NULL) pinMode(_pinBacklight, OUTPUT); pinMode(_pinDataCommand, OUTPUT); pinMode(_pinChipSelect, OUTPUT); if (_pinBacklight!=NULL) digitalWrite(_pinBacklight, HIGH); if (_pinReset!=NULL) digitalWrite(_pinReset, 1); delay(100); if (_pinReset!=NULL) digitalWrite(_pinReset, 0); delay(50); if (_pinReset!=NULL) digitalWrite(_pinReset, 1); delay(120); _writeCommand(HX8353E_SWRESET); delay(150); _writeCommand(HX8353E_SLPOUT); delay(200); _writeRegister(HX8353E_GAMSET, 0x04); _writeCommand(HX8353E_SETPWCTR); _writeData88(0x0A, 0x14); _writeCommand(HX8353E_SETSTBA); _writeData88(0x0A, 0x00); _writeRegister(HX8353E_COLMOD, 0x05); delay(10); _writeRegister(HX8353E_MADCTL, HX8353E_MADCTL_RGB); _writeCommand(HX8353E_CASET); _writeData8888(0x00, 0x00, 0x00, 0x79); _writeCommand(HX8353E_RASET); _writeData8888(0x00, 0x00, 0x00, 0x79); _writeCommand(HX8353E_NORON); delay(10); _writeCommand(HX8353E_DISPON); delay(120); _writeCommand(HX8353E_RAMWR); setBacklight(true); setOrientation(0); _screenWidth = HX8353E_WIDTH; _screenHeigth = HX8353E_HEIGHT; _penSolid = false; _fontSolid = true; _flagRead = false; _touchTrim = 0; clear(); }
void screenBegin() { // Screen_HX8353E::begin() /* * this is a 8MHz speed (16MHz Arduino speed/2) * In HalCoGen, on data format 0, I defined Baudrate 8000 kHz */ mibspiInit(); gioSetBit(_portReset, _pinReset, 1); delay(100); gioSetBit(_portReset, _pinReset, 0); delay(50); gioSetBit(_portReset, _pinReset, 1); delay(120); _writeCommand(HX8353E_SWRESET); delay(150); _writeCommand(HX8353E_SLPOUT); delay(200); _writeRegister(HX8353E_GAMSET, 0x04); _writeCommand(HX8353E_SETPWCTR); _writeData88(0x0A, 0x14); _writeCommand(HX8353E_SETSTBA); _writeData88(0x0A, 0x00); _writeRegister(HX8353E_COLMOD, 0x05); delay(10); _writeRegister(HX8353E_MADCTL, HX8353E_MADCTL_RGB); _writeCommand(HX8353E_CASET); _writeData8888(0x00, 0x00, 0x00, 0x79); _writeCommand(HX8353E_RASET); _writeData8888(0x00, 0x00, 0x00, 0x79); _writeCommand(HX8353E_NORON); delay(10); _writeCommand(HX8353E_DISPON); delay(120); _writeCommand(HX8353E_RAMWR); setBacklight(true); setOrientation(0); _screenWidth = HX8353E_WIDTH; _screenHeigth = HX8353E_HEIGHT; _penSolid = false; _fontSolid = true; _flagRead = false; clear(blackColour); }