@geastack/targets 0.1.98 → 0.1.100-mosaico-pins.1

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 CHANGED
@@ -15,7 +15,8 @@
15
15
  "renderer.subtreeRevealChecks",
16
16
  "renderer.recordInlinePositions",
17
17
  "diagnostics.performanceCounters",
18
- "diagnostics.frameTiming"
18
+ "diagnostics.frameTiming",
19
+ "renderer.bandedUi"
19
20
  ],
20
21
  "defaults": {
21
22
  "ui": {
@@ -29,6 +30,9 @@
29
30
  "storeRelowering": true,
30
31
  "moduleGraph": "auto",
31
32
  "allowAny": false
33
+ },
34
+ "renderer": {
35
+ "bandedUi": false
32
36
  }
33
37
  }
34
38
  },
@@ -41,7 +45,8 @@
41
45
  "compiler.translationUnits",
42
46
  "compiler.storeRelowering",
43
47
  "compiler.moduleGraph",
44
- "compiler.allowAny"
48
+ "compiler.allowAny",
49
+ "renderer.bandedUi"
45
50
  ],
46
51
  "defaults": {
47
52
  "ui": {
@@ -55,6 +60,9 @@
55
60
  "storeRelowering": true,
56
61
  "moduleGraph": "auto",
57
62
  "allowAny": false
63
+ },
64
+ "renderer": {
65
+ "bandedUi": false
58
66
  }
59
67
  }
60
68
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/targets",
3
- "version": "0.1.98",
3
+ "version": "0.1.100-mosaico-pins.1",
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": {
@@ -34,10 +34,6 @@ set(GEA_BOARD_EXTRA_COMPILE_DEFINITIONS
34
34
  GEA_BOARD_USB_CONSOLE=1
35
35
  # `gea flash` installs apps through the running app (usbAppUpdate).
36
36
  GEA_DEVICE_CONTROL_USB_OTA=1
37
- # Framebuffer-free retained UI: each dirty band is rendered straight into the
38
- # internal-RAM DMA staging chunk and streamed while the next band renders,
39
- # instead of writing the PSRAM framebuffer and reading it back to flush.
40
- GEA_EMBEDDED_DISPLAY_BANDED_UI=1
41
37
  GEA_EMBEDDED_CO5300_MOSAICO_INIT=1
42
38
  GEA_EMBEDDED_CO5300_PANEL_X_GAP=0
43
39
  GEA_EMBEDDED_CO5300_PANEL_Y_GAP=0
@@ -54,6 +50,7 @@ set(GEA_BOARD_PLATFORM_SOURCES
54
50
  "${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/launcher_button.cpp"
55
51
  "${CMAKE_CURRENT_LIST_DIR}/touch.cpp"
56
52
  "${CMAKE_CURRENT_LIST_DIR}/board_power.cpp"
53
+ "${CMAKE_CURRENT_LIST_DIR}/peer_uart.cpp"
57
54
  "${GEA_CHIPS}/displays/co5300/co5300.cpp"
58
55
  "${CMAKE_CURRENT_LIST_DIR}/../../esp32/display.cpp"
59
56
  "${CMAKE_CURRENT_LIST_DIR}/../../esp32/chip_bindings/displays/co5300.cpp"
@@ -72,6 +69,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/../../esp32-s3-touch-amoled-1.8/main/CMakeLis
72
69
  # std::move()s as redundant. Warnings, not errors, until the compiler runtime
73
70
  # and emitter are fixed for this toolchain.
74
71
  if(NOT CMAKE_BUILD_EARLY_EXPANSION)
72
+ target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,-u,gea_mosaico_peer_uart_open")
75
73
  target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-error=nonnull -Wno-error=redundant-move)
76
74
  # board_power.cpp keeps a crash's registers and log across the reset (no UART0 here)
77
75
  # and makes the USB console wait for the host instead of dropping output.
@@ -0,0 +1,17 @@
1
+ #pragma once
2
+ #include <stddef.h>
3
+ #include <stdbool.h>
4
+ #include <stdint.h>
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+ // Target-owned GPIO/UART reservation. Side 0 is left, side 1 is right. This API
9
+ // carries digital bytes only; packet framing and DSP are application concerns.
10
+ // Explicit opt-in; unconfigured boards do not drive expansion pins.
11
+ bool gea_mosaico_peer_uart_open(uint32_t baud);
12
+ void gea_mosaico_peer_uart_close(void);
13
+ int gea_mosaico_peer_uart_read(unsigned side, void* bytes, size_t capacity);
14
+ int gea_mosaico_peer_uart_write(unsigned side, const void* bytes, size_t length);
15
+ #ifdef __cplusplus
16
+ }
17
+ #endif
@@ -0,0 +1,68 @@
1
+ #pragma once
2
+
3
+ // Override through the Mosaico board's package.json defines. Defaults retain
4
+ // the original H1 12 -> H2 12 and H1 11 <- H2 11 side-header harness.
5
+ #ifndef GEA_MOSAICO_PEER_LEFT_TX_GPIO
6
+ #define GEA_MOSAICO_PEER_LEFT_TX_GPIO 15
7
+ #endif
8
+ #ifndef GEA_MOSAICO_PEER_LEFT_RX_GPIO
9
+ #define GEA_MOSAICO_PEER_LEFT_RX_GPIO 4
10
+ #endif
11
+ #ifndef GEA_MOSAICO_PEER_RIGHT_TX_GPIO
12
+ #define GEA_MOSAICO_PEER_RIGHT_TX_GPIO 5
13
+ #endif
14
+ #ifndef GEA_MOSAICO_PEER_RIGHT_RX_GPIO
15
+ #define GEA_MOSAICO_PEER_RIGHT_RX_GPIO 38
16
+ #endif
17
+
18
+ namespace gea::platform::board::peer {
19
+ struct PinPair {
20
+ int tx;
21
+ int rx;
22
+ };
23
+
24
+ inline constexpr PinPair left{GEA_MOSAICO_PEER_LEFT_TX_GPIO,
25
+ GEA_MOSAICO_PEER_LEFT_RX_GPIO};
26
+ inline constexpr PinPair right{GEA_MOSAICO_PEER_RIGHT_TX_GPIO,
27
+ GEA_MOSAICO_PEER_RIGHT_RX_GPIO};
28
+
29
+ // Only unclaimed V1.2 expansion GPIOs. In this target GPIO0/1 are the unused
30
+ // expansion I2C bus; the onboard touch/sensors use GPIO56/3. Exclude the
31
+ // codec, display, NAND, power controls, USB/JTAG and UART0 console pins.
32
+ constexpr bool isExpansionGpio(int pin) {
33
+ switch (pin) {
34
+ case 0:
35
+ case 1:
36
+ case 4:
37
+ case 5:
38
+ case 10:
39
+ case 11:
40
+ case 12:
41
+ case 13:
42
+ case 14:
43
+ case 15:
44
+ case 16:
45
+ case 17:
46
+ case 18:
47
+ case 19:
48
+ case 38:
49
+ case 39:
50
+ case 46:
51
+ case 47:
52
+ case 48:
53
+ case 53:
54
+ case 55:
55
+ return true;
56
+ default:
57
+ return false;
58
+ }
59
+ }
60
+
61
+ static_assert(isExpansionGpio(left.tx) && isExpansionGpio(left.rx) &&
62
+ isExpansionGpio(right.tx) && isExpansionGpio(right.rx),
63
+ "Mosaico peer UART pins must be unclaimed expansion GPIOs");
64
+ static_assert(left.tx != left.rx && left.tx != right.tx &&
65
+ left.tx != right.rx && left.rx != right.tx &&
66
+ left.rx != right.rx && right.tx != right.rx,
67
+ "Mosaico peer UART requires four distinct GPIOs");
68
+ } // namespace gea::platform::board::peer
@@ -0,0 +1,89 @@
1
+ #include "driver/gpio.h"
2
+ #include "driver/uart.h"
3
+ #include "esp_err.h"
4
+ #include "freertos/FreeRTOS.h"
5
+ #include "mosaico_peer_uart.h"
6
+ #include "mosaico_peer_uart_pins.h"
7
+ #include <array>
8
+ namespace {
9
+ // The board validates configurable signal contacts before either UART opens.
10
+ // Adjacent boards also need common ground; never join output power rails.
11
+ struct Pins {
12
+ uart_port_t uart;
13
+ int tx, rx;
14
+ };
15
+ namespace peer = gea::platform::board::peer;
16
+ constexpr std::array<Pins, 2> pins{
17
+ {{UART_NUM_1, peer::left.tx, peer::left.rx},
18
+ {UART_NUM_2, peer::right.tx, peer::right.rx}}};
19
+ bool opened = false;
20
+ } // namespace
21
+ extern "C" bool gea_mosaico_peer_uart_open(uint32_t baud) {
22
+ #if GEA_MOSAICO_CAMERA_ENABLED
23
+ // Camera expansion owns these side GPIOs when that capability is enabled.
24
+ return false;
25
+ #endif
26
+ if (opened)
27
+ return true;
28
+ if (baud < 115200 || baud > 5000000)
29
+ return false;
30
+ // Never steal a UART already claimed by another board capability.
31
+ for (const auto &p : pins)
32
+ if (uart_is_driver_installed(p.uart))
33
+ return false;
34
+ unsigned installed = 0;
35
+ for (const auto &p : pins) {
36
+ uart_config_t config{};
37
+ config.baud_rate = baud;
38
+ config.data_bits = UART_DATA_8_BITS;
39
+ config.parity = UART_PARITY_DISABLE;
40
+ config.stop_bits = UART_STOP_BITS_1;
41
+ config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
42
+ config.source_clk = UART_SCLK_DEFAULT;
43
+ // RX driver storage and TX ring are reserved once, off the audio path.
44
+ if (uart_param_config(p.uart, &config) != ESP_OK ||
45
+ uart_set_pin(p.uart, p.tx, p.rx, UART_PIN_NO_CHANGE,
46
+ UART_PIN_NO_CHANGE) != ESP_OK ||
47
+ uart_driver_install(p.uart, 4096, 4096, 0, nullptr, 0) != ESP_OK) {
48
+ for (unsigned i = 0; i < installed; ++i)
49
+ uart_driver_delete(pins[i].uart);
50
+ for (const auto &reset : pins) {
51
+ gpio_reset_pin(static_cast<gpio_num_t>(reset.tx));
52
+ gpio_reset_pin(static_cast<gpio_num_t>(reset.rx));
53
+ }
54
+ return false;
55
+ }
56
+ ++installed;
57
+ uart_set_rx_full_threshold(p.uart, 96);
58
+ uart_set_rx_timeout(p.uart, 2);
59
+ }
60
+ opened = true;
61
+ return true;
62
+ }
63
+ extern "C" void gea_mosaico_peer_uart_close(void) {
64
+ if (!opened)
65
+ return;
66
+ for (const auto &p : pins) {
67
+ uart_driver_delete(p.uart);
68
+ gpio_reset_pin(static_cast<gpio_num_t>(p.tx));
69
+ gpio_reset_pin(static_cast<gpio_num_t>(p.rx));
70
+ }
71
+ opened = false;
72
+ }
73
+ extern "C" int gea_mosaico_peer_uart_read(unsigned side, void *bytes,
74
+ size_t capacity) {
75
+ if (!opened || side >= pins.size() || !bytes || !capacity)
76
+ return -1;
77
+ return uart_read_bytes(pins[side].uart, bytes, capacity, 0);
78
+ }
79
+ extern "C" int gea_mosaico_peer_uart_write(unsigned side, const void *bytes,
80
+ size_t length) {
81
+ if (!opened || side >= pins.size() || !bytes || !length)
82
+ return -1;
83
+ // The transport task owns this call. DSP only pushes its preallocated queue.
84
+ size_t free = 0;
85
+ if (uart_get_tx_buffer_free_size(pins[side].uart, &free) != ESP_OK ||
86
+ free < length + 32)
87
+ return 0;
88
+ return uart_write_bytes(pins[side].uart, bytes, length);
89
+ }