Skip to content

Commit de115e2

Browse files
committed
feat(touch): add i2c st1633
Closes #22
1 parent 5c44656 commit de115e2

File tree

12 files changed

+400
-10
lines changed

12 files changed

+400
-10
lines changed

ESP_Panel_Board_Custom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/

examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/

examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/

examples/Panel/PanelTest/ESP_Panel_Board_Custom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/

examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/

examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/

examples/Touch/I2C/I2C.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* | Supported ESP SoCs | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
33
* | ------------------ | ----- | -------- | -------- | -------- | -------- | -------- |
44
*
5-
* | Supported Touch Controllers | CST816S | FT5x06 | GT911 | GT1151 | ST7123 | TT21100 |
6-
* | --------------------------- | ------- | ------ | ----- | ------ | ------ | ------- |
5+
* | Supported Touch Controllers | CST816S | FT5x06 | GT911 | GT1151 | ST1633 | ST7123 | TT21100 |
6+
* | --------------------------- | ------- | ------ | ----- | ------ | ------ | ------- | ------- |
77
*
88
* # I2C Touch Example
99
*
@@ -50,9 +50,9 @@
5050
* - FT5x06
5151
* - GT911, GT1151
5252
* - TT21100
53-
* - ST7123
53+
* - ST1633, ST7123
5454
*/
55-
#define EXAMPLE_TOUCH_NAME GT911
55+
#define EXAMPLE_TOUCH_NAME ST1633
5656
#define EXAMPLE_TOUCH_WIDTH (480)
5757
#define EXAMPLE_TOUCH_HEIGHT (480)
5858
#define EXAMPLE_TOUCH_I2C_FREQ_HZ (400 * 1000)

src/ESP_Panel_Library.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "touch/FT5x06.h"
4343
#include "touch/GT1151.h"
4444
#include "touch/GT911.h"
45+
#include "touch/ST1633.h"
4546
#include "touch/ST7123.h"
4647
#include "touch/TT21100.h"
4748
#include "touch/XPT2046.h"

src/touch/ST1633.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "ESP_PanelLog.h"
8+
#include "ST1633.h"
9+
10+
static const char *TAG = "ST1633_CPP";
11+
12+
ESP_PanelTouch_ST1633::ESP_PanelTouch_ST1633(ESP_PanelBus *bus, uint16_t width, uint16_t height,
13+
int rst_io, int int_io):
14+
ESP_PanelTouch(bus, width, height, rst_io, int_io)
15+
{
16+
}
17+
18+
ESP_PanelTouch_ST1633::ESP_PanelTouch_ST1633(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config):
19+
ESP_PanelTouch(bus, config)
20+
{
21+
}
22+
23+
ESP_PanelTouch_ST1633::~ESP_PanelTouch_ST1633()
24+
{
25+
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();
26+
27+
if (handle == NULL) {
28+
goto end;
29+
}
30+
31+
if (!del()) {
32+
ESP_LOGE(TAG, "Delete device failed");
33+
}
34+
35+
end:
36+
ESP_LOGD(TAG, "Destroyed");
37+
}
38+
39+
bool ESP_PanelTouch_ST1633::begin(void)
40+
{
41+
ESP_PANEL_CHECK_NULL_RET(bus, false, "Invalid bus");
42+
43+
ESP_PANEL_CHECK_ERR_RET(esp_lcd_touch_new_i2c_st1633(bus->getHandle(), &config, &handle), false, "New driver failed");
44+
45+
return true;
46+
}

src/touch/ST1633.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#pragma once
8+
9+
#include "base/esp_lcd_touch_st1633.h"
10+
#include "ESP_PanelTouch.h"
11+
12+
/**
13+
* @brief ST1633 touch device object class
14+
*
15+
* @note This class is a derived class of `ESP_PanelTouch`, user can use it directly
16+
*/
17+
class ESP_PanelTouch_ST1633 : public ESP_PanelTouch {
18+
public:
19+
/**
20+
* @brief Construct a new touch device in a simple way, the `init()` function should be called after this function
21+
*
22+
* @param bus Pointer to panel bus
23+
* @param width The width of the touch screen
24+
* @param height The height of the touch screen
25+
* @param rst_io The reset pin of the touch screen, set to `-1` if not used
26+
* @param int_io The interrupt pin of the touch screen, set to `-1` if not used
27+
*/
28+
ESP_PanelTouch_ST1633(ESP_PanelBus *bus, uint16_t width, uint16_t height, int rst_io = -1, int int_io = -1);
29+
30+
/**
31+
* @brief Construct a new touch device in a complex way, the `init()` function should be called after this function
32+
*
33+
* @param bus Pointer to panel bus
34+
* @param config Touch device configuration
35+
*/
36+
ESP_PanelTouch_ST1633(ESP_PanelBus *bus, const esp_lcd_touch_config_t &config);
37+
38+
/**
39+
* @brief Destroy the LCD device
40+
*
41+
*/
42+
~ESP_PanelTouch_ST1633() override;
43+
44+
/**
45+
* @brief Startup the touch device
46+
*
47+
* @return true if success, otherwise false
48+
*/
49+
bool begin(void) override;
50+
};

0 commit comments

Comments
 (0)