fix ili9342

This commit is contained in:
gemu2015 2021-02-19 13:54:13 +01:00
parent e56c8b1845
commit b3788a5f8d
2 changed files with 9 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,11 @@ 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;
if (_hwspi > 2) {
spi2->begin(_sclk, _miso, _mosi, -1);
}
} else {
#ifdef ESP32
if (_spibus == 2) {
@ -522,7 +525,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 +575,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