Add kconfig symbol for optional coordinates queue

This commit is contained in:
Rashed Talukder 2021-10-25 11:53:26 -07:00 committed by C47D
parent 919d644dc8
commit ac6cde35c9
3 changed files with 18 additions and 16 deletions

View file

@ -201,6 +201,13 @@ menu "LVGL Touch controller"
prompt "Invert Y coordinate value."
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
menu "Touchpanel (STMPE610) Pin Assignments"

View file

@ -84,20 +84,17 @@ void ft6x06_init(uint16_t dev_addr) {
LV_LOG_INFO("\tFirmware ID: 0x%02x", data_buf);
ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf);
<<<<<<< HEAD
LV_LOG_INFO("\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 ));
if( ft6x36_touch_queue_handle == NULL )
{
ESP_LOGE( TAG, "\tError creating touch input FreeRTOS queue" );
LV_LOG_ERROR("\tError creating touch input FreeRTOS queue" );
return;
}
xQueueSend( ft6x36_touch_queue_handle, &touch_inputs, 0 );
>>>>>>> bd445ea... Add touch input values to a FreeRTOS queue
#endif
}
/**
@ -123,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)
{
touch_inputs.current_state = LV_INDEV_STATE_REL;
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );
#endif
}
data->point.x = touch_inputs.last_x;
data->point.y = touch_inputs.last_y;
@ -146,19 +145,14 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
#if CONFIG_LV_FT6X36_INVERT_Y
touch_inputs.last_y = LV_VER_RES - touch_inputs.last_y;
#endif
<<<<<<< HEAD
data->point.x = last_x;
data->point.y = last_y;
data->state = LV_INDEV_STATE_PR;
LV_LOG_INFO("X=%u Y=%u", data->point.x, data->point.y);
=======
data->point.x = touch_inputs.last_x;
data->point.y = touch_inputs.last_y;
data->state = touch_inputs.current_state;
ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y);
LV_LOG_INFO("X=%u Y=%u", data->point.x, data->point.y);
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );
#endif
>>>>>>> bd445ea... Add touch input values to a FreeRTOS queue
return false;
}

View file

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