Skip to content

Commit 4baad65

Browse files
committed
feat(box-3): added config of reset pin value (which is inverted on box-3) and updaetd so that box 3 uses gt911. now box3 works
1 parent eaba441 commit 4baad65

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

main/box.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ static constexpr size_t width = 320;
2222
static constexpr size_t height = 240;
2323
static constexpr size_t pixel_buffer_size = width * 50;
2424
static constexpr bool backlight_value = true;
25+
static constexpr bool reset_value = false;
2526
static constexpr bool invert_colors = true;
2627
static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE;
2728
static constexpr bool mirror_x = true;
2829
static constexpr bool mirror_y = true;
30+
static constexpr bool touch_invert_x = true;
31+
static constexpr bool touch_invert_y = false;
2932

3033
using DisplayDriver = espp::St7789;

main/box_3.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ static constexpr int DC_PIN_NUM = 4;
1111
static constexpr std::string_view dev_kit = "ESP32-S3-BOX-3";
1212
static constexpr gpio_num_t i2c_sda = GPIO_NUM_8;
1313
static constexpr gpio_num_t i2c_scl = GPIO_NUM_18;
14-
static constexpr bool touch_swap_xy = false;
15-
// static constexpr int clock_speed = 60 * 1000 * 1000;
16-
static constexpr int clock_speed = 20 * 1000 * 1000;
14+
static constexpr int clock_speed = 60 * 1000 * 1000;
1715
static constexpr auto spi_num = SPI2_HOST;
1816
static constexpr gpio_num_t mosi = GPIO_NUM_6;
1917
static constexpr gpio_num_t sclk = GPIO_NUM_7;
2018
static constexpr gpio_num_t spics = GPIO_NUM_5;
2119
static constexpr gpio_num_t reset = GPIO_NUM_48;
2220
static constexpr gpio_num_t dc_pin = (gpio_num_t)DC_PIN_NUM;
2321
static constexpr gpio_num_t backlight = GPIO_NUM_47;
24-
static constexpr size_t width = 320;
25-
static constexpr size_t height = 240;
26-
static constexpr size_t pixel_buffer_size = 16384;
27-
// static constexpr size_t pixel_buffer_size = width * 50;
22+
static constexpr size_t width = 240;
23+
static constexpr size_t height = 320;
24+
static constexpr size_t pixel_buffer_size = width * 50;
2825
static constexpr bool backlight_value = true;
29-
static constexpr bool invert_colors = true;
30-
static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE;
26+
static constexpr bool reset_value = true;
27+
static constexpr bool invert_colors = false;
28+
static constexpr auto rotation = espp::Display::Rotation::PORTRAIT_INVERTED;
3129
static constexpr bool mirror_x = true;
3230
static constexpr bool mirror_y = true;
31+
static constexpr bool touch_swap_xy = true;
32+
static constexpr bool touch_invert_x = true;
33+
static constexpr bool touch_invert_y = false;
3334

3435
using DisplayDriver = espp::Ili9341;

main/main.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ extern "C" void app_main(void) {
223223
.data_command_pin = dc_pin,
224224
.backlight_pin = backlight,
225225
.backlight_on_value = backlight_value,
226+
.reset_value = reset_value,
226227
.invert_colors = invert_colors,
227228
.mirror_x = mirror_x,
228229
.mirror_y = mirror_y,
@@ -276,14 +277,14 @@ extern "C" void app_main(void) {
276277
has_gt911 = i2c.probe_device(0x5d) | i2c.probe_device(0x14);
277278
logger.info("Touchpad probe results: tt21100: {}, gt911: {}", has_tt21100, has_gt911);
278279

279-
#if CONFIG_HARDWARE_BOX || CONFIG_HARDWARE_BOX_3
280+
#if CONFIG_HARDWARE_BOX
280281
logger.info("Initializing Tt21100");
281282
espp::Tt21100 touch({
282283
.read = std::bind(&espp::I2c::read, &i2c, std::placeholders::_1, std::placeholders::_2,
283284
std::placeholders::_3),
284285
});
285286
#endif
286-
#if CONFIG_HARDWARE_TDECK
287+
#if CONFIG_HARDWARE_TDECK || CONFIG_HARDWARE_BOX_3
287288
logger.info("Initializing GT911");
288289
// implement GT911
289290
espp::Gt911 touch({.write = std::bind(&espp::I2c::write, &i2c, std::placeholders::_1,
@@ -307,8 +308,8 @@ extern "C" void app_main(void) {
307308
auto touchpad = espp::TouchpadInput(espp::TouchpadInput::Config{
308309
.touchpad_read = touchpad_read,
309310
.swap_xy = touch_swap_xy,
310-
.invert_x = true,
311-
.invert_y = false,
311+
.invert_x = touch_invert_x,
312+
.invert_y = touch_invert_y,
312313
.log_level = espp::Logger::Verbosity::WARN
313314
});
314315
#endif

main/tdeck.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ static constexpr size_t width = 320;
2222
static constexpr size_t height = 240;
2323
static constexpr size_t pixel_buffer_size = width * 50;
2424
static constexpr bool backlight_value = true;
25+
static constexpr bool reset_value = false;
2526
static constexpr bool invert_colors = false;
2627
static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE_INVERTED;
2728
static constexpr bool mirror_x = true;
2829
static constexpr bool mirror_y = true;
30+
static constexpr bool touch_invert_x = true;
31+
static constexpr bool touch_invert_y = false;
2932

3033
using DisplayDriver = espp::St7789;

main/wrover_kit.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ static constexpr size_t width = 320;
1717
static constexpr size_t height = 240;
1818
static constexpr size_t pixel_buffer_size = 16384;
1919
static constexpr bool backlight_value = false;
20+
static constexpr bool reset_value = false;
2021
static constexpr bool invert_colors = false;
2122
static auto rotation = espp::Display::Rotation::LANDSCAPE;
2223
static constexpr bool mirror_x = false;

0 commit comments

Comments
 (0)