@geastack/targets 0.1.107 → 0.1.109

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.
Files changed (47) hide show
  1. package/build-config.json +120 -1
  2. package/package.json +6 -6
  3. package/targets/esp32/chip_bindings/audio/ns4168.cpp +326 -0
  4. package/targets/esp32/chip_bindings/displays/rgb_panel.cpp +2485 -105
  5. package/targets/esp32/chip_bindings/displays/sh8601.cpp +12 -2
  6. package/targets/esp32/chip_bindings/expanders/elecrow_board_control.cpp +169 -0
  7. package/targets/esp32/chip_bindings/expanders/io_expander.h +4 -0
  8. package/targets/esp32/chip_bindings/imu/qmi8658.cpp +10 -3
  9. package/targets/esp32/chip_bindings/power/axp2101.cpp +58 -0
  10. package/targets/esp32/chip_bindings/rtc/bm8563.cpp +129 -0
  11. package/targets/esp32/chip_bindings/touch/cst9217.cpp +26 -23
  12. package/targets/esp32/connectivity/wifi.cpp +30 -2
  13. package/targets/esp32/gea_board_buttons.cmake +13 -0
  14. package/targets/esp32/gpio.cpp +124 -1
  15. package/targets/esp32/gpio_pins.h +17 -0
  16. package/targets/esp32/services/buttons.cpp +185 -0
  17. package/targets/esp32/services/buttons.h +46 -0
  18. package/targets/esp32/services/device_control.cpp +98 -6
  19. package/targets/esp32/services/heap.cpp +25 -1
  20. package/targets/esp32-s3-elecrow-crowpanel-advance-7.0.json +182 -0
  21. package/targets/esp32-s3-touch-amoled-1.75c/CMakeLists.txt +11 -0
  22. package/targets/esp32-s3-touch-amoled-1.75c/main/CMakeLists.txt +54 -0
  23. package/targets/esp32-s3-touch-amoled-1.75c/main/Kconfig.projbuild +12 -0
  24. package/targets/esp32-s3-touch-amoled-1.75c/main/gea-dependencies.json +42 -0
  25. package/targets/esp32-s3-touch-amoled-1.75c/main/idf_component.yml +10 -0
  26. package/targets/esp32-s3-touch-amoled-1.75c/main/include/board.h +113 -0
  27. package/targets/esp32-s3-touch-amoled-1.75c/partitions.csv +9 -0
  28. package/targets/esp32-s3-touch-amoled-1.75c/sdkconfig.defaults +279 -0
  29. package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +13 -1
  30. package/targets/esp32-s3-touch-amoled-1.8/main/app_main.cpp +2 -0
  31. package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +44 -2
  32. package/targets/esp32-s3-touch-amoled-2.06/main/app_main.cpp +13 -0
  33. package/targets/esp32-s3-touch-amoled-2.06/main/sdcard_mount.cpp +56 -0
  34. package/targets/esp32-s3-touch-amoled-2.06/sdkconfig.defaults +5 -3
  35. package/targets/esp32-s3-touch-lcd-3.49/CMakeLists.txt +11 -0
  36. package/targets/esp32-s3-touch-lcd-3.49/main/CMakeLists.txt +82 -0
  37. package/targets/esp32-s3-touch-lcd-3.49/main/Kconfig.projbuild +12 -0
  38. package/targets/esp32-s3-touch-lcd-3.49/main/gea-dependencies.json +42 -0
  39. package/targets/esp32-s3-touch-lcd-3.49/main/idf_component.yml +8 -0
  40. package/targets/esp32-s3-touch-lcd-3.49/main/include/axs15231b_panel_init.h +9 -0
  41. package/targets/esp32-s3-touch-lcd-3.49/main/include/board.h +160 -0
  42. package/targets/esp32-s3-touch-lcd-3.49/main/panel_reset.cpp +93 -0
  43. package/targets/esp32-s3-touch-lcd-3.49/main/power.cpp +60 -0
  44. package/targets/esp32-s3-touch-lcd-3.49/main/touch.cpp +327 -0
  45. package/targets/esp32-s3-touch-lcd-3.49/partitions.csv +7 -0
  46. package/targets/esp32-s3-touch-lcd-3.49/sdkconfig.defaults +279 -0
  47. package/targets.json +70 -1
@@ -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,8 @@
1
+ # Always-required SDK dependencies. Optional SDKs are selected from
2
+ # gea-dependencies.json by the CLI capability analyzer.
3
+ dependencies:
4
+ espressif/esp_codec_dev: '==1.6.2'
5
+ espressif/esp_lcd_axs15231b: '==2.1.1'
6
+ # host/websocket.cpp
7
+ idf:
8
+ version: '>=5.3'
@@ -0,0 +1,9 @@
1
+ // Waveshare panel bring-up, from the vendor's ESP-IDF examples
2
+ // (Examples/ESP-IDF/09_LVGL_V8_Test/main/main.cpp). The esp_lcd_axs15231b
3
+ // component itself sends SLPOUT, MADCTL and COLMOD before this list; the
4
+ // factory glass needs nothing beyond a second sleep-out and display-on.
5
+ #pragma once
6
+ static const axs15231b_lcd_init_cmd_t kBoardAxsInitCommands[] = {
7
+ {0x11, (uint8_t[]){0x00}, 0, 120},
8
+ {0x29, (uint8_t[]){0x00}, 0, 100},
9
+ };
@@ -0,0 +1,160 @@
1
+ #pragma once
2
+
3
+ #include "driver/gpio.h"
4
+ #include "driver/spi_master.h"
5
+
6
+ // Waveshare ESP32-S3-Touch-LCD-3.49: a 172x640 IPS bar on an AXS15231B QSPI
7
+ // controller. Pin assignments: the vendor's ESP-IDF examples
8
+ // (Examples/ESP-IDF/*/main/user_config.h and codec_board/board_cfg.txt,
9
+ // board S3_LCD_3_49).
10
+ //
11
+ // The board has two I2C buses. The touch half of the AXS15231B answers at 0x3b
12
+ // on its own pair (GPIO17/18); everything else -- the QMI8658 IMU, PCF85063
13
+ // RTC, ES8311 DAC, ES7210 microphone ADC and TCA9554 expander -- shares the
14
+ // GPIO47/48 bus, which is the runtime's primary bus.
15
+ namespace gea::platform::board {
16
+
17
+ struct I2cBusConfig {
18
+ gpio_num_t sda;
19
+ gpio_num_t scl;
20
+ };
21
+
22
+ struct QspiDisplayConfig {
23
+ spi_host_device_t spiHost;
24
+ gpio_num_t cs;
25
+ gpio_num_t pclk;
26
+ gpio_num_t data0;
27
+ gpio_num_t data1;
28
+ gpio_num_t data2;
29
+ gpio_num_t data3;
30
+ gpio_num_t reset;
31
+ gpio_num_t te;
32
+ };
33
+
34
+ struct TouchConfig {
35
+ I2cBusConfig bus;
36
+ gpio_num_t reset;
37
+ // The TCA9554's open-drain INT, which falls when any expander input --
38
+ // the touch controller's INT among them -- changes.
39
+ gpio_num_t interrupt;
40
+ // The expander pin the touch controller's own INT lands on.
41
+ int expanderInterruptPin;
42
+ };
43
+
44
+ struct Es8311AudioConfig {
45
+ int i2sPort;
46
+ gpio_num_t mclk;
47
+ gpio_num_t bclk;
48
+ gpio_num_t ws;
49
+ gpio_num_t dout;
50
+ gpio_num_t din;
51
+ gpio_num_t powerAmplifier;
52
+ // The four microphones are on an ES7210 ADC (I2C 0x40) sharing the I2S
53
+ // bus; the ES8311's own input is not wired to a microphone.
54
+ int es7210Address;
55
+ };
56
+
57
+ // TCA9554 pin numbers (0-based, the chip's own), -1 where a line is not
58
+ // routed through it.
59
+ struct IoExpanderConfig {
60
+ int initialOutputs;
61
+ int address;
62
+ int initialDirections;
63
+ int powerAmplifier;
64
+ };
65
+
66
+ struct SdMmcConfig {
67
+ gpio_num_t clk;
68
+ gpio_num_t cmd;
69
+ gpio_num_t data0;
70
+ };
71
+
72
+ struct BatteryConfig {
73
+ // VBAT through a 1:3 divider into ADC1.
74
+ gpio_num_t sense;
75
+ };
76
+
77
+ struct LauncherButtonConfig {
78
+ gpio_num_t pin;
79
+ int activeLevel;
80
+ };
81
+
82
+ class Esp32S3TouchLcd349 {
83
+ public:
84
+ static constexpr I2cBusConfig i2c{
85
+ .sda = GPIO_NUM_47,
86
+ .scl = GPIO_NUM_48,
87
+ };
88
+
89
+ // V2 board. Backlight PWM is GPIO42, active low, gated by the expander's
90
+ // BL_EN (GEA_EMBEDDED_AXS15231B_BACKLIGHT_* in main/CMakeLists.txt). The
91
+ // panel reset is the expander's LCD_RST, so no GPIO reset here; GPIO21 is
92
+ // the tearing-effect line, which the runtime does not use.
93
+ static constexpr QspiDisplayConfig display{
94
+ .spiHost = SPI2_HOST,
95
+ .cs = GPIO_NUM_9,
96
+ .pclk = GPIO_NUM_10,
97
+ .data0 = GPIO_NUM_11,
98
+ .data1 = GPIO_NUM_12,
99
+ .data2 = GPIO_NUM_13,
100
+ .data3 = GPIO_NUM_14,
101
+ .reset = GPIO_NUM_NC,
102
+ .te = GPIO_NUM_NC,
103
+ };
104
+
105
+ // Touch reset is not routed. Touch INT reaches the ESP32 through the
106
+ // expander: EXIO0, signalled on the expander's INT at GPIO8.
107
+ static constexpr TouchConfig touch{
108
+ .bus = {.sda = GPIO_NUM_17, .scl = GPIO_NUM_18},
109
+ .reset = GPIO_NUM_NC,
110
+ .interrupt = GPIO_NUM_8,
111
+ .expanderInterruptPin = 0,
112
+ };
113
+
114
+ static constexpr Es8311AudioConfig audio{
115
+ // I2S_NUM_AUTO, spelled as its value; see the AMOLED 2.06 board.h.
116
+ .i2sPort = -1,
117
+ .mclk = GPIO_NUM_7,
118
+ .bclk = GPIO_NUM_15,
119
+ .ws = GPIO_NUM_46,
120
+ .dout = GPIO_NUM_45,
121
+ .din = GPIO_NUM_6,
122
+ // The speaker amplifier is enabled through the TCA9554 (expander below).
123
+ .powerAmplifier = GPIO_NUM_NC,
124
+ .es7210Address = 0x40,
125
+ };
126
+ };
127
+
128
+ using Board = Esp32S3TouchLcd349;
129
+
130
+ inline constexpr auto i2c = Board::i2c;
131
+ inline constexpr auto display = Board::display;
132
+ inline constexpr auto touch = Board::touch;
133
+ inline constexpr auto audio = Board::audio;
134
+ // TCA9554 at 0x20 on the primary bus (V2, waveshareteam
135
+ // ESP32-S3-Touch-LCD-3.49-V2 user_config.h): EXIO0 touch INT, EXIO1 BL_EN,
136
+ // EXIO2/3 IMU INT1/2, EXIO4 RTC INT, EXIO5 LCD_RST, EXIO6 SYS_EN, EXIO7 the
137
+ // speaker amplifier. BL_EN, LCD_RST and the amplifier are outputs; BL_EN and
138
+ // LCD_RST start high so the panel stays lit and out of reset, the amplifier
139
+ // starts off and follows the speaker.
140
+ inline constexpr IoExpanderConfig expander{
141
+ .initialOutputs = 0x22,
142
+ .address = 0x20,
143
+ .initialDirections = 0x5D,
144
+ .powerAmplifier = 7,
145
+ };
146
+ // TF slot, SDMMC 1-bit (vendor Examples/ESP-IDF/04_SD_Card).
147
+ inline constexpr SdMmcConfig storage{
148
+ .clk = GPIO_NUM_41,
149
+ .cmd = GPIO_NUM_39,
150
+ .data0 = GPIO_NUM_40,
151
+ };
152
+ inline constexpr BatteryConfig battery{.sense = GPIO_NUM_4};
153
+ // BOOT. The app-facing buttons (BOOT and PWR on GPIO16) are declared in
154
+ // targets.json.
155
+ inline constexpr LauncherButtonConfig launcherButton{
156
+ .pin = GPIO_NUM_0,
157
+ .activeLevel = 0,
158
+ };
159
+
160
+ } // namespace gea::platform::board
@@ -0,0 +1,93 @@
1
+ // Bring the panel out of reset and enable its backlight before the display
2
+ // driver talks to it.
3
+ //
4
+ // On the V2 board the AXS15231B's reset is the TCA9554's EXIO5 and the
5
+ // backlight supply is gated by EXIO1 (BL_EN); neither is a GPIO, so
6
+ // board::display.reset is GPIO_NUM_NC and the panel driver has nothing to
7
+ // toggle. The vendor's V2 examples (example_lcd_exio_init / example_lcd_reset)
8
+ // drive the same two pins at the same point.
9
+ //
10
+ // Display init runs before the board's shared I2C bus is brought up, so this
11
+ // opens its own short-lived master bus and closes it again; the later bus
12
+ // creation in i2c.cpp then proceeds normally.
13
+ #include "board.h"
14
+
15
+ #include <cstdint>
16
+
17
+ #include "driver/i2c_master.h"
18
+ #include "esp_err.h"
19
+ #include "esp_log.h"
20
+ #include "freertos/FreeRTOS.h"
21
+ #include "freertos/task.h"
22
+
23
+ namespace
24
+ {
25
+ constexpr char kTag[] = "panel_reset";
26
+ constexpr std::uint8_t kOutputRegister = 0x01;
27
+ constexpr std::uint8_t kConfigRegister = 0x03;
28
+ constexpr std::uint8_t kBacklightEnable = 1u << 1;
29
+ constexpr std::uint8_t kPanelReset = 1u << 5;
30
+
31
+ bool writeRegister(i2c_master_dev_handle_t device, std::uint8_t reg, std::uint8_t value)
32
+ {
33
+ const std::uint8_t bytes[] = {reg, value};
34
+ return i2c_master_transmit(device, bytes, sizeof(bytes), 100) == ESP_OK;
35
+ }
36
+ } // namespace
37
+
38
+ namespace gea::platform::board
39
+ {
40
+ void prepareDisplayPanel()
41
+ {
42
+ i2c_master_bus_config_t busConfig = {};
43
+ busConfig.i2c_port = I2C_NUM_0;
44
+ busConfig.sda_io_num = i2c.sda;
45
+ busConfig.scl_io_num = i2c.scl;
46
+ busConfig.clk_source = I2C_CLK_SRC_DEFAULT;
47
+ busConfig.glitch_ignore_cnt = 7;
48
+ busConfig.flags.enable_internal_pullup = true;
49
+
50
+ i2c_master_bus_handle_t bus = nullptr;
51
+ esp_err_t err = i2c_new_master_bus(&busConfig, &bus);
52
+ if (err != ESP_OK)
53
+ {
54
+ ESP_LOGE(kTag, "I2C bus for the panel reset failed: %s", esp_err_to_name(err));
55
+ return;
56
+ }
57
+
58
+ i2c_device_config_t deviceConfig = {};
59
+ deviceConfig.dev_addr_length = I2C_ADDR_BIT_LEN_7;
60
+ deviceConfig.device_address = expander.address;
61
+ deviceConfig.scl_speed_hz = 400000;
62
+ i2c_master_dev_handle_t device = nullptr;
63
+ err = i2c_master_bus_add_device(bus, &deviceConfig, &device);
64
+ if (err != ESP_OK)
65
+ {
66
+ ESP_LOGE(kTag, "TCA9554 attach failed: %s", esp_err_to_name(err));
67
+ i2c_del_master_bus(bus);
68
+ return;
69
+ }
70
+
71
+ // Outputs first, so pins switching to output come up at the levels the
72
+ // board expects; then the reset pulse with the backlight enabled.
73
+ const std::uint8_t idle = static_cast<std::uint8_t>(expander.initialOutputs);
74
+ const bool ok = writeRegister(device, kOutputRegister, idle) &&
75
+ writeRegister(device, kConfigRegister, static_cast<std::uint8_t>(expander.initialDirections));
76
+ if (ok)
77
+ {
78
+ vTaskDelay(pdMS_TO_TICKS(10));
79
+ writeRegister(device, kOutputRegister, static_cast<std::uint8_t>(idle & ~kPanelReset));
80
+ vTaskDelay(pdMS_TO_TICKS(20));
81
+ writeRegister(device, kOutputRegister, static_cast<std::uint8_t>(idle | kPanelReset | kBacklightEnable));
82
+ vTaskDelay(pdMS_TO_TICKS(120));
83
+ ESP_LOGI(kTag, "panel reset and backlight enable through TCA9554 (EXIO5, EXIO1)");
84
+ }
85
+ else
86
+ {
87
+ ESP_LOGE(kTag, "TCA9554 not responding at 0x%02x", expander.address);
88
+ }
89
+
90
+ i2c_master_bus_rm_device(device);
91
+ i2c_del_master_bus(bus);
92
+ }
93
+ } // namespace gea::platform::board
@@ -0,0 +1,60 @@
1
+ #include "power.h"
2
+ #include "board.h"
3
+ #include <algorithm>
4
+ #include <mutex>
5
+ #include "esp_adc/adc_oneshot.h"
6
+ #include "esp_adc/adc_cali.h"
7
+ #include "esp_adc/adc_cali_scheme.h"
8
+ #include "esp_log.h"
9
+
10
+ // No PMIC on this board: the battery is read through a divider on ADC1
11
+ // (vendor Examples/ESP-IDF/01_ADC_Test). Charge state is not wired to a GPIO,
12
+ // so Power::charging() keeps the host default.
13
+ namespace gea::platform::power {
14
+ namespace {
15
+ static_assert(board::battery.sense == GPIO_NUM_4, "battery sense is ADC1 channel 3 only on GPIO4");
16
+ constexpr adc_channel_t kChannel = ADC_CHANNEL_3;
17
+ std::mutex mutex;
18
+ adc_oneshot_unit_handle_t adc = nullptr;
19
+ adc_cali_handle_t calibration = nullptr;
20
+ bool ready = false;
21
+ }
22
+ bool Power::init() {
23
+ std::lock_guard<std::mutex> lock(mutex);
24
+ if (ready) return true;
25
+ adc_oneshot_unit_init_cfg_t unit{};
26
+ unit.unit_id = ADC_UNIT_1;
27
+ if (!adc && adc_oneshot_new_unit(&unit, &adc) != ESP_OK) return false;
28
+ adc_oneshot_chan_cfg_t channel{};
29
+ channel.atten = ADC_ATTEN_DB_12;
30
+ channel.bitwidth = ADC_BITWIDTH_DEFAULT;
31
+ if (adc_oneshot_config_channel(adc, kChannel, &channel) != ESP_OK) return false;
32
+ adc_cali_curve_fitting_config_t cal{};
33
+ cal.unit_id = ADC_UNIT_1;
34
+ cal.chan = kChannel;
35
+ cal.atten = ADC_ATTEN_DB_12;
36
+ cal.bitwidth = ADC_BITWIDTH_DEFAULT;
37
+ if (adc_cali_create_scheme_curve_fitting(&cal, &calibration) != ESP_OK) {
38
+ calibration = nullptr;
39
+ ESP_LOGW("lcd349_power", "ADC calibration unavailable; battery percentage unknown");
40
+ }
41
+ ready = true;
42
+ return true;
43
+ }
44
+ int Power::batteryPercent() {
45
+ if (!init()) return -1;
46
+ std::lock_guard<std::mutex> lock(mutex);
47
+ if (!calibration) return -1;
48
+ int total = 0;
49
+ for (int i = 0; i < 8; ++i) {
50
+ int raw = 0;
51
+ if (adc_oneshot_read(adc, kChannel, &raw) != ESP_OK) return -1;
52
+ total += raw;
53
+ }
54
+ int mv = 0;
55
+ if (adc_cali_raw_to_voltage(calibration, total / 8, &mv) != ESP_OK) return -1;
56
+ // Vendor divider: Vbat = ADC voltage * 3. Percentage is a voltage estimate.
57
+ mv *= 3;
58
+ return std::clamp((mv - 3300) * 100 / 900, 0, 100);
59
+ }
60
+ }