@geastack/targets 0.1.103 → 0.1.104
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/README.md +7 -0
- package/package.json +6 -6
- package/targets/cmake/geatsc-generated-archive-build.mjs +41 -12
- package/targets/esp32/app_project.cmake +23 -27
- package/targets/esp32/chip_bindings/magnetometer/bmm150.cpp +140 -0
- package/targets/esp32/chip_bindings/touch/cst9217.cpp +27 -3
- package/targets/esp32/chip_bindings/touch/cst9217_controller.h +11 -2
- package/targets/esp32/components/gea_framework/CMakeLists.txt +9 -5
- package/targets/esp32/components/gea_framework/project_include.cmake +22 -0
- package/targets/esp32/esp_now.cpp +298 -0
- package/targets/esp32/esp_now_power.h +17 -0
- package/targets/esp32/esp_now_rate.h +57 -0
- package/targets/esp32/esp_now_tx_header.h +46 -0
- package/targets/esp32/gea_framework.cmake +1 -0
- package/targets/esp32/ldfragments/gea_ui_state_external.lf +11 -0
- package/targets/esp32/services/device_control.cpp +29 -11
- package/targets/esp32/services/frame_scheduler.cpp +7 -0
- package/targets/esp32/uart.cpp +7 -1
- package/targets/esp32-m5stack-m5paper/CMakeLists.txt +1 -0
- package/targets/esp32-m5stack-m5paper/main/idf_component.yml +7 -4
- package/targets/esp32-p4-m5stack-tab5/CMakeLists.txt +1 -0
- package/targets/esp32-p4-m5stack-tab5/main/CMakeLists.txt +4 -0
- package/targets/esp32-p4-m5stack-tab5/main/idf_component.yml +9 -6
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/CMakeLists.txt +1 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/CMakeLists.txt +4 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/display.cpp +21 -5
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/idf_component.yml +8 -5
- package/targets/esp32-p4-waveshare-touch-lcd-7/CMakeLists.txt +1 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/CMakeLists.txt +4 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/display.cpp +16 -5
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/idf_component.yml +8 -5
- package/targets/esp32-s3-elecrow-rotary-2.1/CMakeLists.txt +1 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/CMakeLists.txt +3 -3
- package/targets/esp32-s3-elecrow-rotary-2.1/main/idf_component.yml +5 -2
- package/targets/esp32-s3-epaper-1.54/CMakeLists.txt +1 -0
- package/targets/esp32-s3-epaper-1.54/main/CMakeLists.txt +9 -9
- package/targets/esp32-s3-epaper-1.54/main/idf_component.yml +7 -4
- package/targets/esp32-s3-lilygo-t-display-s3-long/CMakeLists.txt +1 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/idf_component.yml +7 -4
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/CMakeLists.txt +1 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/idf_component.yml +4 -1
- package/targets/esp32-s3-m5stack-papers3/CMakeLists.txt +1 -0
- package/targets/esp32-s3-m5stack-papers3/main/idf_component.yml +7 -4
- package/targets/esp32-s3-m5stack-sticks3/CMakeLists.txt +1 -0
- package/targets/esp32-s3-m5stack-sticks3/main/CMakeLists.txt +2 -1
- package/targets/esp32-s3-m5stack-sticks3/main/idf_component.yml +6 -3
- package/targets/esp32-s3-m5stack-stopwatch/CMakeLists.txt +1 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/gea-dependencies.json +42 -0
- package/targets/esp32-s3-m5stack-stopwatch/main/idf_component.yml +4 -18
- package/targets/esp32-s3-touch-amoled-1.75/CMakeLists.txt +1 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/idf_component.yml +8 -5
- package/targets/esp32-s3-touch-amoled-1.8/CMakeLists.txt +1 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +9 -4
- package/targets/esp32-s3-touch-amoled-1.8/main/gea-dependencies.json +26 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/idf_component.yml +6 -18
- package/targets/esp32-s3-touch-amoled-2.06/CMakeLists.txt +1 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +11 -10
- package/targets/esp32-s3-touch-amoled-2.06/main/gea-dependencies.json +58 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/idf_component.yml +4 -42
- package/targets/esp32-s3-touch-amoled-2.41/CMakeLists.txt +1 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/gea-dependencies.json +42 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/idf_component.yml +5 -30
- package/targets/esp32-s3-touch-lcd-1.54/CMakeLists.txt +1 -0
- package/targets/esp32-s3-touch-lcd-1.54/main/idf_component.yml +8 -5
- package/targets/esp32-s3-touch-lcd-3.5b/CMakeLists.txt +1 -0
- package/targets/esp32-s3-touch-lcd-3.5b/main/gea-dependencies.json +26 -0
- package/targets/esp32-s3-touch-lcd-3.5b/main/idf_component.yml +4 -20
- package/targets/esp32-s31-espressif-mosaico/CMakeLists.txt +1 -0
- package/targets/esp32-s31-espressif-mosaico/README.md +10 -2
- package/targets/esp32-s31-espressif-mosaico/dependencies.lock +7 -334
- package/targets/esp32-s31-espressif-mosaico/main/CMakeLists.txt +9 -1
- package/targets/esp32-s31-espressif-mosaico/main/board_power.cpp +13 -1
- package/targets/esp32-s31-espressif-mosaico/main/gea-dependencies.json +52 -0
- package/targets/esp32-s31-espressif-mosaico/main/idf_component.yml +13 -40
- package/targets/esp32-s31-espressif-mosaico/main/include/board.h +6 -0
- package/targets/esp32-s31-espressif-mosaico/main/include/mosaico_peer_uart_pins.h +2 -2
- package/targets/esp32-s31-espressif-mosaico/partitions.csv +1 -1
- package/targets/esp32-s3-m5stack-stopwatch/.clang-format +0 -10
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @geastack/targets
|
|
2
2
|
|
|
3
|
+
The CLI analyzes application APIs to select camera, networking, and audio
|
|
4
|
+
capabilities. Microphone capture combined with playback enables full duplex and
|
|
5
|
+
AEC automatically; playback alone does not. Resolved capabilities live in the
|
|
6
|
+
generated build configuration, rather than per-capability environment variables.
|
|
7
|
+
Each ESP32 target keeps optional SDK dependencies in `main/gea-dependencies.json`;
|
|
8
|
+
the CLI generates an IDF dependency component containing only the selected SDKs.
|
|
9
|
+
|
|
3
10
|
Native embedded build targets for GeaStack. The package ships the ESP32 and
|
|
4
11
|
RP2350 board sources, board catalog, BLE/WiFi OTA clients, and build/flash
|
|
5
12
|
adapter used by the `gea` CLI.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/targets",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.104",
|
|
4
4
|
"description": "Native embedded build targets (ESP32-IDF, RP2350) for geastack apps: board sources, target catalog, and CMake glue driven by the gea CLI.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@geastack/chips": "^0.1.6",
|
|
40
|
-
"@geastack/compiler": "^1.0.
|
|
41
|
-
"@geastack/core": "0.1.
|
|
40
|
+
"@geastack/compiler": "^1.0.34",
|
|
41
|
+
"@geastack/core": "0.1.44",
|
|
42
42
|
"@geastack/elements": "^0.1.6",
|
|
43
|
-
"@geastack/engine": "^0.1.
|
|
43
|
+
"@geastack/engine": "^0.1.18",
|
|
44
44
|
"@geastack/geaos": "^0.1.3",
|
|
45
|
-
"@geastack/geatsc-plugin-gea": "0.1.
|
|
46
|
-
"@geastack/host": "0.1.
|
|
45
|
+
"@geastack/geatsc-plugin-gea": "0.1.24",
|
|
46
|
+
"@geastack/host": "0.1.18"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"test": "for f in $(git ls-files | grep -E '(^|/)(test[-_][^/]*|[^/]*\\.test)\\.mjs$'); do echo \"==> $f\"; node \"$f\" || exit 1; done"
|
|
@@ -89,6 +89,18 @@ function firstRule(text) {
|
|
|
89
89
|
return text.replace(/\\\r?\n/g, ' ').split(/\r?\n/, 1)[0] ?? ''
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
// A Windows host's compiler names the target and every dependency with a
|
|
93
|
+
// drive (`C:\...` or `C:/...`). That colon belongs to the path; taking it for
|
|
94
|
+
// the rule separator turned every dependency into garbage, so no object was
|
|
95
|
+
// ever found up to date there.
|
|
96
|
+
function isDriveColon(rule, index) {
|
|
97
|
+
return (
|
|
98
|
+
/[A-Za-z]/.test(rule[index - 1] ?? '') &&
|
|
99
|
+
(index === 1 || /\s/.test(rule[index - 2])) &&
|
|
100
|
+
/[\\/]/.test(rule[index + 1] ?? '')
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
92
104
|
function ruleColon(rule) {
|
|
93
105
|
let escaped = false
|
|
94
106
|
for (let index = 0; index < rule.length; index++) {
|
|
@@ -101,7 +113,7 @@ function ruleColon(rule) {
|
|
|
101
113
|
escaped = true
|
|
102
114
|
continue
|
|
103
115
|
}
|
|
104
|
-
if (char === ':') return index
|
|
116
|
+
if (char === ':' && !isDriveColon(rule, index)) return index
|
|
105
117
|
}
|
|
106
118
|
return -1
|
|
107
119
|
}
|
|
@@ -113,26 +125,43 @@ export function parseDepfile(text, cwd = process.cwd()) {
|
|
|
113
125
|
|
|
114
126
|
const dependencies = []
|
|
115
127
|
let token = ''
|
|
116
|
-
let escaped = false
|
|
117
128
|
const flush = () => {
|
|
118
129
|
if (!token) return
|
|
119
130
|
dependencies.push(path.isAbsolute(token) ? path.normalize(token) : path.resolve(cwd, token))
|
|
120
131
|
token = ''
|
|
121
132
|
}
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
// GCC's and Clang's make quoting: 2N+1 backslashes before a blank are N
|
|
135
|
+
// backslashes and a blank inside the name, 2N are N backslashes ending it,
|
|
136
|
+
// and `\#` is `#`. Any other backslash is literal -- on a Windows host it
|
|
137
|
+
// is the path separator, which dropping left `C:Usersme...`.
|
|
138
|
+
const body = rule.slice(colon + 1)
|
|
139
|
+
for (let index = 0; index < body.length; index++) {
|
|
140
|
+
const char = body[index]
|
|
141
|
+
if (char !== '\\') {
|
|
142
|
+
if (/\s/.test(char)) flush()
|
|
143
|
+
else token += char
|
|
144
|
+
continue
|
|
145
|
+
}
|
|
146
|
+
let count = 1
|
|
147
|
+
while (body[index + count] === '\\') count++
|
|
148
|
+
const next = body[index + count]
|
|
149
|
+
if (next !== undefined && /\s/.test(next)) {
|
|
150
|
+
token += '\\'.repeat(Math.floor(count / 2))
|
|
151
|
+
if (count % 2 === 1) {
|
|
152
|
+
token += next
|
|
153
|
+
index += count
|
|
154
|
+
} else {
|
|
155
|
+
index += count - 1
|
|
156
|
+
}
|
|
157
|
+
} else if (next === '#' && count % 2 === 1) {
|
|
158
|
+
token += `${'\\'.repeat(Math.floor(count / 2))}#`
|
|
159
|
+
index += count
|
|
131
160
|
} else {
|
|
132
|
-
token +=
|
|
161
|
+
token += '\\'.repeat(count)
|
|
162
|
+
index += count - 1
|
|
133
163
|
}
|
|
134
164
|
}
|
|
135
|
-
if (escaped) token += '\\'
|
|
136
165
|
flush()
|
|
137
166
|
return dependencies
|
|
138
167
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/gea_build_config.cmake")
|
|
2
|
+
if(NOT GEA_APP_CAPABILITY_ANALYSIS_VERSION EQUAL 1)
|
|
3
|
+
message(FATAL_ERROR "Capability analysis is missing or unsupported. Update @geastack/cli together with @geastack/targets.")
|
|
4
|
+
endif()
|
|
1
5
|
# Included by every esp32 board's top-level CMakeLists BEFORE project(), which
|
|
2
6
|
# is the only phase where EXTRA_COMPONENT_DIRS still has an effect. An app
|
|
3
7
|
# declares its own IDF components -- a vendored driver, a DSP library with its
|
|
@@ -18,33 +22,25 @@ foreach(_GEA_APP_COMPONENT_DIR IN LISTS GEA_EMBEDDED_APP_COMPONENT_DIRS)
|
|
|
18
22
|
list(APPEND EXTRA_COMPONENT_DIRS "${_GEA_APP_COMPONENT_DIR}")
|
|
19
23
|
endforeach()
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
set(_GEA_AUDIO_DEFINES "${GEA_EMBEDDED_APP_DEFINES};$ENV{GEA_EMBEDDED_APP_DEFINES}")
|
|
24
|
-
set(ENV{GEA_EMBEDDED_CAPABILITY_AEC} "0")
|
|
25
|
-
if(";${_GEA_AUDIO_DEFINES};" MATCHES ";GEA_AUDIO_ECHO_CANCELLATION=1;")
|
|
26
|
-
set(ENV{GEA_EMBEDDED_CAPABILITY_AEC} "1")
|
|
25
|
+
if(GEA_APP_CAPABILITY_DEPENDENCY_DIR)
|
|
26
|
+
list(APPEND EXTRA_COMPONENT_DIRS "${GEA_APP_CAPABILITY_DEPENDENCY_DIR}")
|
|
27
27
|
endif()
|
|
28
28
|
|
|
29
|
-
# The
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
set(ENV{GEA_EMBEDDED_CAPABILITY_${_GEA_CAPABILITY}}
|
|
45
|
-
"$CACHE{GEA_EMBEDDED_CAPABILITY_${_GEA_CAPABILITY}}")
|
|
46
|
-
else()
|
|
47
|
-
set(ENV{GEA_EMBEDDED_CAPABILITY_${_GEA_CAPABILITY}} "1")
|
|
48
|
-
endif()
|
|
29
|
+
# The component manager writes the dependencies it solved into the lock file,
|
|
30
|
+
# and which components are dependencies depends on the app being built (the
|
|
31
|
+
# capability-selected SDKs the CLI places in GEA_APP_CAPABILITY_DEPENDENCY_DIR).
|
|
32
|
+
# Solving into the target's tracked dependencies.lock therefore rewrote it for
|
|
33
|
+
# every app with a different capability set. A target calls this after
|
|
34
|
+
# including project.cmake: the build solves into its own build directory,
|
|
35
|
+
# starting from the tracked lock (copied again whenever the tracked one is
|
|
36
|
+
# newer) so the versions it pins still hold, and the source tree stays as it
|
|
37
|
+
# was checked out.
|
|
38
|
+
macro(gea_solve_dependencies_in_build_dir)
|
|
39
|
+
set(_GEA_TRACKED_LOCK "${CMAKE_CURRENT_LIST_DIR}/dependencies.lock")
|
|
40
|
+
set(_GEA_BUILD_LOCK "${CMAKE_BINARY_DIR}/dependencies.lock")
|
|
41
|
+
if(EXISTS "${_GEA_TRACKED_LOCK}"
|
|
42
|
+
AND (NOT EXISTS "${_GEA_BUILD_LOCK}" OR "${_GEA_TRACKED_LOCK}" IS_NEWER_THAN "${_GEA_BUILD_LOCK}"))
|
|
43
|
+
configure_file("${_GEA_TRACKED_LOCK}" "${_GEA_BUILD_LOCK}" COPYONLY)
|
|
49
44
|
endif()
|
|
50
|
-
|
|
45
|
+
idf_build_set_property(DEPENDENCIES_LOCK "${_GEA_BUILD_LOCK}")
|
|
46
|
+
endmacro()
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Uses Espressif's BSD-3-Clause BMM150 adapter on the existing Gea I2C bus.
|
|
3
|
+
// Integer compensation matches Espressif's Mosaico magnetic calibration;
|
|
4
|
+
// overflow sentinels are meaningful edge evidence and must not become zero.
|
|
5
|
+
#include "bmm150_common.h"
|
|
6
|
+
#include "board.h"
|
|
7
|
+
#include "esp_timer.h"
|
|
8
|
+
#include "freertos/FreeRTOS.h"
|
|
9
|
+
#include "freertos/task.h"
|
|
10
|
+
#include "i2c.h"
|
|
11
|
+
#include "platform/magnetometer.h"
|
|
12
|
+
#include <array>
|
|
13
|
+
#include <mutex>
|
|
14
|
+
#include <type_traits>
|
|
15
|
+
|
|
16
|
+
static_assert(std::is_same_v<decltype(bmm150_mag_data::x), std::int16_t>,
|
|
17
|
+
"BMM150 and its consumers must use the same integer ABI");
|
|
18
|
+
|
|
19
|
+
namespace {
|
|
20
|
+
using gea::platform::sensors::MagnetometerReading;
|
|
21
|
+
constexpr auto kAddresses = gea::platform::board::magnetometerAddresses;
|
|
22
|
+
struct Sensor {
|
|
23
|
+
bmm150_dev device{};
|
|
24
|
+
bool initialized = false;
|
|
25
|
+
};
|
|
26
|
+
std::array<Sensor, kAddresses.size()> sensors;
|
|
27
|
+
std::mutex sensorMutex;
|
|
28
|
+
|
|
29
|
+
bool detach(Sensor &sensor) {
|
|
30
|
+
sensor.initialized = false;
|
|
31
|
+
// A failed removal retains the adapter context for a later close/open
|
|
32
|
+
// retry. Never discard that pointer or delete the shared I2C bus.
|
|
33
|
+
return !sensor.device.intf_ptr ||
|
|
34
|
+
bmm150_interface_deinit_device(&sensor.device) == ESP_OK;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
bool firstConversion(bmm150_dev &device) {
|
|
38
|
+
for (unsigned elapsed = 0; elapsed <= 200; elapsed += 5) {
|
|
39
|
+
std::uint8_t status = 0;
|
|
40
|
+
if (bmm150_get_regs(BMM150_REG_DATA_READY_STATUS, &status, 1, &device) !=
|
|
41
|
+
BMM150_OK)
|
|
42
|
+
return false;
|
|
43
|
+
if (status & BMM150_DRDY_STATUS_MSK)
|
|
44
|
+
return true;
|
|
45
|
+
if (elapsed < 200)
|
|
46
|
+
vTaskDelay(pdMS_TO_TICKS(5));
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
bool readSensor(unsigned index, MagnetometerReading &out) {
|
|
52
|
+
out = {};
|
|
53
|
+
if (index >= sensors.size() || !sensors[index].initialized)
|
|
54
|
+
return false;
|
|
55
|
+
bmm150_mag_data reading{};
|
|
56
|
+
if (bmm150_read_mag_data(&reading, &sensors[index].device) != BMM150_OK)
|
|
57
|
+
return false;
|
|
58
|
+
out.x = reading.x;
|
|
59
|
+
out.y = reading.y;
|
|
60
|
+
out.z = reading.z;
|
|
61
|
+
const auto saturated = [](std::int16_t value) {
|
|
62
|
+
return value <= -30000 || value >= 30000;
|
|
63
|
+
};
|
|
64
|
+
out.saturatedAxes = (saturated(out.x) ? 1U : 0U) |
|
|
65
|
+
(saturated(out.y) ? 2U : 0U) |
|
|
66
|
+
(saturated(out.z) ? 4U : 0U);
|
|
67
|
+
out.valid = true;
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
} // namespace
|
|
71
|
+
|
|
72
|
+
extern "C" unsigned gea_magnetometer_count() { return sensors.size(); }
|
|
73
|
+
|
|
74
|
+
extern "C" bool gea_magnetometer_open() {
|
|
75
|
+
std::lock_guard lock(sensorMutex);
|
|
76
|
+
bool complete = true;
|
|
77
|
+
for (const auto &sensor : sensors)
|
|
78
|
+
complete = complete && sensor.initialized;
|
|
79
|
+
if (complete)
|
|
80
|
+
return true;
|
|
81
|
+
gea::platform::board::powerOnRails();
|
|
82
|
+
const auto bus = gea::platform::i2c::Bus::primary();
|
|
83
|
+
if (!bus.available())
|
|
84
|
+
return false;
|
|
85
|
+
for (unsigned index = 0; index < sensors.size(); ++index) {
|
|
86
|
+
auto &sensor = sensors[index];
|
|
87
|
+
if (sensor.initialized)
|
|
88
|
+
continue;
|
|
89
|
+
if (!detach(sensor) ||
|
|
90
|
+
bmm150_interface_init_from_master_bus(
|
|
91
|
+
&sensor.device,
|
|
92
|
+
static_cast<i2c_master_bus_handle_t>(bus.nativeHandle()),
|
|
93
|
+
kAddresses[index], 400000) != ESP_OK)
|
|
94
|
+
return false;
|
|
95
|
+
bmm150_settings settings{};
|
|
96
|
+
settings.pwr_mode = BMM150_POWERMODE_NORMAL;
|
|
97
|
+
settings.preset_mode = BMM150_PRESETMODE_REGULAR;
|
|
98
|
+
if (bmm150_init(&sensor.device) != BMM150_OK ||
|
|
99
|
+
bmm150_set_op_mode(&settings, &sensor.device) != BMM150_OK ||
|
|
100
|
+
bmm150_set_presetmode(&settings, &sensor.device) != BMM150_OK ||
|
|
101
|
+
!firstConversion(sensor.device)) {
|
|
102
|
+
(void)detach(sensor);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
sensor.initialized = true;
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
extern "C" void gea_magnetometer_close() {
|
|
111
|
+
std::lock_guard lock(sensorMutex);
|
|
112
|
+
for (auto &sensor : sensors)
|
|
113
|
+
(void)detach(sensor);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
extern "C" bool gea_magnetometer_read(unsigned index,
|
|
117
|
+
MagnetometerReading *out) {
|
|
118
|
+
if (!out)
|
|
119
|
+
return false;
|
|
120
|
+
std::lock_guard lock(sensorMutex);
|
|
121
|
+
const bool valid = readSensor(index, *out);
|
|
122
|
+
out->timestampUs = static_cast<std::uint64_t>(esp_timer_get_time());
|
|
123
|
+
return valid;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
extern "C" bool gea_magnetometer_read_all(MagnetometerReading *out,
|
|
127
|
+
std::size_t capacity) {
|
|
128
|
+
if (!out || capacity < sensors.size())
|
|
129
|
+
return false;
|
|
130
|
+
std::lock_guard lock(sensorMutex);
|
|
131
|
+
bool valid = true;
|
|
132
|
+
for (unsigned index = 0; index < sensors.size(); ++index) {
|
|
133
|
+
const bool current = readSensor(index, out[index]);
|
|
134
|
+
valid = valid && current;
|
|
135
|
+
}
|
|
136
|
+
const auto timestamp = static_cast<std::uint64_t>(esp_timer_get_time());
|
|
137
|
+
for (unsigned index = 0; index < sensors.size(); ++index)
|
|
138
|
+
out[index].timestampUs = timestamp;
|
|
139
|
+
return valid;
|
|
140
|
+
}
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
#include "driver/gpio.h"
|
|
10
10
|
#include "esp_attr.h"
|
|
11
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
12
|
+
#include "esp_heap_caps.h"
|
|
13
|
+
#endif
|
|
11
14
|
#include "esp_lcd_panel_io.h"
|
|
12
15
|
// The CST92xx family shares this binding. A board whose controller is the
|
|
13
16
|
// CST9220 (the ESP-Mosaico) sets GEA_BOARD_TOUCH_CST9220: that part speaks
|
|
@@ -113,8 +116,14 @@ esp_err_t TouchController::begin()
|
|
|
113
116
|
if (!bus.available()) return ESP_ERR_INVALID_STATE;
|
|
114
117
|
bus_ = static_cast<i2c_master_bus_handle_t>(bus.nativeHandle());
|
|
115
118
|
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
// Retain a successfully attached device if task allocation fails, so a
|
|
120
|
+
// later begin() retries only the task instead of attaching the bus twice.
|
|
121
|
+
esp_err_t err = ESP_OK;
|
|
122
|
+
if (!deviceAttached_) {
|
|
123
|
+
err = attachTouchDevice();
|
|
124
|
+
if (err != ESP_OK) return err;
|
|
125
|
+
deviceAttached_ = true;
|
|
126
|
+
}
|
|
118
127
|
|
|
119
128
|
err = startTask();
|
|
120
129
|
if (err != ESP_OK) return err;
|
|
@@ -193,9 +202,24 @@ esp_err_t TouchController::attachTouchDevice()
|
|
|
193
202
|
|
|
194
203
|
esp_err_t TouchController::startTask()
|
|
195
204
|
{
|
|
196
|
-
|
|
205
|
+
if (task_) return ESP_OK;
|
|
206
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
207
|
+
// Keep the controller and TCB internal: the CST9220 ISR reads task_ through
|
|
208
|
+
// its address. Only the polling task's stack follows the external option.
|
|
209
|
+
taskStack_ = static_cast<StackType_t *>(
|
|
210
|
+
heap_caps_malloc(kTaskStackBytes, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
|
|
211
|
+
if (!taskStack_) {
|
|
212
|
+
ESP_LOGE(kTag, "Failed to allocate touch task stack");
|
|
213
|
+
return ESP_ERR_NO_MEM;
|
|
214
|
+
}
|
|
215
|
+
#endif
|
|
216
|
+
task_ = xTaskCreateStatic(taskEntry, "cst9217-touch", static_cast<std::uint32_t>(kTaskStackBytes),
|
|
197
217
|
this, kTaskPriority, taskStack_, &taskControlBlock_);
|
|
198
218
|
if (task_) return ESP_OK;
|
|
219
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
220
|
+
heap_caps_free(taskStack_);
|
|
221
|
+
taskStack_ = nullptr;
|
|
222
|
+
#endif
|
|
199
223
|
ESP_LOGE(kTag, "Failed to start touch task");
|
|
200
224
|
return ESP_ERR_NO_MEM;
|
|
201
225
|
}
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
#include "freertos/FreeRTOS.h"
|
|
13
13
|
#include "freertos/task.h"
|
|
14
14
|
|
|
15
|
+
#ifndef GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
16
|
+
#define GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL 0
|
|
17
|
+
#endif
|
|
18
|
+
|
|
15
19
|
namespace gea::platform::esp32::chip_bindings::cst9217 {
|
|
16
20
|
|
|
17
21
|
struct TouchSample {
|
|
@@ -50,7 +54,7 @@ private:
|
|
|
50
54
|
void notifyPointer(Phase phase, bool touching, int x, int y, int pointerId);
|
|
51
55
|
void notifyMove(const TouchSample &sample);
|
|
52
56
|
|
|
53
|
-
static constexpr std::size_t
|
|
57
|
+
static constexpr std::size_t kTaskStackBytes = 4096;
|
|
54
58
|
static constexpr int kMaxFingers = 2;
|
|
55
59
|
|
|
56
60
|
struct MultiSample {
|
|
@@ -62,12 +66,17 @@ private:
|
|
|
62
66
|
MultiSample readMulti();
|
|
63
67
|
|
|
64
68
|
bool initialized_ = false;
|
|
69
|
+
bool deviceAttached_ = false;
|
|
65
70
|
i2c_master_bus_handle_t bus_ = nullptr;
|
|
66
71
|
esp_lcd_panel_io_handle_t io_ = nullptr;
|
|
67
72
|
esp_lcd_touch_handle_t touch_ = nullptr;
|
|
68
73
|
TaskHandle_t task_ = nullptr;
|
|
69
74
|
StaticTask_t taskControlBlock_ = {};
|
|
70
|
-
|
|
75
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
76
|
+
StackType_t *taskStack_ = nullptr;
|
|
77
|
+
#else
|
|
78
|
+
StackType_t taskStack_[kTaskStackBytes / sizeof(StackType_t)] = {};
|
|
79
|
+
#endif
|
|
71
80
|
TouchSample current_ = {};
|
|
72
81
|
TouchSample latestMove_ = {};
|
|
73
82
|
std::atomic<bool> latestMoveQueued_{false};
|
|
@@ -14,8 +14,8 @@ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_framework.cmake")
|
|
|
14
14
|
# then the only thing that knows what the app needs.
|
|
15
15
|
set(GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES app_update esp_http_server esp-tls)
|
|
16
16
|
set(GEA_EMBEDDED_FRAMEWORK_RTC_REQUIRES gea_vpx gea_vp8_peer esp_libsrtp)
|
|
17
|
-
if(DEFINED
|
|
18
|
-
AND "$
|
|
17
|
+
if(DEFINED GEA_EMBEDDED_CAPABILITY_NETWORK
|
|
18
|
+
AND "${GEA_EMBEDDED_CAPABILITY_NETWORK}" STREQUAL "0")
|
|
19
19
|
set(GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES "")
|
|
20
20
|
elseif(DEFINED CACHE{GEA_EMBEDDED_CAPABILITY_NETWORK}
|
|
21
21
|
AND "$CACHE{GEA_EMBEDDED_CAPABILITY_NETWORK}" STREQUAL "0")
|
|
@@ -25,9 +25,9 @@ endif()
|
|
|
25
25
|
# HTTP/Wi-Fi alone does not require a WebRTC transport or its codecs. Keep the
|
|
26
26
|
# historical default unless the app explicitly excludes RTC.
|
|
27
27
|
set(_GEA_FRAMEWORK_RTC_ENABLED 1)
|
|
28
|
-
if(DEFINED
|
|
29
|
-
AND NOT "$
|
|
30
|
-
set(_GEA_FRAMEWORK_RTC_ENABLED "$
|
|
28
|
+
if(DEFINED GEA_EMBEDDED_CAPABILITY_RTC
|
|
29
|
+
AND NOT "${GEA_EMBEDDED_CAPABILITY_RTC}" STREQUAL "")
|
|
30
|
+
set(_GEA_FRAMEWORK_RTC_ENABLED "${GEA_EMBEDDED_CAPABILITY_RTC}")
|
|
31
31
|
elseif(DEFINED CACHE{GEA_EMBEDDED_CAPABILITY_RTC})
|
|
32
32
|
set(_GEA_FRAMEWORK_RTC_ENABLED "$CACHE{GEA_EMBEDDED_CAPABILITY_RTC}")
|
|
33
33
|
endif()
|
|
@@ -35,6 +35,10 @@ if(NOT GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES OR NOT _GEA_FRAMEWORK_RTC_ENABLED
|
|
|
35
35
|
set(GEA_EMBEDDED_FRAMEWORK_RTC_REQUIRES "")
|
|
36
36
|
endif()
|
|
37
37
|
|
|
38
|
+
if(GEA_APP_CAPABILITY_DEPENDENCIES)
|
|
39
|
+
list(APPEND GEA_EMBEDDED_APP_COMPONENT_REQUIRES gea_app_dependencies)
|
|
40
|
+
endif()
|
|
41
|
+
|
|
38
42
|
idf_component_register(
|
|
39
43
|
SRCS
|
|
40
44
|
${GEA_FW_CXX_SOURCES}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Windows hosts: picolibc's specs reach its libstdc++ multilib headers through
|
|
2
|
+
# `<gcc>/bin/../<triple>/../picolibc/include/../<triple>/include/c++/...`.
|
|
3
|
+
# GCC opens that spelling unnormalised, and under a typical user profile the
|
|
4
|
+
# deepest header (bits/error_constants.h, pulled in by <cmath> on GCC 16)
|
|
5
|
+
# crosses Windows' 260-character MAX_PATH, so the include fails as "No such
|
|
6
|
+
# file". --picolibc-prefix makes the specs start from the toolchain root
|
|
7
|
+
# instead, which drops the bin/../<triple>/.. detour. Linking reads the same
|
|
8
|
+
# specs, and COMPILE_OPTIONS also reach the link line through CMAKE_CXX_FLAGS.
|
|
9
|
+
#
|
|
10
|
+
# Only for GCC 16 (ESP-IDF 6.2), whose <cmath> reaches that header. GCC 15
|
|
11
|
+
# (ESP-IDF 6.0) does not need it, and there the option is rejected outright
|
|
12
|
+
# ("unrecognized command-line option") by every compile that is not given
|
|
13
|
+
# picolibc's specs, as esp_wifi_remote's are not on the P4.
|
|
14
|
+
if(CMAKE_HOST_WIN32 AND NOT IDF_CUSTOM_TOOLCHAIN AND CONFIG_IDF_TOOLCHAIN_GCC AND CONFIG_LIBC_PICOLIBC)
|
|
15
|
+
get_filename_component(_gea_toolchain_bin "${CMAKE_C_COMPILER}" DIRECTORY)
|
|
16
|
+
get_filename_component(_gea_toolchain_root "${_gea_toolchain_bin}/.." ABSOLUTE)
|
|
17
|
+
execute_process(COMMAND "${CMAKE_C_COMPILER}" -dumpversion
|
|
18
|
+
OUTPUT_VARIABLE _gea_toolchain_version OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
|
19
|
+
if(_gea_toolchain_version VERSION_GREATER_EQUAL 16 AND EXISTS "${_gea_toolchain_root}/picolibc/include")
|
|
20
|
+
idf_toolchain_add_flags(COMPILE_OPTIONS "--picolibc-prefix=${_gea_toolchain_root}")
|
|
21
|
+
endif()
|
|
22
|
+
endif()
|