Merge pull request #11046 from gemu2015/ili9342

fix ili9342
This commit is contained in:
Theo Arends 2021-02-19 16:26:56 +01:00 committed by GitHub
commit 583f678756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -175,7 +175,7 @@ void ILI9341_2::writecmd(uint8_t d) {
void ILI9341_2::init(uint16_t width, uint16_t height) {
//sspi2 = SPISettings(2500000, MSBFIRST, SPI_MODE3);
if (_hwspi == 2) {
if (_hwspi >= 2) {
iwidth = ILI9341_TFTWIDTH;
iheight = ILI9341_TFTHEIGHT;
} else {
@ -187,8 +187,13 @@ void ILI9341_2::init(uint16_t width, uint16_t height) {
sspi2 = SPISettings(40000000, MSBFIRST, SPI_MODE0);
if (_hwspi==2) {
spi2=&SPI;
if (_hwspi >= 2) {
spi2 = &SPI;
#ifdef ESP32
if (_hwspi > 2) {
spi2->begin(_sclk, _miso, _mosi, -1);
}
#endif // ESP32
} else {
#ifdef ESP32
if (_spibus == 2) {
@ -522,7 +527,7 @@ void ili9342_bpwr(uint8_t on);
void ILI9341_2::DisplayOnff(int8_t on) {
if (_hwspi==2) {
if (_hwspi>=2) {
ili9342_bpwr(on);
}
@ -572,7 +577,7 @@ void ILI9341_2::dim(uint8_t dim) {
if (_bp>=0) {
ledcWrite(ESP32_PWM_CHANNEL,dimmer);
} else {
if (_hwspi==2) {
if (_hwspi>=2) {
ili9342_dimm(dim);
}
}

View File

@ -65,7 +65,7 @@ void ILI9341_InitDriver()
#ifdef USE_DISPLAY_ILI9341
uint8_t dtype = 1;
#else
uint8_t dtype = 2;
uint8_t dtype = 3; // sign ili9342 with variable spi pins
#endif // USE_DISPLAY_ILI9341
// default colors