# ESP LCD Touch TMA445 Cypress Controller Experimental touch reverse engineered from [Android Cypress touch driver](https://github.com/esno/linux-kindle-pw2/tree/amazon-3.0.y/drivers/input/touchscreen). ## Example use Initialization of the touch component. ``` esp_lcd_panel_io_i2c_config_t io_config = ESP_LCD_TOUCH_IO_I2C_TMA445_CONFIG(); esp_lcd_touch_config_t tp_cfg = { .x_max = CONFIG_LCD_HRES, .y_max = CONFIG_LCD_VRES, .rst_gpio_num = -1, .int_gpio_num = -1, .levels = { .reset = 0, .interrupt = 0, }, .flags = { .swap_xy = 0, .mirror_x = 0, .mirror_y = 0, }, }; esp_lcd_touch_handle_t tp; esp_lcd_touch_new_i2c_tma445(io_config, &tp_cfg, &tp); ``` Read data from the touch controller and store it in RAM memory. It should be called regularly in poll. ``` esp_lcd_touch_read_data(tp); ``` Get one X and Y coordinates with strength of touch. ``` uint16_t touch_x[1]; uint16_t touch_y[1]; uint16_t touch_strength[1]; uint8_t touch_cnt = 0; bool touchpad_pressed = esp_lcd_touch_get_coordinates(tp, touch_x, touch_y, touch_strength, &touch_cnt, 1); ``` This touch driver was developed by Martin Fasani with the help of [Dario](https://github.com/ddB0515). He provided the key aspects for bootstrapping the device and help in understanding the original Linux driver.
idf.py add-dependency "martinberlin/touch_tma445^1.0.0"