Skip to content

Commit a56b80b

Browse files
author
Rashed Talukder
committed
Add kconfig symbol for optional coordinates queue
1 parent bd445ea commit a56b80b

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

lvgl_touch/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ menu "LVGL Touch controller"
201201
prompt "Invert Y coordinate value."
202202
default n
203203

204+
config LV_FT6X36_COORDINATES_QUEUE
205+
bool
206+
prompt "Send coordinates to FreeRTOS queue."
207+
default n
208+
help
209+
Receive from the FreeRTOS queue using the handle 'ft6x36_touch_queue_handle'.
210+
204211
endmenu
205212

206213
menu "Touchpanel (STMPE610) Pin Assignments"

lvgl_touch/ft6x36.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ void ft6x06_init(uint16_t dev_addr) {
8686
ft6x06_i2c_read8(dev_addr, FT6X36_RELEASECODE_REG, &data_buf);
8787
ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf);
8888

89+
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
8990
ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t ));
9091
if( ft6x36_touch_queue_handle == NULL )
9192
{
9293
ESP_LOGE( TAG, "\tError creating touch input FreeRTOS queue" );
9394
return;
9495
}
9596
xQueueSend( ft6x36_touch_queue_handle, &touch_inputs, 0 );
97+
#endif
9698
}
9799

98100
/**
@@ -118,7 +120,9 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
118120
if ( touch_inputs.current_state != LV_INDEV_STATE_REL)
119121
{
120122
touch_inputs.current_state = LV_INDEV_STATE_REL;
123+
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
121124
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );
125+
#endif
122126
}
123127
data->point.x = touch_inputs.last_x;
124128
data->point.y = touch_inputs.last_y;
@@ -146,7 +150,9 @@ bool ft6x36_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
146150
data->state = touch_inputs.current_state;
147151
ESP_LOGD(TAG, "X=%u Y=%u", data->point.x, data->point.y);
148152

153+
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
149154
xQueueOverwrite( ft6x36_touch_queue_handle, &touch_inputs );
155+
#endif
150156

151157
return false;
152158
}

lvgl_touch/ft6x36.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ typedef struct
154154
lv_indev_state_t current_state;
155155
} ft6x36_touch_t;
156156

157+
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
157158
QueueHandle_t ft6x36_touch_queue_handle;
158-
159+
#endif
159160
/**
160161
* @brief Initialize for FT6x36 communication via I2C
161162
* @param dev_addr: Device address on communication Bus (I2C slave address of FT6X36).

0 commit comments

Comments
 (0)