37#define P4_IO_EXPANDER_IRQ 5
38#define IO_EXPANDER_TOUCH_RST (3 | 0x80)
39#define IO_EXPANDER_TOUCH_IRQ (4 | 0x80)
41#ifdef ARDUINO_ESP32P4_DEV
45volatile bool ioExpanderInterruptTriggered =
false;
50 Serial.print(
"Expander DigitalWrite: "); Serial.print(gpio & 0x7F); Serial.print(
" Level: "); Serial.println(
level);
53 Serial.print(
"GPIO DigitalWrite: "); Serial.print(gpio); Serial.print(
" Level: "); Serial.println(
level);
54 digitalWrite(gpio,
level);
61 Serial.print(
"Expander DigitalRead: "); Serial.print(gpio & 0x7F); Serial.println();
64 Serial.print(
"GPIO DigitalRead: "); Serial.print(gpio); Serial.println();
65 return digitalRead(gpio);
72 Serial.print(
"Expander PinMode: "); Serial.print(gpio & 0x7F); Serial.print(
" Mode: "); Serial.println(mode);
75 Serial.print(
"GPIO PinMode: "); Serial.print(gpio); Serial.print(
" Mode: "); Serial.println(mode);
86 Serial.println(
"Sketch only works with LilyGo-T-Display-P4 AMOLED(GT9895) Version");
91 SensorWireHelper::dumpDevices(Wire);
97 Serial.println(
"Failed to find io expander - check your wiring!");
101 Serial.println(
"Sensor Expander Initialized");
109 if (!
touch.
begin(Wire, GT9895_SLAVE_ADDRESS_L)) {
111 Serial.println(
"Failed to find touch device - check your wiring!");
116 Serial.println(
"GT9895 Touch Initialized");
118 Serial.print(
"Chip ID : 0x"); Serial.println(
touch.
getChipID(), HEX);
169 Serial.print(
"ID: ");
170 Serial.print(point.
id);
173 Serial.print(point.
x);
176 Serial.print(point.
y);
178 Serial.print(
"Pressure: ");
191 Serial.begin(115200);
195 Serial.println(
"Sketch only works with LilyGo-T-Display-P4 AMOLED(GT9895) Version");
bool begin(SensorCommCustom::CustomCallback callback, uint8_t addr)
Initialize the sensor using custom callback interface.
bool digitalRead(uint8_t pin)
Read the digital value from an input pin.
void pinMode(uint8_t pin, uint8_t mode)
Set the direction of a GPIO pin.
void digitalWrite(uint8_t pin, bool value)
Write a digital value to an output pin.
Concrete driver for the XL9555 16‑bit I2C GPIO expander.
bool begin(SensorCommCustom::CustomCallback callback, SensorCommCustomHal::CustomHalCallback hal_callback, uint8_t addr) override
Initialize the touch driver for custom communication.
const TouchPoints & getTouchPoints() override
Get the touch points.
uint32_t getChipID() override
Get the chip ID.
virtual void setGpioCallback(SensorHalCustom::CustomMode mode_cb, SensorHalCustom::CustomWrite write_cb, SensorHalCustom::CustomRead read_cb)
Set custom GPIO callbacks for pin control (e.g., reset, interrupt).
virtual void setResolution(uint16_t width, uint16_t height)
Set the raw resolution of the touch panel (physical maximum coordinates).
virtual void setPins(int rst, int irq)
Set the hardware reset and interrupt pin numbers.
virtual void setTargetResolution(uint16_t width, uint16_t height)
Set the target display resolution to map touch coordinates to screen pixels.
Container for touch point data and optional gesture information.
uint8_t getPointCount() const
Returns the number of stored touch points.
TouchPoint & getPoint(uint8_t index)
Gets a reference to a touch point at the specified index.
bool hasPoints() const
Checks whether any touch points are stored.
#define IO_EXPANDER_TOUCH_IRQ
#define IO_EXPANDER_TOUCH_RST
IoExpanderPCA9570 expander
Represents a single touch point with its properties.
uint16_t pressure
Pressure value (0 if not supported by the chip).
uint8_t id
Touch point ID for multi‑touch tracking.
uint16_t x
X coordinate of the touch point.
uint16_t y
Y coordinate of the touch point.
void TouchDrvPinMode(uint8_t gpio, uint8_t mode)
void TouchDrvDigitalWrite(uint8_t gpio, uint8_t level)
uint8_t TouchDrvDigitalRead(uint8_t gpio)