Skip to content

Allow to set the GT911 touch device address #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32_Display_Panel
version=0.1.5
version=0.1.6
author=espressif
maintainer=espressif
sentence=ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development.
Expand Down
2 changes: 1 addition & 1 deletion src/ESP_PanelVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* Library Version */
#define ESP_PANEL_VERSION_MAJOR 0
#define ESP_PANEL_VERSION_MINOR 1
#define ESP_PANEL_VERSION_PATCH 5
#define ESP_PANEL_VERSION_PATCH 6

/* File `ESP_Panel_Conf.h` */
#define ESP_PANEL_CONF_VERSION_MAJOR 0
Expand Down
19 changes: 19 additions & 0 deletions src/touch/ESP_PanelTouch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,25 @@ ESP_PanelTouch::ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &
}
}

ESP_PanelTouch::ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address):
bus(bus),
config(config),
handle(NULL),
_swap_xy(false),
_mirror_x(false),
_mirror_y(false),
_tp_points_num(0),
_tp_buttons_state{0},
onTouchInterruptCallback(NULL),
_isr_sem(NULL),
callback_data(CALLBACK_DATA_DEFAULT())
{
if ((config.int_gpio_num != GPIO_NUM_NC) && (config.interrupt_callback == NULL) && (config.user_data == NULL)) {
this->config.interrupt_callback = onTouchInterrupt;
this->config.user_data = &callback_data;
}
}

bool ESP_PanelTouch::attachInterruptCallback(std::function<bool (void *)> callback, void *user_data)
{
ESP_PANEL_CHECK_FALSE_RET((config.interrupt_callback == onTouchInterrupt), false, "Interruption is not enabled");
Expand Down
9 changes: 9 additions & 0 deletions src/touch/ESP_PanelTouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ class ESP_PanelTouch {
*/
ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config);

/**
* @brief Construct a new touch device in a complex way, the `init()` function should be called after this function
*
* @param bus Pointer to panel bus
* @param config Touch device configuration
* @param address The address of the touch device, default set to `0` to use the default address
*/
ESP_PanelTouch(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address);

/**
* @brief Destroy the LCD device
*
Expand Down
5 changes: 5 additions & 0 deletions src/touch/GT911.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ ESP_PanelTouch_GT911::ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touc
{
}

ESP_PanelTouch_GT911::ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address):
ESP_PanelTouch(bus, config, address)
{
}

ESP_PanelTouch_GT911::~ESP_PanelTouch_GT911()
{
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();
Expand Down
10 changes: 9 additions & 1 deletion src/touch/GT911.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ class ESP_PanelTouch_GT911 : public ESP_PanelTouch {
*
* @param bus Pointer to panel bus
* @param config Touch device configuration
* @param address The address of the touch device, default set to `0` to use the default address
*/
ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config);

/**
* @brief Construct a new touch device in a complex way, the `init()` function should be called after this function
*
* @param bus Pointer to panel bus
* @param config Touch device configuration
* @param address The address of the touch device, default set to `0` to use the default address
*/
ESP_PanelTouch_GT911(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config, int address);

/**
* @brief Destroy the LCD device
*
Expand Down
Loading