Add kconfig symbol for optional coordinates queue

This commit is contained in:
Rashed Talukder 2021-10-25 11:53:26 -07:00
parent bd445ea30a
commit a56b80b362
3 changed files with 15 additions and 1 deletions

View file

@ -201,6 +201,13 @@ menu "LVGL Touch controller"
prompt "Invert Y coordinate value." prompt "Invert Y coordinate value."
default n default n
config LV_FT6X36_COORDINATES_QUEUE
bool
prompt "Send coordinates to FreeRTOS queue."
default n
help
Receive from the FreeRTOS queue using the handle 'ft6x36_touch_queue_handle'.
endmenu endmenu
menu "Touchpanel (STMPE610) Pin Assignments" menu "Touchpanel (STMPE610) Pin Assignments"

View file

@ -86,6 +86,7 @@ void ft6x06_init(uint16_t dev_addr) {
ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf); ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf);
ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf); ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf);
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t )); ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t ));
if( ft6x36_touch_queue_handle == NULL ) if( ft6x36_touch_queue_handle == NULL )
{ {
@ -93,6 +94,7 @@ void ft6x06_init(uint16_t dev_addr) {
return; return;
} }
xQueueSend( ft6x36_touch_queue_handle, &touch_inputs, 0 ); xQueueSend( ft6x36_touch_queue_handle, &touch_inputs, 0 );
#endif
} }
/** /**
@ -118,7 +120,9 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
if ( touch_inputs.current_state != LV_INDEV_STATE_REL) if ( touch_inputs.current_state != LV_INDEV_STATE_REL)
{ {
touch_inputs.current_state = LV_INDEV_STATE_REL; touch_inputs.current_state = LV_INDEV_STATE_REL;
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );
#endif
} }
data->point.x = touch_inputs.last_x; data->point.x = touch_inputs.last_x;
data->point.y = touch_inputs.last_y; data->point.y = touch_inputs.last_y;
@ -146,7 +150,9 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
data->state = touch_inputs.current_state; data->state = touch_inputs.current_state;
ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y); ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y);
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs ); xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );
#endif
return false; return false;
} }

View file

@ -154,8 +154,9 @@ typedef struct
lv_indev_state_t current_state; lv_indev_state_t current_state;
} ft6x36_touch_t; } ft6x36_touch_t;
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
QueueHandle_t ft6x36_touch_queue_handle; QueueHandle_t ft6x36_touch_queue_handle;
#endif
/** /**
* @brief Initialize for FT6x36 communication via I2C * @brief Initialize for FT6x36 communication via I2C
* @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36). * @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36).