Skip to content

Commit eac574c

Browse files
committed
Added autodetect for esp32s3box-v3, see #569
1 parent 4377bba commit eac574c

File tree

2 files changed

+68
-5
lines changed

2 files changed

+68
-5
lines changed

src/lgfx/boards.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ namespace lgfx
6363
, board_M5ModuleDisplay
6464
, board_ESP32_S3_BOX_Lite
6565
, board_LoLinS3Pro
66+
, board_ESP32_S3_BOX_V3
6667
};
6768
}
6869
using namespace boards;

src/lgfx/v1_autodetect/LGFX_AutoDetect_ESP32_all.hpp

+67-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ namespace lgfx
5757
#if defined ( ARDUINO_ESP32_S3_BOX )
5858
#define LGFX_ESP32_S3_BOX
5959
#define LGFX_ESP32_S3_BOX_LITE
60-
#define LGFX_DEFAULT_BOARD board_t::board_ESP32_S3_BOX
60+
#define LGFX_ESP32_S3_BOX_V3
61+
#define LGFX_DEFAULT_BOARD board_t::board_ESP32_S3_BOX_V3
6162

6263
#elif defined ( ARDUINO_ADAFRUIT_FEATHER_ESP32S3_TFT )
6364
#define LGFX_FEATHER_ESP32_S3_TFT
@@ -1211,8 +1212,6 @@ namespace lgfx
12111212
result->panel = p;
12121213
{
12131214
auto cfg = p->config();
1214-
// cfg.pin_cs = GPIO_NUM_5;
1215-
// cfg.pin_rst = GPIO_NUM_48;
12161215
cfg.offset_rotation = 1;
12171216
p->config(cfg); // config設定;
12181217
p->setRotation(1); // config設定後に向きを設定;
@@ -1267,8 +1266,6 @@ namespace lgfx
12671266
result->panel = p;
12681267
{
12691268
auto cfg = p->config();
1270-
// cfg.pin_cs = GPIO_NUM_5;
1271-
// cfg.pin_rst = GPIO_NUM_48;
12721269
cfg.invert = true;
12731270
cfg.offset_rotation = 2;
12741271
p->config(cfg);
@@ -1278,6 +1275,67 @@ namespace lgfx
12781275
}
12791276
};
12801277

1278+
1279+
struct _detector_ESP32_S3_BOX_V3_t : public _detector_spi_t
1280+
{
1281+
constexpr _detector_ESP32_S3_BOX_V3_t(void) :
1282+
_detector_spi_t
1283+
{ board_t::board_ESP32_S3_BOX_V3
1284+
, 0, 0, 0 // TODO? ILI9342C ID Checker
1285+
, 40000000, 16000000
1286+
, GPIO_NUM_6 // MOSI
1287+
, (gpio_num_t)-1 // MISO
1288+
, GPIO_NUM_7 // SCLK
1289+
, GPIO_NUM_4 // DC
1290+
, GPIO_NUM_5 // CS
1291+
, (gpio_num_t)-1 // RST
1292+
, (gpio_num_t)-1 // TF CARD CS
1293+
, 0 // SPI MODE
1294+
, true // SPI 3wire
1295+
, SPI2_HOST // SPI HOST
1296+
} {}
1297+
1298+
void setup(_detector_result_t* result) const override
1299+
{
1300+
ESP_LOGI(LIBRARY_NAME, "[Autodetect] ESP32_S3_BOX_V3");
1301+
lgfx::pinMode(GPIO_NUM_48, lgfx::pin_mode_t::input_pullup);
1302+
auto p = new Panel_ILI9342();
1303+
result->panel = p;
1304+
{
1305+
auto cfg = p->config();
1306+
cfg.offset_rotation = 1;
1307+
p->config(cfg); // config設定;
1308+
p->setRotation(1); // config設定後に向きを設定;
1309+
p->light(_create_pwm_backlight(GPIO_NUM_47, 0, 12000));
1310+
}
1311+
1312+
{
1313+
auto t = new lgfx::Touch_GT911();
1314+
auto cfg = t->config();
1315+
cfg.pin_int = GPIO_NUM_3;
1316+
cfg.pin_sda = GPIO_NUM_8;
1317+
cfg.pin_scl = GPIO_NUM_18;
1318+
cfg.i2c_addr = 0x14;
1319+
cfg.i2c_port = I2C_NUM_0;
1320+
cfg.x_min = 0;
1321+
cfg.x_max = 319;
1322+
cfg.y_min = 0;
1323+
// Max-y = 239 + 40 pixels for "red" touch point below LCD active area
1324+
cfg.y_max = 279;
1325+
cfg.offset_rotation = 2;
1326+
cfg.bus_shared = false;
1327+
t->config(cfg);
1328+
if (!t->init())
1329+
{
1330+
cfg.i2c_addr = 0x5D; // addr change (0x14 or 0x5D)
1331+
t->config(cfg);
1332+
}
1333+
p->touch(t);
1334+
}
1335+
}
1336+
};
1337+
1338+
12811339
struct _detector_Makerfabs_ESP32_S3_TFT_Touch_SPI_t : public _detector_spi_t
12821340
{
12831341
constexpr _detector_Makerfabs_ESP32_S3_TFT_Touch_SPI_t(void) :
@@ -3245,6 +3303,7 @@ namespace lgfx
32453303
static constexpr const _detector_M5StackCoreS3_t detector_M5StackCoreS3;
32463304
static constexpr const _detector_ESP32_S3_BOX_t detector_ESP32_S3_BOX;
32473305
static constexpr const _detector_ESP32_S3_BOX_Lite_t detector_ESP32_S3_BOX_Lite;
3306+
static constexpr const _detector_ESP32_S3_BOX_V3_t detector_ESP32_S3_BOX_V3;
32483307
static constexpr const _detector_Makerfabs_ESP32_S3_TFT_Touch_SPI_t detector_Makerfabs_ESP32_S3_TFT_Touch_SPI;
32493308
static constexpr const _detector_Makerfabs_ESP32_S3_TFT_Touch_Parallel16_t detector_Makerfabs_ESP32_S3_TFT_Touch_Parallel16;
32503309
static constexpr const _detector_wywy_ESP32S3_HMI_DevKit_t detector_wywy_ESP32S3_HMI_DevKit;
@@ -3267,6 +3326,9 @@ namespace lgfx
32673326
#if defined ( LGFX_AUTODETECT ) || defined ( LGFX_ESP32_S3_BOX_LITE )
32683327
&detector_ESP32_S3_BOX_Lite,
32693328
#endif
3329+
#if defined ( LGFX_AUTODETECT ) || defined ( LGFX_ESP32_S3_BOX_V3 )
3330+
&detector_ESP32_S3_BOX_V3,
3331+
#endif
32703332
#if defined ( LGFX_AUTODETECT ) || defined ( LGFX_MAKERFABS_TFT_TOUCH_SPI )
32713333
&detector_Makerfabs_ESP32_S3_TFT_Touch_SPI,
32723334
#endif

0 commit comments

Comments
 (0)