martinberlin / cale-idf

CalEPD is an Epaper component driver for the ESP-IDF framework with GFX and font support, optional touch interface, compatible with ESP32 / S2 / S3 / C3
https://fasani.de
Apache License 2.0
277 stars 26 forks source link

Add touch as a component for eink displays #17

Closed martinberlin closed 3 years ago

martinberlin commented 4 years ago

As a reference there is a touch component in C done here: https://github.com/lvgl/lv_port_esp32/blob/master/components/lvgl_esp32_drivers/lvgl_touch/ft6x36.c

But is a bit strange that I don’t see the INT pin defined. I would like to have the I2C and the INT pin defined in menuconfig. The interrupt pin goes Low when a touch is detected, then come the I2C 2 bytes read of the touch parameters. What I would like to do is to implement a component that can be injected as EpdSpi is now. This should make the class rotation aware, so if we rotate GFX, the coordinates of the touch should be rotated as well. This will be integrated in models that already support touch (ending in -T) but it could also be used as an independent component if you decide to buy the touch panel independently and add it to any other display.

As a reference I like this FT6X36 class coded by strange-v First epaper target is Goodisplay 2.7 touch I2C documentation https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2c.html

Schematics

Touch & SPI Wiring

martinberlin commented 4 years ago

Touch short video with GDEW027W3 T

martinberlin commented 4 years ago

Pseudo-code from me-no-dev to work with ISR interrupts

static void waitingThread(void* arg){
  for(;;){
    semaphoreTake(isr_sem, forever);
    //do your Wire stuff
  }
}

static void isr(){
  bool shouldYield = false;
  semaphoreGiveFromISR(isr_sem, &shouldYield);
  yieldFromISR(shouldYield);
}

Pointer 2: Check how to draw buttons using Adafruit GFX that is already installed https://learn.adafruit.com/arduin-o-phone-arduino-powered-diy-cellphone/arduin-o-phone-sketch

martinberlin commented 4 years ago

I2C Reference of FocalTech commands FT6236

martinberlin commented 4 years ago

Images for https://github.com/martinberlin/cale-idf/wiki/Model-gdew027w3T.h-(Touch)

2 7-touch

CalEPD_touch

martinberlin commented 4 years ago

Touch is integrated and working to detect simple tapping. Ready to be used in UX for ESP32

martinberlin commented 3 years ago

At the moment I'm refactoring this library since I'm not happy with the current version and will like to recognize the gestures of the original library and if possible add new ones based on the double X, Y, Event signals and recognize also Zoom IN and Zoom OUT events.

martinberlin commented 3 years ago

Done. It works well to detect tapping and that’s enough to design UX on epaper