@geastack/targets 0.1.107 → 0.1.108
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/build-config.json +73 -0
- package/package.json +6 -6
- package/targets/esp32/chip_bindings/displays/sh8601.cpp +12 -2
- package/targets/esp32/chip_bindings/imu/qmi8658.cpp +10 -3
- package/targets/esp32/chip_bindings/power/axp2101.cpp +58 -0
- package/targets/esp32/chip_bindings/touch/cst9217.cpp +26 -23
- package/targets/esp32/connectivity/wifi.cpp +30 -2
- package/targets/esp32/gea_board_buttons.cmake +13 -0
- package/targets/esp32/gpio.cpp +124 -1
- package/targets/esp32/gpio_pins.h +17 -0
- package/targets/esp32/services/buttons.cpp +185 -0
- package/targets/esp32/services/buttons.h +46 -0
- package/targets/esp32/services/device_control.cpp +28 -0
- package/targets/esp32-s3-touch-amoled-1.75c/CMakeLists.txt +11 -0
- package/targets/esp32-s3-touch-amoled-1.75c/main/CMakeLists.txt +54 -0
- package/targets/esp32-s3-touch-amoled-1.75c/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-1.75c/main/gea-dependencies.json +42 -0
- package/targets/esp32-s3-touch-amoled-1.75c/main/idf_component.yml +10 -0
- package/targets/esp32-s3-touch-amoled-1.75c/main/include/board.h +113 -0
- package/targets/esp32-s3-touch-amoled-1.75c/partitions.csv +9 -0
- package/targets/esp32-s3-touch-amoled-1.75c/sdkconfig.defaults +279 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +10 -1
- package/targets/esp32-s3-touch-amoled-1.8/main/app_main.cpp +2 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +13 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/app_main.cpp +2 -0
- package/targets/esp32-s3-touch-amoled-2.06/sdkconfig.defaults +5 -3
- package/targets/esp32-s3-touch-lcd-3.49/CMakeLists.txt +11 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/CMakeLists.txt +82 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/gea-dependencies.json +42 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/idf_component.yml +8 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/include/axs15231b_panel_init.h +9 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/include/board.h +160 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/panel_reset.cpp +93 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/power.cpp +60 -0
- package/targets/esp32-s3-touch-lcd-3.49/main/touch.cpp +327 -0
- package/targets/esp32-s3-touch-lcd-3.49/partitions.csv +7 -0
- package/targets/esp32-s3-touch-lcd-3.49/sdkconfig.defaults +279 -0
- package/targets.json +60 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#include "services/buttons.h"
|
|
2
|
+
|
|
3
|
+
#if GEA_BOARD_HAS_BUTTONS
|
|
4
|
+
// Generated by the CLI from the board's and the app's "buttons" JSON.
|
|
5
|
+
#include "gea_board_buttons.h"
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#if GEA_BOARD_HAS_BUTTONS && GEA_BOARD_BUTTON_COUNT > 0
|
|
9
|
+
|
|
10
|
+
#include "gpio_pins.h"
|
|
11
|
+
#include "input.h"
|
|
12
|
+
|
|
13
|
+
#include <cstddef>
|
|
14
|
+
#include <cstdint>
|
|
15
|
+
|
|
16
|
+
#include "driver/gpio.h"
|
|
17
|
+
#include "esp_attr.h"
|
|
18
|
+
#include "esp_log.h"
|
|
19
|
+
#include "freertos/FreeRTOS.h"
|
|
20
|
+
#include "freertos/task.h"
|
|
21
|
+
|
|
22
|
+
namespace gea::platform::esp32::buttons {
|
|
23
|
+
|
|
24
|
+
namespace {
|
|
25
|
+
|
|
26
|
+
constexpr const char *kTag = "buttons";
|
|
27
|
+
constexpr std::size_t kButtonCount = sizeof(board::buttons) / sizeof(board::buttons[0]);
|
|
28
|
+
static_assert(kButtonCount <= static_cast<std::size_t>(gea::framework::input::kMaxButtons),
|
|
29
|
+
"the board declares more buttons than input.h's table holds");
|
|
30
|
+
static_assert(kButtonCount <= 32, "one notification bit per button");
|
|
31
|
+
constexpr int kDebounceMs = 20;
|
|
32
|
+
constexpr int kPollMs = 30;
|
|
33
|
+
constexpr std::uint32_t kTaskStackBytes = 2560;
|
|
34
|
+
|
|
35
|
+
int gIds[kButtonCount];
|
|
36
|
+
TaskHandle_t gTask = nullptr;
|
|
37
|
+
// Settled level per button, owned by the task.
|
|
38
|
+
bool gPressed[kButtonCount];
|
|
39
|
+
|
|
40
|
+
// Idempotent: registerButton returns the existing id for a known code.
|
|
41
|
+
void registerAll()
|
|
42
|
+
{
|
|
43
|
+
for (std::size_t i = 0; i < kButtonCount; ++i) {
|
|
44
|
+
const Button &button = board::buttons[i];
|
|
45
|
+
gIds[i] = gea::framework::input::registerButton(button.code, button.key, button.keyCode, button.pin);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
bool watched(const Button &button) { return button.source == Source::Gpio && button.pin >= 0; }
|
|
50
|
+
|
|
51
|
+
bool readPressed(const Button &button)
|
|
52
|
+
{
|
|
53
|
+
return gpio_get_level(static_cast<gpio_num_t>(button.pin)) == button.activeLevel;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// An edge disarms its pin and wakes the task with the button's bit; the task
|
|
57
|
+
// waits out the bounce, reports the settled level if it changed, and re-arms.
|
|
58
|
+
void IRAM_ATTR edge(void *arg)
|
|
59
|
+
{
|
|
60
|
+
const auto index = reinterpret_cast<std::uintptr_t>(arg);
|
|
61
|
+
const int pin = board::buttons[index].pin;
|
|
62
|
+
gpio_intr_disable(static_cast<gpio_num_t>(pin));
|
|
63
|
+
// A Gpio or Digital the app opened on this pin rides on this interrupt.
|
|
64
|
+
gea::platform::esp32::gpio::ownedPinEdge(pin);
|
|
65
|
+
BaseType_t woken = pdFALSE;
|
|
66
|
+
xTaskNotifyFromISR(gTask, 1u << index, eSetBits, &woken);
|
|
67
|
+
if (woken) portYIELD_FROM_ISR();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void settle(std::size_t index)
|
|
71
|
+
{
|
|
72
|
+
const bool pressed = readPressed(board::buttons[index]);
|
|
73
|
+
if (pressed == gPressed[index]) return;
|
|
74
|
+
gPressed[index] = pressed;
|
|
75
|
+
gea::framework::input::queueButton(gIds[index], pressed);
|
|
76
|
+
// The interrupt reported the first edge of the bounce; this is the level
|
|
77
|
+
// it settled on, for a Gpio or Digital that read the pin mid-bounce.
|
|
78
|
+
if (!board::buttons[index].poll) gea::platform::esp32::gpio::ownedPinEdge(board::buttons[index].pin);
|
|
79
|
+
ESP_LOGI(kTag, "%s %s", board::buttons[index].code, pressed ? "down" : "up");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void run(void *)
|
|
83
|
+
{
|
|
84
|
+
bool polls = false;
|
|
85
|
+
for (std::size_t i = 0; i < kButtonCount; ++i) polls = polls || (watched(board::buttons[i]) && board::buttons[i].poll);
|
|
86
|
+
// Sleeps until an edge; wakes on an interval only when a board button polls.
|
|
87
|
+
const TickType_t wait = polls ? pdMS_TO_TICKS(kPollMs) : portMAX_DELAY;
|
|
88
|
+
while (true) {
|
|
89
|
+
std::uint32_t edges = 0;
|
|
90
|
+
xTaskNotifyWait(0, UINT32_MAX, &edges, wait);
|
|
91
|
+
if (edges) vTaskDelay(pdMS_TO_TICKS(kDebounceMs));
|
|
92
|
+
for (std::size_t i = 0; i < kButtonCount; ++i) {
|
|
93
|
+
const Button &button = board::buttons[i];
|
|
94
|
+
if (!watched(button)) continue;
|
|
95
|
+
if (button.poll) {
|
|
96
|
+
settle(i);
|
|
97
|
+
} else if (edges & (1u << i)) {
|
|
98
|
+
settle(i);
|
|
99
|
+
gpio_intr_enable(static_cast<gpio_num_t>(button.pin));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
bool configure(std::size_t index)
|
|
106
|
+
{
|
|
107
|
+
const Button &button = board::buttons[index];
|
|
108
|
+
const auto pin = static_cast<gpio_num_t>(button.pin);
|
|
109
|
+
// GPIO0 is a strapping pin the bootloader may leave on another function;
|
|
110
|
+
// resetting returns any pin to a plain GPIO matrix entry.
|
|
111
|
+
gpio_reset_pin(pin);
|
|
112
|
+
gpio_config_t config{};
|
|
113
|
+
config.pin_bit_mask = 1ULL << button.pin;
|
|
114
|
+
config.mode = GPIO_MODE_INPUT;
|
|
115
|
+
config.pull_up_en = button.activeLevel == 0 ? GPIO_PULLUP_ENABLE : GPIO_PULLUP_DISABLE;
|
|
116
|
+
config.pull_down_en = button.activeLevel == 0 ? GPIO_PULLDOWN_DISABLE : GPIO_PULLDOWN_ENABLE;
|
|
117
|
+
config.intr_type = button.poll ? GPIO_INTR_DISABLE : GPIO_INTR_ANYEDGE;
|
|
118
|
+
if (gpio_config(&config) != ESP_OK) return false;
|
|
119
|
+
gPressed[index] = readPressed(button);
|
|
120
|
+
gea::platform::esp32::gpio::claimPin(button.pin, !button.poll);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
bool arm(std::size_t index)
|
|
125
|
+
{
|
|
126
|
+
const Button &button = board::buttons[index];
|
|
127
|
+
if (button.poll) return true;
|
|
128
|
+
return gpio_isr_handler_add(static_cast<gpio_num_t>(button.pin), edge,
|
|
129
|
+
reinterpret_cast<void *>(static_cast<std::uintptr_t>(index))) == ESP_OK;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
} // namespace
|
|
133
|
+
|
|
134
|
+
void start()
|
|
135
|
+
{
|
|
136
|
+
registerAll();
|
|
137
|
+
if (gTask) return;
|
|
138
|
+
bool any = false;
|
|
139
|
+
for (std::size_t i = 0; i < kButtonCount; ++i) any = any || watched(board::buttons[i]);
|
|
140
|
+
if (!any) return;
|
|
141
|
+
const esp_err_t service = gpio_install_isr_service(0);
|
|
142
|
+
if (service != ESP_OK && service != ESP_ERR_INVALID_STATE) {
|
|
143
|
+
ESP_LOGE(kTag, "GPIO interrupt service unavailable: %s", esp_err_to_name(service));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
bool configured[kButtonCount] = {};
|
|
147
|
+
for (std::size_t i = 0; i < kButtonCount; ++i)
|
|
148
|
+
configured[i] = watched(board::buttons[i]) && configure(i);
|
|
149
|
+
if (xTaskCreate(run, "buttons", kTaskStackBytes, nullptr, 5, &gTask) != pdPASS) {
|
|
150
|
+
gTask = nullptr;
|
|
151
|
+
ESP_LOGE(kTag, "task unavailable");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
for (std::size_t i = 0; i < kButtonCount; ++i) {
|
|
155
|
+
const Button &button = board::buttons[i];
|
|
156
|
+
if (!watched(button)) continue;
|
|
157
|
+
if (configured[i] && arm(i))
|
|
158
|
+
ESP_LOGI(kTag, "%s on GPIO%d (%s, active %s) sends %s",
|
|
159
|
+
button.code, button.pin, button.poll ? "polled" : "interrupt",
|
|
160
|
+
button.activeLevel ? "high" : "low", *button.key ? button.key : "no key");
|
|
161
|
+
else
|
|
162
|
+
ESP_LOGE(kTag, "%s on GPIO%d could not be configured", button.code, button.pin);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
int pmuButton()
|
|
167
|
+
{
|
|
168
|
+
// Registers in table order, so the board's buttons list in the order it
|
|
169
|
+
// declares them whichever of start() and the PMU binding runs first.
|
|
170
|
+
int id = -1;
|
|
171
|
+
for (const Button &button : board::buttons) {
|
|
172
|
+
const int registered = gea::framework::input::registerButton(button.code, button.key, button.keyCode, button.pin);
|
|
173
|
+
if (button.source == Source::Pmu && id < 0) id = registered;
|
|
174
|
+
}
|
|
175
|
+
return id;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
} // namespace gea::platform::esp32::buttons
|
|
179
|
+
|
|
180
|
+
#else
|
|
181
|
+
|
|
182
|
+
void gea::platform::esp32::buttons::start() {}
|
|
183
|
+
int gea::platform::esp32::buttons::pmuButton() { return -1; }
|
|
184
|
+
|
|
185
|
+
#endif
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
|
|
5
|
+
// A board's physical buttons, delivered to the app as key events whose `code`
|
|
6
|
+
// names the button (see input.h, registerButton). They are declared as JSON,
|
|
7
|
+
// never here: the board's "buttons" (its targets.json entry, composed
|
|
8
|
+
// definition or boards.json alias) plus the app's gea.targets.esp32.buttons.
|
|
9
|
+
// The CLI generates gea_board_buttons.h from that list (boards/buttons.mjs).
|
|
10
|
+
//
|
|
11
|
+
// GPIO buttons are interrupt-driven: an edge wakes one shared task, which
|
|
12
|
+
// debounces and reports the settled level. A button polls only when its entry
|
|
13
|
+
// says "poll": true. The PMU's power key belongs to the PMU binding, which
|
|
14
|
+
// reports it through pmuButton().
|
|
15
|
+
namespace gea::platform::esp32::buttons {
|
|
16
|
+
|
|
17
|
+
enum class Source : std::uint8_t {
|
|
18
|
+
Gpio,
|
|
19
|
+
// The power key of the board's PMU (AXP2101 PWRON).
|
|
20
|
+
Pmu,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
struct Button {
|
|
24
|
+
// The silkscreen name, PascalCase: "Boot", "Power", "Key1".
|
|
25
|
+
const char *code;
|
|
26
|
+
// The key the button stands in for when an app does not ask for it by
|
|
27
|
+
// name, and its web keyCode. "" and 0 for a button with no alias.
|
|
28
|
+
const char *key = "";
|
|
29
|
+
int keyCode = 0;
|
|
30
|
+
Source source = Source::Gpio;
|
|
31
|
+
int pin = -1;
|
|
32
|
+
// The level the pin reads while the button is held. Active-low buttons
|
|
33
|
+
// get the internal pull-up, active-high ones the pull-down.
|
|
34
|
+
int activeLevel = 0;
|
|
35
|
+
bool poll = false;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Registers the board's buttons and starts watching its GPIO buttons. A no-op
|
|
39
|
+
// on a board that declares none; safe to call more than once.
|
|
40
|
+
void start();
|
|
41
|
+
|
|
42
|
+
// The id (for input::queueButton) of the board's PMU power key, registering
|
|
43
|
+
// the table first if start() has not run yet; -1 when the board has none.
|
|
44
|
+
int pmuButton();
|
|
45
|
+
|
|
46
|
+
} // namespace gea::platform::esp32::buttons
|
|
@@ -1077,6 +1077,32 @@ void handleKey(char *&cursor)
|
|
|
1077
1077
|
std::printf("GEADEV:OK KEY keycode=%d\n", keyCode);
|
|
1078
1078
|
}
|
|
1079
1079
|
|
|
1080
|
+
// Press a named board button (board.h `buttons`) as if by hand: the app sees
|
|
1081
|
+
// the same keydown/keyup, `code` and all. Optional DOWN or UP sends one edge.
|
|
1082
|
+
// With no name, lists the board's buttons.
|
|
1083
|
+
void handleButton(char *&cursor)
|
|
1084
|
+
{
|
|
1085
|
+
const char *name = nextToken(cursor);
|
|
1086
|
+
const char *edge = nextToken(cursor);
|
|
1087
|
+
const int count = gea::framework::input::buttonCount();
|
|
1088
|
+
if (!name) {
|
|
1089
|
+
std::printf("GEADEV:OK BUTTON count=%d", count);
|
|
1090
|
+
for (int id = 0; id < count; ++id) std::printf(" %s", gea::framework::input::buttonCode(id));
|
|
1091
|
+
std::printf("\n");
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
int id = -1;
|
|
1095
|
+
for (int i = 0; i < count && id < 0; ++i)
|
|
1096
|
+
if (tokenEquals(name, gea::framework::input::buttonCode(i))) id = i;
|
|
1097
|
+
if (id < 0 || (edge && !tokenEquals(edge, "DOWN") && !tokenEquals(edge, "UP"))) {
|
|
1098
|
+
std::printf("GEADEV:ERR BUTTON usage=GEADEV_BUTTON_name_[DOWN|UP]\n");
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
if (!edge || tokenEquals(edge, "DOWN")) gea::framework::input::queueButton(id, true);
|
|
1102
|
+
if (!edge || tokenEquals(edge, "UP")) gea::framework::input::queueButton(id, false);
|
|
1103
|
+
std::printf("GEADEV:OK BUTTON code=%s edge=%s\n", gea::framework::input::buttonCode(id), edge ? edge : "press");
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1080
1106
|
// Inspect or seed app-facing localStorage from the host. GET is base64 encoded
|
|
1081
1107
|
// so tab/newline-rich values survive the line protocol, and secret-like key
|
|
1082
1108
|
// names are denied to avoid echoing credentials into terminal logs.
|
|
@@ -2835,6 +2861,8 @@ void handleCommand(char *line, CommandSource source)
|
|
|
2835
2861
|
handleRotary(cursor);
|
|
2836
2862
|
} else if (tokenEquals(command, "KEY")) {
|
|
2837
2863
|
handleKey(cursor);
|
|
2864
|
+
} else if (tokenEquals(command, "BUTTON")) {
|
|
2865
|
+
handleButton(cursor);
|
|
2838
2866
|
} else if (tokenEquals(command, "STORAGE")) {
|
|
2839
2867
|
handleStorage(cursor);
|
|
2840
2868
|
} else if (tokenEquals(command, "SWIPE")) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16)
|
|
2
|
+
|
|
3
|
+
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../esp32/components")
|
|
4
|
+
include("${CMAKE_CURRENT_LIST_DIR}/../esp32/app_project.cmake")
|
|
5
|
+
set(GEA_EMBEDDED_APP "tic-tac-toe" CACHE STRING "Example app to build (must match a package.json gea.id)")
|
|
6
|
+
set(PROJECT_VER "${GEA_EMBEDDED_APP}" CACHE STRING "Firmware app id" FORCE)
|
|
7
|
+
|
|
8
|
+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
9
|
+
idf_build_set_property(MINIMAL_BUILD ON)
|
|
10
|
+
gea_solve_dependencies_in_build_dir()
|
|
11
|
+
project(gea_embedded)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
set(GEA_BOARD_COMPONENT_DIR "${CMAKE_CURRENT_LIST_DIR}")
|
|
2
|
+
set(GEA_BOARD_TARGET_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
|
|
3
|
+
set(GEA_EMBEDDED_CPP_BOARD "esp32-s3-touch-amoled-1.75c")
|
|
4
|
+
set(GEA_EMBEDDED_CSS_DEVICE_PIXEL_RATIO "1.5" CACHE STRING "Logical CSS px to physical pixel scale for this board")
|
|
5
|
+
set(GEA_EMBEDDED_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../..")
|
|
6
|
+
cmake_path(ABSOLUTE_PATH GEA_EMBEDDED_ROOT NORMALIZE)
|
|
7
|
+
include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_framework.cmake")
|
|
8
|
+
|
|
9
|
+
# The 1.75's CO5300 glass: 466x466 visible, six columns in, on the 1.75's
|
|
10
|
+
# measured 80 MHz QSPI clock and its vendor init sequence.
|
|
11
|
+
set(GEA_BOARD_DISPLAY_WIDTH 466)
|
|
12
|
+
set(GEA_BOARD_DISPLAY_HEIGHT 466)
|
|
13
|
+
set(GEA_BOARD_QSPI_PCLK_HZ 80000000)
|
|
14
|
+
set(GEA_BOARD_FRAMEBUFFER_STREAM_FLUSH 1)
|
|
15
|
+
set(GEA_BOARD_PARTIAL_PAD_X 0)
|
|
16
|
+
set(GEA_BOARD_PARTIAL_PAD_Y 0)
|
|
17
|
+
set(GEA_BOARD_EXTRA_REQUIRES esp_codec_dev)
|
|
18
|
+
set(GEA_BOARD_EXTRA_COMPILE_DEFINITIONS
|
|
19
|
+
GEA_BOARD_HAS_SPEAKER=1
|
|
20
|
+
GEA_EMBEDDED_CO5300_WAVESHARE_175_INIT=1
|
|
21
|
+
GEA_EMBEDDED_CO5300_PANEL_X_GAP=6
|
|
22
|
+
GEA_EMBEDDED_CO5300_PANEL_Y_GAP=0
|
|
23
|
+
# The flush pipeline otherwise takes every internal DMA byte left at boot
|
|
24
|
+
# (20 rows x 2), which starves the audio task stack and WiFi. 12 rows
|
|
25
|
+
# leaves ~25 KB internal free.
|
|
26
|
+
GEA_EMBEDDED_DISPLAY_FLUSH_CHUNK_MAX=12
|
|
27
|
+
# Run the runtime on a PSRAM-stacked task and let app_main return, which
|
|
28
|
+
# hands the 32 KB internal main stack back to the heap (BLE, WiFi and the
|
|
29
|
+
# audio task all need internal RAM). Same split as the m5stack stopwatch.
|
|
30
|
+
GEA_EMBEDDED_RUNTIME_TASK_STACK_BYTES=32768
|
|
31
|
+
GEA_EMBEDDED_RUNTIME_TASK_STACK_EXTERNAL=1
|
|
32
|
+
# App native code reads the board name from this string.
|
|
33
|
+
GEA_EMBEDDED_BOARD_ID="${GEA_EMBEDDED_CPP_BOARD}"
|
|
34
|
+
# The QMI8658 reads mirrored along the screen's horizontal axis here.
|
|
35
|
+
GEA_EMBEDDED_IMU_INVERT_X=1
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
set(GEA_BOARD_PLATFORM_SOURCES
|
|
39
|
+
"${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/app_main.cpp"
|
|
40
|
+
"${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/i2c.cpp"
|
|
41
|
+
"${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/launcher_button.cpp"
|
|
42
|
+
# CST9217 glue, shared with the 1.75.
|
|
43
|
+
"${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.75/main/touch.cpp"
|
|
44
|
+
"${GEA_CHIPS}/displays/co5300/co5300.cpp"
|
|
45
|
+
"${GEA_CHIPS}/power/axp2101/axp2101.cpp"
|
|
46
|
+
"${GEA_CHIPS}/imu/qmi8658/qmi8658.cpp"
|
|
47
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/display.cpp"
|
|
48
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/displays/co5300.cpp"
|
|
49
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/power/axp2101.cpp"
|
|
50
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/touch/cst9217.cpp"
|
|
51
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/imu/qmi8658.cpp"
|
|
52
|
+
"${GEA_EMBEDDED_ROOT}/targets/esp32/chip_bindings/audio/es8311.cpp"
|
|
53
|
+
)
|
|
54
|
+
include("${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/CMakeLists.txt")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
menu "Gea Embedded"
|
|
2
|
+
|
|
3
|
+
config GEA_EMBEDDED_PRODUCTION_LOCKDOWN
|
|
4
|
+
bool "Production lockdown"
|
|
5
|
+
default n
|
|
6
|
+
help
|
|
7
|
+
Compile out Gea frame/perf logs, heap diagnostics, and the
|
|
8
|
+
diagnostics server for production firmware. Local development builds
|
|
9
|
+
should leave this disabled so serial monitor and VS Code launch
|
|
10
|
+
tasks show fps and diagnostic logs.
|
|
11
|
+
|
|
12
|
+
endmenu
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"espressif/esp_h264": {
|
|
3
|
+
"when": [
|
|
4
|
+
"network"
|
|
5
|
+
],
|
|
6
|
+
"dependency": {
|
|
7
|
+
"version": "==1.4.1"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"78/esp-opus": {
|
|
11
|
+
"when": [
|
|
12
|
+
"network"
|
|
13
|
+
],
|
|
14
|
+
"dependency": {
|
|
15
|
+
"version": "==1.0.5"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"espressif/esp_websocket_client": {
|
|
19
|
+
"when": [
|
|
20
|
+
"network"
|
|
21
|
+
],
|
|
22
|
+
"dependency": {
|
|
23
|
+
"version": "==1.8.0"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"espressif/esp_peer": {
|
|
27
|
+
"when": [
|
|
28
|
+
"network"
|
|
29
|
+
],
|
|
30
|
+
"dependency": {
|
|
31
|
+
"version": "==1.5.6"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"espressif/esp-sr": {
|
|
35
|
+
"when": [
|
|
36
|
+
"aec"
|
|
37
|
+
],
|
|
38
|
+
"dependency": {
|
|
39
|
+
"version": "==2.5.5"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Always-required SDK dependencies. Optional SDKs are selected from
|
|
2
|
+
# gea-dependencies.json by the CLI capability analyzer.
|
|
3
|
+
dependencies:
|
|
4
|
+
espressif/esp_lcd_co5300: '==2.2.0'
|
|
5
|
+
waveshare/esp_lcd_touch_cst9217: '==1.0.4'
|
|
6
|
+
esp_lcd_panel_io_additions: '^1'
|
|
7
|
+
# chip_bindings/audio/es8311.cpp
|
|
8
|
+
espressif/esp_codec_dev: '==1.6.2'
|
|
9
|
+
idf:
|
|
10
|
+
version: '>=5.3'
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "driver/gpio.h"
|
|
4
|
+
#include "driver/spi_master.h"
|
|
5
|
+
|
|
6
|
+
// Waveshare ESP32-S3-Touch-AMOLED-1.75C: the 1.75's 466x466 CO5300 AMOLED with
|
|
7
|
+
// a CST9217 touch layer, on a 32 MB board without the GPS module. Pin
|
|
8
|
+
// assignments: Waveshare's BSP (Waveshare-ESP32-components,
|
|
9
|
+
// bsp/esp32_s3_touch_amoled_1_75c/include/bsp/esp32_s3_touch_amoled_1_75c.h).
|
|
10
|
+
//
|
|
11
|
+
// It is not the 1.75 rewired with fewer parts: the panel and touch resets moved
|
|
12
|
+
// to GPIO1/GPIO2 (the 1.75's TF-card pins -- this board has no card slot) and
|
|
13
|
+
// the codec master clock to GPIO16.
|
|
14
|
+
namespace gea::platform::board {
|
|
15
|
+
|
|
16
|
+
struct I2cBusConfig {
|
|
17
|
+
gpio_num_t sda;
|
|
18
|
+
gpio_num_t scl;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
struct Co5300DisplayConfig {
|
|
22
|
+
spi_host_device_t spiHost;
|
|
23
|
+
gpio_num_t cs;
|
|
24
|
+
gpio_num_t pclk;
|
|
25
|
+
gpio_num_t data0;
|
|
26
|
+
gpio_num_t data1;
|
|
27
|
+
gpio_num_t data2;
|
|
28
|
+
gpio_num_t data3;
|
|
29
|
+
gpio_num_t reset;
|
|
30
|
+
gpio_num_t te;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
struct Cst9217TouchConfig {
|
|
34
|
+
gpio_num_t reset;
|
|
35
|
+
gpio_num_t interrupt;
|
|
36
|
+
bool swapXy;
|
|
37
|
+
bool mirrorX;
|
|
38
|
+
bool mirrorY;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
struct Es8311AudioConfig {
|
|
42
|
+
int i2sPort;
|
|
43
|
+
gpio_num_t mclk;
|
|
44
|
+
gpio_num_t bclk;
|
|
45
|
+
gpio_num_t ws;
|
|
46
|
+
gpio_num_t dout;
|
|
47
|
+
gpio_num_t din;
|
|
48
|
+
gpio_num_t powerAmplifier;
|
|
49
|
+
// The two microphones are on an ES7210 ADC (I2C 0x40) sharing the I2S
|
|
50
|
+
// bus; the ES8311's own input is not wired to a microphone.
|
|
51
|
+
int es7210Address;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
struct LauncherButtonConfig {
|
|
55
|
+
gpio_num_t pin;
|
|
56
|
+
int activeLevel;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
class Esp32S3TouchAmoled175C {
|
|
60
|
+
public:
|
|
61
|
+
// Touch, AXP2101, QMI8658, PCF85063, ES8311 and ES7210 share one bus.
|
|
62
|
+
static constexpr I2cBusConfig i2c{
|
|
63
|
+
.sda = GPIO_NUM_15,
|
|
64
|
+
.scl = GPIO_NUM_14,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
static constexpr Co5300DisplayConfig display{
|
|
68
|
+
.spiHost = SPI2_HOST,
|
|
69
|
+
.cs = GPIO_NUM_12,
|
|
70
|
+
.pclk = GPIO_NUM_38,
|
|
71
|
+
.data0 = GPIO_NUM_4,
|
|
72
|
+
.data1 = GPIO_NUM_5,
|
|
73
|
+
.data2 = GPIO_NUM_6,
|
|
74
|
+
.data3 = GPIO_NUM_7,
|
|
75
|
+
.reset = GPIO_NUM_1,
|
|
76
|
+
.te = GPIO_NUM_NC,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Orientation from the vendor BSP (waveshare/esp32_s3_touch_amoled_1_75c
|
|
80
|
+
// 3.0.0, bsp_display_new_with_handles): no swap, both axes mirrored.
|
|
81
|
+
static constexpr Cst9217TouchConfig touch{
|
|
82
|
+
.reset = GPIO_NUM_2,
|
|
83
|
+
.interrupt = GPIO_NUM_11,
|
|
84
|
+
.swapXy = false,
|
|
85
|
+
.mirrorX = true,
|
|
86
|
+
.mirrorY = true,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
static constexpr Es8311AudioConfig audio{
|
|
90
|
+
// I2S_NUM_AUTO, spelled as its value; see the AMOLED 2.06 board.h.
|
|
91
|
+
.i2sPort = -1,
|
|
92
|
+
.mclk = GPIO_NUM_16,
|
|
93
|
+
.bclk = GPIO_NUM_9,
|
|
94
|
+
.ws = GPIO_NUM_45,
|
|
95
|
+
.dout = GPIO_NUM_8,
|
|
96
|
+
.din = GPIO_NUM_10,
|
|
97
|
+
.powerAmplifier = GPIO_NUM_46,
|
|
98
|
+
.es7210Address = 0x40,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
using Board = Esp32S3TouchAmoled175C;
|
|
103
|
+
|
|
104
|
+
inline constexpr auto i2c = Board::i2c;
|
|
105
|
+
inline constexpr auto display = Board::display;
|
|
106
|
+
inline constexpr auto touch = Board::touch;
|
|
107
|
+
inline constexpr auto audio = Board::audio;
|
|
108
|
+
inline constexpr LauncherButtonConfig launcherButton{
|
|
109
|
+
.pin = GPIO_NUM_0,
|
|
110
|
+
.activeLevel = 0,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
} // namespace gea::platform::board
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Waveshare ESP32-S3-Touch-AMOLED-1.75C, 32 MB flash: two 8 MB OTA slots and a
|
|
2
|
+
# SPIFFS `storage` partition for persistent app data.
|
|
3
|
+
# Name, Type, SubType, Offset, Size
|
|
4
|
+
nvs, data, nvs, 0x9000, 0x6000
|
|
5
|
+
otadata, data, ota, 0xf000, 0x2000
|
|
6
|
+
phy_init, data, phy, 0x11000, 0x1000
|
|
7
|
+
ota_0, app, ota_0, 0x20000, 0x800000
|
|
8
|
+
ota_1, app, ota_1, 0x820000, 0x800000
|
|
9
|
+
storage, data, spiffs, 0x1020000, 0xFE0000
|