@geastack/targets 0.1.110 → 0.1.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/targets/esp32/chip_bindings/audio/ns4168.cpp +2 -2
- package/targets/esp32/chip_bindings/displays/rgb_panel.cpp +323 -4
- package/targets/esp32/chip_bindings/expanders/elecrow_stc8h1k17.cpp +155 -0
- package/targets/esp32/chip_bindings/expanders/elecrow_stc8h1k17.h +20 -0
- package/targets/esp32/chip_bindings/power/elecrow_stc8h1k17.cpp +35 -0
- package/targets/esp32/services/app_state.cpp +20 -2
- package/targets/esp32/services/device_control.cpp +59 -23
- package/targets/esp32-p4-elecrow-crowpanel-advanced-5.0.json +169 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/CMakeLists.txt +7 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/CMakeLists.txt +83 -15
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/camera.cpp +61 -5
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/launcher_button.cpp +7 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/sdcard_mount.cpp +30 -4
- package/targets.json +20 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#include "power.h"
|
|
2
|
+
|
|
3
|
+
#include "chip_bindings/expanders/elecrow_stc8h1k17.h"
|
|
4
|
+
|
|
5
|
+
// The battery (PH2.0 J3, TP4059 charger) is gauged by the STC8H1K17
|
|
6
|
+
// board-control MCU: it divides VBAT into its ADC and reads the charger's
|
|
7
|
+
// CHRG/DONE pins, and the P4 reads the result over I2C.
|
|
8
|
+
namespace gea::platform::power {
|
|
9
|
+
|
|
10
|
+
namespace {
|
|
11
|
+
namespace board_control = gea::platform::esp32::chip_bindings::expanders;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
bool Power::init()
|
|
15
|
+
{
|
|
16
|
+
board_control::Stc8h1k17Battery battery;
|
|
17
|
+
return board_control::stc8h1k17Battery(battery);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
int Power::batteryPercent()
|
|
21
|
+
{
|
|
22
|
+
board_control::Stc8h1k17Battery battery;
|
|
23
|
+
if (!board_control::stc8h1k17Battery(battery)) return -1;
|
|
24
|
+
// No cell fitted reads as (almost) no voltage: report "no battery".
|
|
25
|
+
if (battery.batteryMillivolts < 2500) return -1;
|
|
26
|
+
return battery.levelPercent > 100 ? 100 : battery.levelPercent;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
bool Power::charging()
|
|
30
|
+
{
|
|
31
|
+
board_control::Stc8h1k17Battery battery;
|
|
32
|
+
return board_control::stc8h1k17Battery(battery) && battery.chargeState == 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
} // namespace gea::platform::power
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
#include "freertos/FreeRTOS.h"
|
|
4
4
|
#include "freertos/semphr.h"
|
|
5
|
+
#include "freertos/task.h"
|
|
6
|
+
|
|
7
|
+
#include <atomic>
|
|
5
8
|
|
|
6
9
|
namespace gea::framework::services {
|
|
7
10
|
|
|
@@ -22,18 +25,33 @@ public:
|
|
|
22
25
|
return mutex_ != nullptr;
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
// The frame task holds the lock for a whole frame and takes it again
|
|
29
|
+
// straight after releasing it. A FreeRTOS mutex does not hand itself to a
|
|
30
|
+
// waiter on give, so while the app renders continuously (a blinking caret is
|
|
31
|
+
// enough) a lower-priority waiter -- the GEADEV console reading the tree or
|
|
32
|
+
// the screen -- went ~30 s without it. The task that just released steps
|
|
33
|
+
// aside for one tick when someone is waiting; nobody waits on a normal frame.
|
|
25
34
|
void lock()
|
|
26
35
|
{
|
|
27
|
-
if (mutex_)
|
|
36
|
+
if (!mutex_) return;
|
|
37
|
+
if (waiting_.load(std::memory_order_acquire) > 0 && lastReleaser_ == xTaskGetCurrentTaskHandle())
|
|
38
|
+
vTaskDelay(1);
|
|
39
|
+
waiting_.fetch_add(1, std::memory_order_acq_rel);
|
|
40
|
+
xSemaphoreTake(mutex_, portMAX_DELAY);
|
|
41
|
+
waiting_.fetch_sub(1, std::memory_order_acq_rel);
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
void unlock()
|
|
31
45
|
{
|
|
32
|
-
if (mutex_)
|
|
46
|
+
if (!mutex_) return;
|
|
47
|
+
lastReleaser_ = xTaskGetCurrentTaskHandle();
|
|
48
|
+
xSemaphoreGive(mutex_);
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
private:
|
|
36
52
|
SemaphoreHandle_t mutex_ = nullptr;
|
|
53
|
+
std::atomic<int> waiting_{0};
|
|
54
|
+
TaskHandle_t lastReleaser_ = nullptr;
|
|
37
55
|
};
|
|
38
56
|
|
|
39
57
|
} // namespace
|
|
@@ -253,12 +253,26 @@ private:
|
|
|
253
253
|
void flushLine()
|
|
254
254
|
{
|
|
255
255
|
if (lineLength_ <= 0) return;
|
|
256
|
+
// One line at a time under the stdout lock: other output can fall between
|
|
257
|
+
// data lines (the host skips it) but never inside one. Holding the lock
|
|
258
|
+
// for the whole ~10 s stream blocked every task that logged meanwhile,
|
|
259
|
+
// and the task watchdog's register dump then landed inside the data.
|
|
260
|
+
flockfile(stdout);
|
|
256
261
|
std::printf("GEADEV:DATA ");
|
|
257
262
|
std::fwrite(line_, 1, static_cast<std::size_t>(lineLength_), stdout);
|
|
258
263
|
std::printf("\n");
|
|
264
|
+
funlockfile(stdout);
|
|
259
265
|
lineLength_ = 0;
|
|
266
|
+
// The console write can busy-wait on the UART FIFO; over a ~10 s frame
|
|
267
|
+
// that starved this core's idle task and tripped the task watchdog,
|
|
268
|
+
// whose register dump then landed in the data. Let it run now and then.
|
|
269
|
+
if (++linesSinceYield_ >= 32) {
|
|
270
|
+
linesSinceYield_ = 0;
|
|
271
|
+
vTaskDelay(1);
|
|
272
|
+
}
|
|
260
273
|
}
|
|
261
274
|
|
|
275
|
+
int linesSinceYield_ = 0;
|
|
262
276
|
static constexpr int kLineLength = 76;
|
|
263
277
|
static constexpr char kAlphabet[] =
|
|
264
278
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -375,8 +389,28 @@ bool captureSnapshotPacked(std::uint8_t *snapshot, int byteCapacity, int *width,
|
|
|
375
389
|
}
|
|
376
390
|
#endif // GEA_PIXEL_STORAGE_PACKED
|
|
377
391
|
|
|
392
|
+
// Silences ESP log output for its lifetime: a log line printed into the middle
|
|
393
|
+
// of a streamed reply (a screenshot's base64, the debugger protocol) corrupts it.
|
|
394
|
+
class ScopedLogSilence {
|
|
395
|
+
public:
|
|
396
|
+
ScopedLogSilence()
|
|
397
|
+
: previous_(esp_log_level_get(nullptr))
|
|
398
|
+
{
|
|
399
|
+
esp_log_level_set("*", ESP_LOG_NONE);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
~ScopedLogSilence()
|
|
403
|
+
{
|
|
404
|
+
esp_log_level_set("*", previous_);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
private:
|
|
408
|
+
esp_log_level_t previous_;
|
|
409
|
+
};
|
|
410
|
+
|
|
378
411
|
void writeScreenshot()
|
|
379
412
|
{
|
|
413
|
+
ScopedLogSilence silence;
|
|
380
414
|
int width = 0;
|
|
381
415
|
int height = 0;
|
|
382
416
|
char appIdBuffer[96];
|
|
@@ -411,7 +445,6 @@ void writeScreenshot()
|
|
|
411
445
|
return;
|
|
412
446
|
}
|
|
413
447
|
|
|
414
|
-
flockfile(stdout);
|
|
415
448
|
std::printf("GEADEV:SCREENSHOT BEGIN width=%d height=%d encoding=rgb565-rle-v1 app=%s\n",
|
|
416
449
|
width,
|
|
417
450
|
height,
|
|
@@ -438,7 +471,6 @@ void writeScreenshot()
|
|
|
438
471
|
writer.finish();
|
|
439
472
|
std::printf("GEADEV:SCREENSHOT END\n");
|
|
440
473
|
std::fflush(stdout);
|
|
441
|
-
funlockfile(stdout);
|
|
442
474
|
|
|
443
475
|
if (heapCapsAllocated) heap_caps_free(snapshot);
|
|
444
476
|
else std::free(snapshot);
|
|
@@ -463,7 +495,6 @@ void writeScreenshot()
|
|
|
463
495
|
const char *liveAppId = gea::framework::apps::AppManager::currentId();
|
|
464
496
|
std::snprintf(appIdBuffer, sizeof(appIdBuffer), "%s", liveAppId ? liveAppId : "");
|
|
465
497
|
gea::framework::services::AppState::unlock();
|
|
466
|
-
flockfile(stdout);
|
|
467
498
|
std::printf("GEADEV:SCREENSHOT BEGIN width=%d height=%d encoding=rgb565-rle-v1 app=%s\n", width, height, appIdBuffer);
|
|
468
499
|
Base64Writer writer;
|
|
469
500
|
using gea::framework::graphics::pixel::toRgb565;
|
|
@@ -483,7 +514,6 @@ void writeScreenshot()
|
|
|
483
514
|
writer.finish();
|
|
484
515
|
std::printf("GEADEV:SCREENSHOT END\n");
|
|
485
516
|
std::fflush(stdout);
|
|
486
|
-
funlockfile(stdout);
|
|
487
517
|
return;
|
|
488
518
|
}
|
|
489
519
|
|
|
@@ -497,7 +527,6 @@ void writeScreenshot()
|
|
|
497
527
|
return;
|
|
498
528
|
}
|
|
499
529
|
|
|
500
|
-
flockfile(stdout);
|
|
501
530
|
std::printf("GEADEV:SCREENSHOT BEGIN width=%d height=%d encoding=rgb565-rle-v1 app=%s\n",
|
|
502
531
|
width,
|
|
503
532
|
height,
|
|
@@ -522,7 +551,6 @@ void writeScreenshot()
|
|
|
522
551
|
writer.finish();
|
|
523
552
|
std::printf("GEADEV:SCREENSHOT END\n");
|
|
524
553
|
std::fflush(stdout);
|
|
525
|
-
funlockfile(stdout);
|
|
526
554
|
|
|
527
555
|
if (heapCapsAllocated) heap_caps_free(snapshot);
|
|
528
556
|
else std::free(snapshot);
|
|
@@ -530,23 +558,6 @@ void writeScreenshot()
|
|
|
530
558
|
}
|
|
531
559
|
|
|
532
560
|
#if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
|
|
533
|
-
class ScopedLogSilence {
|
|
534
|
-
public:
|
|
535
|
-
ScopedLogSilence()
|
|
536
|
-
: previous_(esp_log_level_get(nullptr))
|
|
537
|
-
{
|
|
538
|
-
esp_log_level_set("*", ESP_LOG_NONE);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
~ScopedLogSilence()
|
|
542
|
-
{
|
|
543
|
-
esp_log_level_set("*", previous_);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
private:
|
|
547
|
-
esp_log_level_t previous_;
|
|
548
|
-
};
|
|
549
|
-
|
|
550
561
|
bool usbWriteAll(const void *data, std::size_t size)
|
|
551
562
|
{
|
|
552
563
|
const auto *bytes = static_cast<const std::uint8_t *>(data);
|
|
@@ -847,6 +858,16 @@ void handleI2cScan()
|
|
|
847
858
|
std::printf("GEADEV:I2CSCAN END count=%d\n", count);
|
|
848
859
|
}
|
|
849
860
|
|
|
861
|
+
// A string as one whitespace-free token: printable ASCII as is, everything
|
|
862
|
+
// else (space, backslash, UTF-8 bytes) as \xHH.
|
|
863
|
+
void printEscaped(const char *text)
|
|
864
|
+
{
|
|
865
|
+
for (const unsigned char *c = reinterpret_cast<const unsigned char *>(text); *c; ++c) {
|
|
866
|
+
if (*c > 0x20 && *c < 0x7f && *c != '\\') std::putchar(*c);
|
|
867
|
+
else std::printf("\\x%02X", *c);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
850
871
|
void handleNode(char *&cursor)
|
|
851
872
|
{
|
|
852
873
|
const char *className = nextToken(cursor);
|
|
@@ -945,6 +966,21 @@ void handleNode(char *&cursor)
|
|
|
945
966
|
textCommand ? textCommand->bh : 0,
|
|
946
967
|
textCommand ? textCommand->text.fontId : -1,
|
|
947
968
|
textCommand ? static_cast<double>(textCommand->text.scale) : 0.0);
|
|
969
|
+
// An input's value and the text it draws (bullets on a password), so a
|
|
970
|
+
// host can drive the on-screen keyboard and check what each key did.
|
|
971
|
+
const char *value = tree.getAttribute(nodeId, "value");
|
|
972
|
+
if (value || (textCommand && textCommand->text.text)) {
|
|
973
|
+
std::printf("GEADEV:NODETEXT id=%d focused=%d caret=%d value=", nodeId,
|
|
974
|
+
tree.activeInputId() == nodeId ? 1 : 0, tree.activeInputId() == nodeId ? tree.activeInputCaret() : -1);
|
|
975
|
+
printEscaped(value ? value : "");
|
|
976
|
+
std::printf(" text=");
|
|
977
|
+
printEscaped(textCommand && textCommand->text.text ? textCommand->text.text : "");
|
|
978
|
+
std::printf("\n");
|
|
979
|
+
int revealFrom = 0, revealTo = 0;
|
|
980
|
+
if (tree.inputPasswordReveal(nodeId, &revealFrom, &revealTo))
|
|
981
|
+
std::printf("GEADEV:NODEREVEAL id=%d from=%d to=%d frame_ms=%d now_ms=%d\n", nodeId, revealFrom, revealTo,
|
|
982
|
+
tree.lastFrameMs(), static_cast<int>(esp_timer_get_time() / 1000));
|
|
983
|
+
}
|
|
948
984
|
printed++;
|
|
949
985
|
}
|
|
950
986
|
gea::framework::services::AppState::unlock();
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "esp32-p4-elecrow-crowpanel-advanced-5.0",
|
|
3
|
+
"extends": "esp32-p4",
|
|
4
|
+
"adapter": "esp32-idf",
|
|
5
|
+
"mcu": "esp32p4",
|
|
6
|
+
"_comment": "Elecrow CrowPanel Advanced 5.0-HMI ESP32-P4 (V1.0 and V1.1 are electrically identical): an ESP32-P4NRW32 (rev v1.3, 32MB in-package PSRAM) with 16MB flash behind a 5-inch 800x480 IPS parallel RGB panel, a GT911 touch controller, an STC8H1K17 board-control MCU, two NS4168 amplifiers, a PDM microphone, a microSD slot, an ESP32-C6 WiFi/BLE coprocessor and an SC2336 MIPI-CSI camera. Sources: Elecrow's V1.0 schematic, its ESP32-P4-Advance-5inch factory firmware and lessons (Elecrow-RD/CrowPanel-Advanced-5inch-ESP32-P4-HMI-AI-Display-800x480-IPS-Touch-Screen).",
|
|
7
|
+
"flashSize": "16MB",
|
|
8
|
+
"_flash": "QIO at 80MHz, as Elecrow's firmware and download tool use. At the base's DIO 40MHz the panel DMA, which scans PSRAM directly, underran every few seconds and the picture crept right; at QIO 80MHz it never did.",
|
|
9
|
+
"flashMode": "qio",
|
|
10
|
+
"flashFreq": 80,
|
|
11
|
+
"_console": "The debug USB-C (J1) goes through a CH340K USB-UART bridge to UART0 (TX GPIO37, RX GPIO38) with DTR/RTS auto-reset; the second USB-C is the P4's native USB.",
|
|
12
|
+
"console": {
|
|
13
|
+
"transport": "uart",
|
|
14
|
+
"uart": 0,
|
|
15
|
+
"baud": 115200
|
|
16
|
+
},
|
|
17
|
+
"_buses": "One I2C bus on GPIO45/46 carries the GT911 (0x5d) and the STC8H1K17 (0x2f).",
|
|
18
|
+
"buses": {
|
|
19
|
+
"i2c": {
|
|
20
|
+
"sda": 45,
|
|
21
|
+
"scl": 46
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"chips": {
|
|
25
|
+
"display": {
|
|
26
|
+
"driver": "rgb_panel",
|
|
27
|
+
"interface": "rgb",
|
|
28
|
+
"width": 800,
|
|
29
|
+
"height": 480,
|
|
30
|
+
"_timing": "Elecrow's factory firmware's porches and polarities: PCLK sampled on the falling edge and idling high between lines, HSYNC/VSYNC idle high, DE idle low. Elecrow clocks it at 18MHz (42.5Hz); 26MHz gives 61.4Hz, within the ST7262's range, and the P4 scans the buffers straight out of its 200MHz PSRAM without underrunning.",
|
|
31
|
+
"pclkHz": 26000000,
|
|
32
|
+
"hsyncPulseWidth": 4,
|
|
33
|
+
"hsyncBackPorch": 8,
|
|
34
|
+
"hsyncFrontPorch": 8,
|
|
35
|
+
"vsyncPulseWidth": 4,
|
|
36
|
+
"vsyncBackPorch": 16,
|
|
37
|
+
"vsyncFrontPorch": 16,
|
|
38
|
+
"pclkActiveNeg": true,
|
|
39
|
+
"pclkIdleHigh": true,
|
|
40
|
+
"_scanFramebuffers": "No VSYNC restart, as in Elecrow's firmware, and the renderer draws straight into a buffer not being scanned. Elecrow swaps two; a third lets the next frame start while the panel still sends the old front, which with two waited up to a frame on every swap of a tab swipe.",
|
|
41
|
+
"scanFramebuffers": 3,
|
|
42
|
+
"restartInVsync": false,
|
|
43
|
+
"_pins": "data0-4 = B3-B7, data5-10 = G2-G7, data11-15 = R3-R7. The backlight is the STC8's PWM (board-control line 4); the panel has no reset GPIO and no init bus.",
|
|
44
|
+
"pins": {
|
|
45
|
+
"de": 2,
|
|
46
|
+
"hsync": 40,
|
|
47
|
+
"vsync": 41,
|
|
48
|
+
"pclk": 3,
|
|
49
|
+
"data0": 8,
|
|
50
|
+
"data1": 7,
|
|
51
|
+
"data2": 6,
|
|
52
|
+
"data3": 5,
|
|
53
|
+
"data4": 4,
|
|
54
|
+
"data5": 14,
|
|
55
|
+
"data6": 13,
|
|
56
|
+
"data7": 12,
|
|
57
|
+
"data8": 11,
|
|
58
|
+
"data9": 10,
|
|
59
|
+
"data10": 9,
|
|
60
|
+
"data11": 19,
|
|
61
|
+
"data12": 18,
|
|
62
|
+
"data13": 17,
|
|
63
|
+
"data14": 16,
|
|
64
|
+
"data15": 15
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"touch": {
|
|
68
|
+
"driver": "gt911",
|
|
69
|
+
"interface": "i2c",
|
|
70
|
+
"pins": {
|
|
71
|
+
"reset": 36,
|
|
72
|
+
"interrupt": 42
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"audio": {
|
|
76
|
+
"driver": "ns4168",
|
|
77
|
+
"interface": "i2s",
|
|
78
|
+
"_pins": "Two NS4168 amplifiers share BCLK GPIO22, LRCLK GPIO21 and SDIN GPIO23. The microphone is a PDM part: CLK GPIO24, DATA GPIO25.",
|
|
79
|
+
"pins": {
|
|
80
|
+
"bclk": 22,
|
|
81
|
+
"ws": 21,
|
|
82
|
+
"dout": 23,
|
|
83
|
+
"micBclk": 24,
|
|
84
|
+
"micDin": 25
|
|
85
|
+
},
|
|
86
|
+
"_expander": "Amplifier shutdown is board-control line 2 (high = off); there is no mute line.",
|
|
87
|
+
"expander": {
|
|
88
|
+
"shutdown": 2
|
|
89
|
+
},
|
|
90
|
+
"microphone": "pdm"
|
|
91
|
+
},
|
|
92
|
+
"power": {
|
|
93
|
+
"driver": "elecrow_stc8h1k17_battery",
|
|
94
|
+
"interface": "i2c",
|
|
95
|
+
"_battery": "The PH2.0 battery (TP4059 charger) is gauged by the STC8H1K17: VBAT through its ADC plus the charger's CHRG/DONE pins, read over I2C."
|
|
96
|
+
},
|
|
97
|
+
"expander": {
|
|
98
|
+
"driver": "elecrow_stc8h1k17",
|
|
99
|
+
"interface": "i2c",
|
|
100
|
+
"address": 47,
|
|
101
|
+
"_outputs": "STC8H1K17 lines: 0 touch reset (not fitted), 1 camera reset, 2 amplifier shutdown, 3 LCD backlight power (not fitted), 4 backlight PWM (register 0x20, 0-100).",
|
|
102
|
+
"initialDirections": 0,
|
|
103
|
+
"initialOutputs": 0,
|
|
104
|
+
"outputs": {
|
|
105
|
+
"backlight": 4,
|
|
106
|
+
"powerAmplifier": 2
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"_wireless": "An ESP32-C6-MINI-1 on SDIO slot 1, 4-bit at 40MHz: D3..D0 = GPIO49..52, CLK 53, CMD 54, and its EN on GPIO20 (active high), per Elecrow's schematic and factory sdkconfig.",
|
|
111
|
+
"wireless": {
|
|
112
|
+
"coprocessor": "esp32c6",
|
|
113
|
+
"transport": "sdio",
|
|
114
|
+
"slot": 1,
|
|
115
|
+
"busWidth": 4,
|
|
116
|
+
"clockKhz": 40000,
|
|
117
|
+
"resetActiveHigh": true,
|
|
118
|
+
"pins": {
|
|
119
|
+
"clk": 53,
|
|
120
|
+
"cmd": 54,
|
|
121
|
+
"d0": 52,
|
|
122
|
+
"d1": 51,
|
|
123
|
+
"d2": 50,
|
|
124
|
+
"d3": 49,
|
|
125
|
+
"reset": 20
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"_camera": "An SC2336 on the 2-lane MIPI-CSI connector, facing out of the front of the landscape panel. SCCB has its own bus (GPIO33/34, level-shifted to the sensor's 1.8V I/O); reset is board-control line 1; XCLK comes from an on-board 24MHz oscillator. RAW8 1024x600 30fps is the mode Elecrow's own firmware streams on this rev-v1.3 silicon.",
|
|
129
|
+
"camera": {
|
|
130
|
+
"interface": "mipi-csi",
|
|
131
|
+
"sensor": "sc2336",
|
|
132
|
+
"mode": "MIPI_RAW8_1024x600_30FPS",
|
|
133
|
+
"width": 1024,
|
|
134
|
+
"height": 600,
|
|
135
|
+
"sccb": {
|
|
136
|
+
"sda": 33,
|
|
137
|
+
"scl": 34
|
|
138
|
+
},
|
|
139
|
+
"reset": {
|
|
140
|
+
"expander": 1
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"_storage": "The TF slot runs SD_MMC 1-bit on slot 0: CLK GPIO43, CMD GPIO44, D0 GPIO39 (D1-D3 only have pull-ups).",
|
|
144
|
+
"storage": {
|
|
145
|
+
"microSD": {
|
|
146
|
+
"interface": "sdmmc-1bit",
|
|
147
|
+
"pins": {
|
|
148
|
+
"clk": 43,
|
|
149
|
+
"cmd": 44,
|
|
150
|
+
"data0": 39
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"_controls": "BOOT is GPIO35.",
|
|
155
|
+
"controls": {
|
|
156
|
+
"launcherButton": {
|
|
157
|
+
"pin": 35,
|
|
158
|
+
"activeLevel": 0
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"_partitions": "16MB flash: two ~7.9MB OTA app slots (the esp32-p4 base's own table is laid out for the Waveshare board's 32MB).",
|
|
162
|
+
"partitions": {
|
|
163
|
+
"nvs": { "type": "data", "subtype": "nvs", "offset": "0x9000", "size": "0x6000" },
|
|
164
|
+
"otadata": { "type": "data", "subtype": "ota", "offset": "0xf000", "size": "0x2000" },
|
|
165
|
+
"phy_init": { "type": "data", "subtype": "phy", "offset": "0x11000", "size": "0x1000" },
|
|
166
|
+
"ota_0": { "type": "app", "subtype": "ota_0", "offset": "0x20000", "size": "0x7f0000" },
|
|
167
|
+
"ota_1": { "type": "app", "subtype": "ota_1", "offset": "0x810000", "size": "0x7f0000" }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.16)
|
|
2
2
|
|
|
3
|
+
# Resolve exactly what main/idf_component.yml pins. The component manager's
|
|
4
|
+
# "is there a newer version" pass reads registry metadata for releases this
|
|
5
|
+
# board never uses, and newer esp_hosted releases gate their USB-host transports
|
|
6
|
+
# on `$CONFIG{ESP_HOSTED_HOST_USB_*} == 1` rules that no Kconfig in the build
|
|
7
|
+
# defines -- which stops every fresh dependency solve at configure time.
|
|
8
|
+
set(ENV{IDF_COMPONENT_CHECK_NEW_VERSION} 0)
|
|
9
|
+
|
|
3
10
|
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../esp32/components")
|
|
4
11
|
include("${CMAKE_CURRENT_LIST_DIR}/../esp32/app_project.cmake")
|
|
5
12
|
set(GEA_EMBEDDED_APP "tic-tac-toe" CACHE STRING "Example app to build (must match a package.json gea.id)")
|
|
@@ -7,6 +7,31 @@ cmake_path(ABSOLUTE_PATH GEA_EMBEDDED_ROOT NORMALIZE)
|
|
|
7
7
|
include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_framework.cmake")
|
|
8
8
|
include("${GEA_EMBEDDED_ROOT}/targets/cmake/geatsc_generated_archive.cmake")
|
|
9
9
|
|
|
10
|
+
# This project is also the esp32-p4 base for composed boards (targets/<id>.json,
|
|
11
|
+
# `extends: esp32-p4`), as esp32-s3-touch-amoled-2.06 is for esp32-s3. Their JSON
|
|
12
|
+
# definition names the chips and pins; the gea CLI generates board.h and
|
|
13
|
+
# target.cmake from it into the build directory before configure, and passes the
|
|
14
|
+
# definition both as -DGEA_BOARD_DEFINITION and in the environment: IDF's
|
|
15
|
+
# requirement-extraction pass (cmake -P) runs before the -D arguments reach the
|
|
16
|
+
# cache, and a composed chip's own REQUIRES have to be visible in that pass.
|
|
17
|
+
set(GEA_CUSTOM_TARGET_ACTIVE 0)
|
|
18
|
+
if(NOT GEA_BOARD_DEFINITION AND DEFINED ENV{GEA_BOARD_DEFINITION})
|
|
19
|
+
set(GEA_BOARD_DEFINITION "$ENV{GEA_BOARD_DEFINITION}")
|
|
20
|
+
endif()
|
|
21
|
+
if(GEA_BOARD_DEFINITION)
|
|
22
|
+
if(NOT GEA_CUSTOM_TARGET_DIR AND DEFINED ENV{GEA_CUSTOM_TARGET_DIR})
|
|
23
|
+
set(GEA_CUSTOM_TARGET_DIR "$ENV{GEA_CUSTOM_TARGET_DIR}")
|
|
24
|
+
endif()
|
|
25
|
+
if(NOT GEA_CUSTOM_TARGET_DIR)
|
|
26
|
+
set(GEA_CUSTOM_TARGET_DIR "${CMAKE_BINARY_DIR}/gea-custom-target")
|
|
27
|
+
endif()
|
|
28
|
+
if(NOT EXISTS "${GEA_CUSTOM_TARGET_DIR}/target.cmake")
|
|
29
|
+
message(FATAL_ERROR "Custom board files were not generated at ${GEA_CUSTOM_TARGET_DIR}. Run this target through the gea CLI (gea build --board <alias>).")
|
|
30
|
+
endif()
|
|
31
|
+
include("${GEA_CUSTOM_TARGET_DIR}/target.cmake")
|
|
32
|
+
message(STATUS "Custom board: ${GEA_BOARD_DEFINITION}")
|
|
33
|
+
endif()
|
|
34
|
+
|
|
10
35
|
# GEA_EMBEDDED_APP must be set explicitly in the real configure pass — no
|
|
11
36
|
# default. The build script `scripts/board` passes
|
|
12
37
|
# `-DGEA_EMBEDDED_APP=<id>` for every command, so this is invisible in
|
|
@@ -29,6 +54,19 @@ endif()
|
|
|
29
54
|
|
|
30
55
|
set(GEA_EMBEDDED_HTTPS_SUPPORT "auto" CACHE STRING "Enable HTTPS fetch support: auto, on, or off")
|
|
31
56
|
set(GEA_EMBEDDED_CPP_BOARD "esp32-p4-waveshare-touch-lcd-7" CACHE STRING "Board profile passed to geatsc for C++ target selection")
|
|
57
|
+
# A composed board builds through this project but is not this board: geatsc gets
|
|
58
|
+
# its own name, panel pixel order and font viewport.
|
|
59
|
+
set(GEA_EMBEDDED_TARGET_PIXEL_PANEL_ENDIAN 0)
|
|
60
|
+
set(GEA_EMBEDDED_FONT_VIEWPORT_ARGS "")
|
|
61
|
+
if(GEA_CUSTOM_TARGET_ACTIVE AND GEA_CUSTOM_TARGET_BOARD_ID)
|
|
62
|
+
set(GEA_EMBEDDED_CPP_BOARD "${GEA_CUSTOM_TARGET_BOARD_ID}")
|
|
63
|
+
set(GEA_EMBEDDED_TARGET_PIXEL_PANEL_ENDIAN ${GEA_CUSTOM_TARGET_PIXEL_PANEL_ENDIAN})
|
|
64
|
+
if(GEA_CUSTOM_TARGET_VIEWPORT_WIDTH AND GEA_CUSTOM_TARGET_VIEWPORT_HEIGHT)
|
|
65
|
+
set(GEA_EMBEDDED_FONT_VIEWPORT_ARGS
|
|
66
|
+
--font-viewport-width ${GEA_CUSTOM_TARGET_VIEWPORT_WIDTH}
|
|
67
|
+
--font-viewport-height ${GEA_CUSTOM_TARGET_VIEWPORT_HEIGHT})
|
|
68
|
+
endif()
|
|
69
|
+
endif()
|
|
32
70
|
set(GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO "1.0" CACHE STRING "Logical CSS px to physical pixel scale for this board")
|
|
33
71
|
|
|
34
72
|
# Write a file only when its content would change. Preserves mtime when content matches,
|
|
@@ -285,19 +323,51 @@ if(_GEA_EMBEDDED_ENABLE_HTTPS)
|
|
|
285
323
|
list(APPEND GEA_EMBEDDED_HTTPS_REQUIRES mbedtls)
|
|
286
324
|
endif()
|
|
287
325
|
|
|
326
|
+
# The board's own chips: the Waveshare MIPI-DSI ILI9881C panel, GT911 touch,
|
|
327
|
+
# power, QMI8658 IMU and ES8311 codec -- or, for a composed board, the ones its
|
|
328
|
+
# definition names (the rgb_panel binding IS the Display; touch, power, IMU,
|
|
329
|
+
# expander and RTC or their *_absent backends; the speaker's binding).
|
|
330
|
+
if(GEA_CUSTOM_TARGET_ACTIVE)
|
|
331
|
+
set(GEA_P4_BOARD_SOURCES ${GEA_CUSTOM_TARGET_DISPLAY_SOURCES} ${GEA_CUSTOM_TARGET_PERIPHERAL_SOURCES})
|
|
332
|
+
set(GEA_P4_BOARD_REQUIRES ${GEA_CUSTOM_TARGET_REQUIRES})
|
|
333
|
+
set(GEA_P4_BOARD_DEFINITIONS ${GEA_CUSTOM_TARGET_COMPILE_DEFINITIONS} GEA_CUSTOM_TARGET_ACTIVE=1)
|
|
334
|
+
if(GEA_CUSTOM_TARGET_AUDIO_SOURCES)
|
|
335
|
+
list(APPEND GEA_P4_BOARD_SOURCES ${GEA_CUSTOM_TARGET_AUDIO_SOURCES} "${GEA_HOST}/audio_runtime.cpp")
|
|
336
|
+
list(APPEND GEA_P4_BOARD_DEFINITIONS GEA_EMBEDDED_APP_USES_AUDIO=1 GEA_BOARD_HAS_SPEAKER=1)
|
|
337
|
+
else()
|
|
338
|
+
list(APPEND GEA_P4_BOARD_SOURCES "${GEA_EMBEDDED_ROOT}/targets/esp32/services/audio_runtime_stub.cpp")
|
|
339
|
+
list(APPEND GEA_P4_BOARD_DEFINITIONS GEA_EMBEDDED_AUDIO_UNUSED=1)
|
|
340
|
+
endif()
|
|
341
|
+
else()
|
|
342
|
+
set(GEA_P4_BOARD_SOURCES
|
|
343
|
+
"display.cpp"
|
|
344
|
+
"power.cpp"
|
|
345
|
+
"touch.cpp"
|
|
346
|
+
"${GEA_CHIPS}/imu/qmi8658/qmi8658.cpp"
|
|
347
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/audio/es8311.cpp"
|
|
348
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/imu/qmi8658.cpp"
|
|
349
|
+
"${GEA_HOST}/audio_runtime.cpp"
|
|
350
|
+
)
|
|
351
|
+
set(GEA_P4_BOARD_REQUIRES esp_lcd_ili9881c esp_lcd_touch_gt911)
|
|
352
|
+
set(GEA_P4_BOARD_DEFINITIONS
|
|
353
|
+
GEA_CUSTOM_TARGET_ACTIVE=0
|
|
354
|
+
GEA_EMBEDDED_PIXEL_PANEL_ENDIAN=0
|
|
355
|
+
GEA_EMBEDDED_DISPLAY_WIDTH=720
|
|
356
|
+
GEA_EMBEDDED_DISPLAY_HEIGHT=1280
|
|
357
|
+
GEA_EMBEDDED_DISPLAY_NATIVE_WIDTH=720
|
|
358
|
+
GEA_EMBEDDED_DISPLAY_NATIVE_HEIGHT=1280
|
|
359
|
+
)
|
|
360
|
+
endif()
|
|
361
|
+
|
|
288
362
|
idf_component_register(
|
|
289
363
|
SRCS
|
|
290
364
|
"app_main.cpp"
|
|
365
|
+
# The MIPI-CSI camera; it declines to start when the board has none.
|
|
291
366
|
"camera.cpp"
|
|
292
|
-
"display.cpp"
|
|
293
367
|
"i2c.cpp"
|
|
294
368
|
"launcher_button.cpp"
|
|
295
|
-
"power.cpp"
|
|
296
369
|
"sdcard_mount.cpp"
|
|
297
|
-
|
|
298
|
-
"${GEA_CHIPS}/imu/qmi8658/qmi8658.cpp"
|
|
299
|
-
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/audio/es8311.cpp"
|
|
300
|
-
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/imu/qmi8658.cpp"
|
|
370
|
+
${GEA_P4_BOARD_SOURCES}
|
|
301
371
|
"${GEA_EMBEDDED_ROOT}/targets/esp32/apps/app_manager.cpp"
|
|
302
372
|
"${GEA_EMBEDDED_ROOT}/targets/esp32/connectivity/diagnostics_transport.cpp"
|
|
303
373
|
# WiFi station driver (registerDriver / WifiStation). On P4 its esp_wifi_*
|
|
@@ -309,7 +379,6 @@ idf_component_register(
|
|
|
309
379
|
${GEA_FW_APP_SENSITIVE_SOURCES}
|
|
310
380
|
# esp32-specific host shims (generic host + services come from the manifest):
|
|
311
381
|
"${GEA_HOST}/host/rtc_esp.cpp"
|
|
312
|
-
"${GEA_HOST}/audio_runtime.cpp"
|
|
313
382
|
"${GEA_EMBEDDED_ROOT}/targets/esp32/services/app_runner.cpp"
|
|
314
383
|
"${GEA_EMBEDDED_ROOT}/targets/esp32/services/app_state.cpp"
|
|
315
384
|
"${GEA_EMBEDDED_ROOT}/targets/esp32/services/battery_service.cpp"
|
|
@@ -323,6 +392,8 @@ idf_component_register(
|
|
|
323
392
|
"${GEA_EMBEDDED_ROOT}/targets/esp32/services/heap.cpp"
|
|
324
393
|
${APP_GENERATED_SOURCES}
|
|
325
394
|
INCLUDE_DIRS
|
|
395
|
+
# A composed board's generated board.h comes before this board's own.
|
|
396
|
+
${GEA_CUSTOM_TARGET_INCLUDE_DIR}
|
|
326
397
|
"include"
|
|
327
398
|
"${GEA_EMBEDDED_ROOT}/targets/esp32"
|
|
328
399
|
${GEA_FW_INCLUDE_DIRS}
|
|
@@ -362,8 +433,7 @@ idf_component_register(
|
|
|
362
433
|
fatfs
|
|
363
434
|
esp_codec_dev
|
|
364
435
|
esp_video
|
|
365
|
-
|
|
366
|
-
esp_lcd_touch_gt911
|
|
436
|
+
${GEA_P4_BOARD_REQUIRES}
|
|
367
437
|
LDFRAGMENTS
|
|
368
438
|
)
|
|
369
439
|
|
|
@@ -394,16 +464,13 @@ if(DEFINED ENV{GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG})
|
|
|
394
464
|
endif()
|
|
395
465
|
|
|
396
466
|
target_compile_definitions(${COMPONENT_LIB} PRIVATE
|
|
397
|
-
|
|
467
|
+
${GEA_P4_BOARD_DEFINITIONS}
|
|
468
|
+
GEA_EMBEDDED_BOARD_ID="${GEA_EMBEDDED_CPP_BOARD}"
|
|
398
469
|
GEA_CPP_ENABLE_REGEX=0
|
|
399
470
|
GEA_CPP_USE_TO_CHARS_DOUBLE=0
|
|
400
471
|
GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG=${GEA_EMBEDDED_HEAP_DIAGNOSTICS_LOG_VALUE}
|
|
401
472
|
GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO=${GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO}
|
|
402
473
|
GEA_EMBEDDED_HAS_GENERATED_FONTS=1
|
|
403
|
-
GEA_EMBEDDED_DISPLAY_WIDTH=720
|
|
404
|
-
GEA_EMBEDDED_DISPLAY_HEIGHT=1280
|
|
405
|
-
GEA_EMBEDDED_DISPLAY_NATIVE_WIDTH=720
|
|
406
|
-
GEA_EMBEDDED_DISPLAY_NATIVE_HEIGHT=1280
|
|
407
474
|
# WiFi re-enabled for network apps (e.g. maps OSM tiles). Was =1 to isolate
|
|
408
475
|
# whether WiFi PSRAM/cache-bus contention starves the direct-PSRAM SPI flush
|
|
409
476
|
# FIFO; the WPA2-auth stack overflow is already mitigated by the osi_funcs
|
|
@@ -483,7 +550,8 @@ add_custom_command(
|
|
|
483
550
|
--out-dir ${GENERATED_APP_DIR}
|
|
484
551
|
--geatsc-bin ${_GEATSC_BIN}
|
|
485
552
|
--font-device-pixel-ratio ${GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO}
|
|
486
|
-
--pixel-panel-endian
|
|
553
|
+
--pixel-panel-endian ${GEA_EMBEDDED_TARGET_PIXEL_PANEL_ENDIAN}
|
|
554
|
+
${GEA_EMBEDDED_FONT_VIEWPORT_ARGS}
|
|
487
555
|
--gea-ir-backend
|
|
488
556
|
# gea.compilerPlugins: an app's own geatsc plugins, e.g. the one that
|
|
489
557
|
# declares its native host-function boundary. Empty for most apps.
|