-
Notifications
You must be signed in to change notification settings - Fork 105
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
feat(lcd_touch): support trank id (BSP-536) #369
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ menu "ESP LCD TOUCH" | |
range 0 10 | ||
default 1 | ||
|
||
endmenu | ||
endmenu |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ typedef struct { | |
} flags; | ||
|
||
/*!< User callback called after get coordinates from touch controller for apply user adjusting */ | ||
void (*process_coordinates)(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num); | ||
void (*process_coordinates)(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *track_id, uint8_t *point_num, uint8_t max_point_num); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot change API. We can create another function with similar API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would be a good name for the new function? The current function name is static bool esp_lcd_touch_ft5x06_get_xy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have two options for it:
Same for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, the touch chip actually supports some additional special features. For example, the FT5x06 can indicate whether a swipe is to the left or right, and whether each touch point is currently being pressed or swiped, among other things. It would be best to address these issues all at once and lay the groundwork for future requirements. bool esp_lcd_touch_get_coordinates_data(esp_lcd_touch_handle_t tp, void *data)
{
ft5x06_data_t *ft_data = (ft5x06_data_t *)data;
// ft_data->x[i]
// ft_data->trank_id
//...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is good idea, but it looks little dangerous use void type and we don't know const count of touches. We can do something like this:
Usage:
Note: This structure can be very easily extended in future. And any driver can use @igrr @tore-espressif What do you think about this solution? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about handling everything within a struct? typedef struct { typedef struct { However, it's important to note that not every chip has all of this information There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you said, some features are not supported in all chips, I think the gestures should be in own function and we can return NOT_SUPPORTED error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we want to return device specific data, this should be handled in the specific touch driver eg. So there are 2 types of returned data
What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
🤷♂️ :D If yes, let's make it all common |
||
/*!< User callback called after the touch interrupt occurred */ | ||
esp_lcd_touch_interrupt_callback_t interrupt_callback; | ||
/*!< User data passed to callback */ | ||
|
@@ -72,6 +72,7 @@ typedef struct { | |
uint8_t points; /*!< Count of touch points saved */ | ||
|
||
struct { | ||
uint8_t track_id; /*!< Track ID */ | ||
uint16_t x; /*!< X coordinate */ | ||
uint16_t y; /*!< Y coordinate */ | ||
uint16_t strength; /*!< Strength */ | ||
|
@@ -137,14 +138,14 @@ struct esp_lcd_touch_s { | |
* @param x: Array of X coordinates | ||
* @param y: Array of Y coordinates | ||
* @param strength: Array of strengths | ||
* @param track_id: Array of track IDs | ||
* @param point_num: Count of points touched (equals with count of items in x and y array) | ||
* @param max_point_num: Maximum count of touched points to return (equals with max size of x and y array) | ||
* | ||
* @return | ||
* - Returns true, when touched and coordinates readed. Otherwise returns false. | ||
* - Returns true, when touched and coordinates read. Otherwise returns false. | ||
*/ | ||
bool (*get_xy)(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num); | ||
|
||
bool (*get_xy)(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *track_id, uint8_t *point_num, uint8_t max_point_num); | ||
|
||
#if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0) | ||
/** | ||
|
@@ -155,7 +156,7 @@ struct esp_lcd_touch_s { | |
* @param state: Button state | ||
* | ||
* @return | ||
* - Returns true, when touched and coordinates readed. Otherwise returns false. | ||
* - Returns true, when touched and coordinates read. Otherwise returns false. | ||
*/ | ||
esp_err_t (*get_button_state)(esp_lcd_touch_handle_t tp, uint8_t n, uint8_t *state); | ||
#endif | ||
|
@@ -278,14 +279,14 @@ esp_err_t esp_lcd_touch_read_data(esp_lcd_touch_handle_t tp); | |
* @param x: Array of X coordinates | ||
* @param y: Array of Y coordinates | ||
* @param strength: Array of the strengths (can be NULL) | ||
* @param track_id: Array of track IDs (can be NULL) | ||
* @param point_num: Count of points touched (equals with count of items in x and y array) | ||
* @param max_point_num: Maximum count of touched points to return (equals with max size of x and y array) | ||
* | ||
* @return | ||
* - Returns true, when touched and coordinates readed. Otherwise returns false. | ||
* - Returns true, when touched and coordinates read. Otherwise returns false. | ||
*/ | ||
bool esp_lcd_touch_get_coordinates(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num); | ||
|
||
bool esp_lcd_touch_get_coordinates(esp_lcd_touch_handle_t tp, uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *track_id, uint8_t *point_num, uint8_t max_point_num); | ||
|
||
#if (CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0) | ||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
version: "1.0.6" | ||
version: "1.1.0" | ||
description: ESP LCD Touch FT5x06 - touch controller FT5x06 | ||
url: https://github.com/espressif/esp-bsp/tree/master/components/lcd_touch/esp_lcd_touch_ft5x06 | ||
dependencies: | ||
idf: ">=4.4.2" | ||
esp_lcd_touch: | ||
version: "^1.0.4" | ||
version: "^1.2.0" | ||
public: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
version: "1.1.1" | ||
version: "1.2.0" | ||
description: ESP LCD Touch GT911 - touch controller GT911 | ||
url: https://github.com/espressif/esp-bsp/tree/master/components/lcd_touch/esp_lcd_touch_gt911 | ||
dependencies: | ||
idf: ">=4.4.2" | ||
esp_lcd_touch: | ||
version: "^1.1.0" | ||
version: "^1.2.0" | ||
public: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot change API. We can create another function with similar API.