Skip to content

Commit 37548ad

Browse files
author
Rashed Talukder
committed
Extern the queue handle and add definition in source file. Add macro condition for dependencies.
1 parent a56b80b commit 37548ad

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lvgl_touch/ft6x36.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <lvgl/lvgl.h>
2626
#endif
2727
#include "ft6x36.h"
28-
2928
#include "lvgl_i2c/i2c_manager.h"
3029

3130
#define TAG "FT6X36"
@@ -35,6 +34,9 @@
3534
static ft6x36_status_t ft6x36_status;
3635
static uint8_t current_dev_addr; // set during init
3736
static ft6x36_touch_t touch_inputs = { -1, -1, LV_INDEV_STATE_REL }; // -1 coordinates to designate it was never touched
37+
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
38+
QueueHandle_t ft6x36_touch_queue_handle;
39+
#endif
3840

3941
static esp_err_t ft6x06_i2c_read8(uint8_t slave_addr, uint8_t register_addr, uint8_t *data_buf) {
4042
return lvgl_i2c_read(CONFIG_LV_I2C_TOUCH_PORT, slave_addr, register_addr, data_buf, 1);
@@ -87,7 +89,7 @@ void ft6x06_init(uint16_t dev_addr) {
8789
ESP_LOGI(TAG, "\tRelease code: 0x%02x", data_buf);
8890

8991
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
90-
ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t ));
92+
ft6x36_touch_queue_handle = xQueueCreate( FT6X36_TOUCH_QUEUE_ELEMENTS, sizeof( ft6x36_touch_t ) );
9193
if( ft6x36_touch_queue_handle == NULL )
9294
{
9395
ESP_LOGE( TAG, "\tError creating touch input FreeRTOS queue" );

lvgl_touch/ft6x36.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323

2424
#include <stdint.h>
2525
#include <stdbool.h>
26+
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
2627
#include "freertos/FreeRTOS.h"
2728
#include "freertos/queue.h"
29+
#endif
2830
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
2931
#include "lvgl.h"
3032
#else
@@ -155,7 +157,7 @@ typedef struct
155157
} ft6x36_touch_t;
156158

157159
#if CONFIG_LV_FT6X36_COORDINATES_QUEUE
158-
QueueHandle_t ft6x36_touch_queue_handle;
160+
extern QueueHandle_t ft6x36_touch_queue_handle;
159161
#endif
160162
/**
161163
* @brief Initialize for FT6x36 communication via I2C

0 commit comments

Comments
 (0)