Skip to content

Commit

Permalink
Add kconfig symbol for optional coordinates queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashed Talukder authored and C47D committed Oct 28, 2021
1 parent 919d644 commit ac6cde3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
7 changes: 7 additions & 0 deletions lvgl_touch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 9 additions & 15 deletions lvgl_touch/ft6x36.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand All @@ -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;
Expand All @@ -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;
}
3 changes: 2 additions & 1 deletion lvgl_touch/ft6x36.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit ac6cde3

Please sign in to comment.