Closed tobi807 closed 3 months ago
Hi, thanks for your contribution :+1:
The test build failed for esp-idf, this is because digitalWrite()
(an arduino-only function) is used in Touch_RA8875::init(void)
. Also digitalWrite()
uses a hardcoded pin value.
// enable Touch Panel
// RA8875_TPCR0: RA8875_TPCR0_ENABLE | RA8875_TPCR0_WAIT_4096CLK | RA8875_TPCR0_WAKEENABLE | adcClk
digitalWrite(4, HIGH);
writeRegister8(0x70, 0x80 | 0x30 | 0x08 | 0x04); // 10mhz max!
digitalWrite(4, LOW);
These two points should be addressed:
1) assign GPIO pin 4
from the configuration block
auto cfg = _touch_instance.config();
cfg.pin_int = GPIO_NUM_4;
2) use lgfx gpio functions instead of digitalWrite()
:
lgfx::gpio_hi(_cfg.pin_int);
lgfx::pinMode(_cfg.pin_int, pin_mode_t::output);
writeRegister8(0x70, 0x80 | 0x30 | 0x08 | 0x04); // 10mhz max!
lgfx::gpio_lo(_cfg.pin_int);
Ahh my bad. The digitalWrite is only used for my debugging. I'll remove it and create a new pull request
Added two header files to utilize the touch functionality of the RA8875 display driver. Copied from existing touch drivers, did'nt understand the meaning of all functions and variables but works so far.
display.calibrateTouch(...)
and subsequent transfomation in display coordinates works nicely with the driver.Sample Config