@geastack/targets 0.1.77
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/LICENSE +674 -0
- package/README.md +83 -0
- package/package.json +50 -0
- package/targets/cmake/geatsc-generated-archive-build.mjs +614 -0
- package/targets/cmake/geatsc_generated_archive.cmake +116 -0
- package/targets/cmake/geatsc_generated_archive_build.cmake +50 -0
- package/targets/esp32/app_project.cmake +33 -0
- package/targets/esp32/apps/app_manager.cpp +188 -0
- package/targets/esp32/apps/app_manager.h +10 -0
- package/targets/esp32/chip_bindings/README.md +58 -0
- package/targets/esp32/chip_bindings/audio/es8311.cpp +556 -0
- package/targets/esp32/chip_bindings/displays/co5300.cpp +510 -0
- package/targets/esp32/chip_bindings/displays/co5300.h +47 -0
- package/targets/esp32/chip_bindings/displays/co5300_async_stream.inc +79 -0
- package/targets/esp32/chip_bindings/displays/qspi_panel.h +65 -0
- package/targets/esp32/chip_bindings/displays/sh8601.cpp +583 -0
- package/targets/esp32/chip_bindings/displays/sh8601.h +36 -0
- package/targets/esp32/chip_bindings/gps/lc76g.cpp +296 -0
- package/targets/esp32/chip_bindings/gps/lc76g.h +7 -0
- package/targets/esp32/chip_bindings/imu/bmi270.cpp +299 -0
- package/targets/esp32/chip_bindings/imu/bmi270_config.inl +439 -0
- package/targets/esp32/chip_bindings/imu/qmi8658.cpp +213 -0
- package/targets/esp32/chip_bindings/power/axp2101.cpp +185 -0
- package/targets/esp32/chip_bindings/touch/cst9217.cpp +229 -0
- package/targets/esp32/chip_bindings/touch/cst9217_controller.h +78 -0
- package/targets/esp32/chip_bindings/touch/ft3168.cpp +340 -0
- package/targets/esp32/chip_bindings/touch/ft3168_controller.h +103 -0
- package/targets/esp32/chip_bindings/touch/ft6336.cpp +310 -0
- package/targets/esp32/chip_bindings/touch/ft6336_controller.h +90 -0
- package/targets/esp32/components/gea_framework/CMakeLists.txt +62 -0
- package/targets/esp32/connectivity/ble_hid.cpp +2916 -0
- package/targets/esp32/connectivity/ble_hid.h +8 -0
- package/targets/esp32/connectivity/diagnostics_transport.cpp +523 -0
- package/targets/esp32/connectivity/diagnostics_transport_offline.cpp +108 -0
- package/targets/esp32/connectivity/wifi.cpp +615 -0
- package/targets/esp32/connectivity/wifi_debug_offline.cpp +37 -0
- package/targets/esp32/connectivity/wifi_task_stack.h +119 -0
- package/targets/esp32/display.cpp +6010 -0
- package/targets/esp32/display_headless.cpp +468 -0
- package/targets/esp32/gea/platform_random.h +11 -0
- package/targets/esp32/gea_framework.cmake +382 -0
- package/targets/esp32/gpio.cpp +229 -0
- package/targets/esp32/host_sources.cmake +35 -0
- package/targets/esp32/imu_absent.cpp +36 -0
- package/targets/esp32/ldfragments/gea_ui_state_external.lf +35 -0
- package/targets/esp32/memory_config.h +64 -0
- package/targets/esp32/power_absent.cpp +22 -0
- package/targets/esp32/sdk-patches/0001-esp_ptr_dma_capable-accept-PSRAM.patch +70 -0
- package/targets/esp32/sdk-patches/0002-gdma-access_ext_mem-spi_master.patch +59 -0
- package/targets/esp32/sdk-patches/README.md +127 -0
- package/targets/esp32/services/app_runner.cpp +248 -0
- package/targets/esp32/services/app_state.cpp +56 -0
- package/targets/esp32/services/audio_runtime_stub.cpp +86 -0
- package/targets/esp32/services/battery_service.cpp +31 -0
- package/targets/esp32/services/device_control.cpp +1896 -0
- package/targets/esp32/services/device_control.h +31 -0
- package/targets/esp32/services/frame_scheduler.cpp +1571 -0
- package/targets/esp32/services/heap.cpp +129 -0
- package/targets/esp32/services/memory.cpp +103 -0
- package/targets/esp32/services/ota.cpp +840 -0
- package/targets/esp32/services/ota_image.cpp +162 -0
- package/targets/esp32/services/ota_image.h +16 -0
- package/targets/esp32/services/storage_service.cpp +159 -0
- package/targets/esp32/touch_absent.cpp +44 -0
- package/targets/esp32-m5stack-m5paper/CMakeLists.txt +10 -0
- package/targets/esp32-m5stack-m5paper/README.md +55 -0
- package/targets/esp32-m5stack-m5paper/dependencies.lock +76 -0
- package/targets/esp32-m5stack-m5paper/main/CMakeLists.txt +46 -0
- package/targets/esp32-m5stack-m5paper/main/Kconfig.projbuild +10 -0
- package/targets/esp32-m5stack-m5paper/main/app_main.cpp +114 -0
- package/targets/esp32-m5stack-m5paper/main/audio_stub.cpp +27 -0
- package/targets/esp32-m5stack-m5paper/main/buttons.cpp +111 -0
- package/targets/esp32-m5stack-m5paper/main/display.cpp +1074 -0
- package/targets/esp32-m5stack-m5paper/main/i2c.cpp +36 -0
- package/targets/esp32-m5stack-m5paper/main/idf_component.yml +7 -0
- package/targets/esp32-m5stack-m5paper/main/imu_stub.cpp +20 -0
- package/targets/esp32-m5stack-m5paper/main/include/board.h +100 -0
- package/targets/esp32-m5stack-m5paper/main/include/buttons.h +8 -0
- package/targets/esp32-m5stack-m5paper/main/launcher_button.cpp +82 -0
- package/targets/esp32-m5stack-m5paper/main/m5paper_psram.lf +20 -0
- package/targets/esp32-m5stack-m5paper/main/power.cpp +73 -0
- package/targets/esp32-m5stack-m5paper/main/sdcard_mount.cpp +82 -0
- package/targets/esp32-m5stack-m5paper/main/touch.cpp +279 -0
- package/targets/esp32-m5stack-m5paper/partitions.csv +9 -0
- package/targets/esp32-m5stack-m5paper/sdkconfig.defaults +84 -0
- package/targets/esp32-p4-m5stack-tab5/CMakeLists.txt +10 -0
- package/targets/esp32-p4-m5stack-tab5/dependencies.lock +276 -0
- package/targets/esp32-p4-m5stack-tab5/main/CMakeLists.txt +586 -0
- package/targets/esp32-p4-m5stack-tab5/main/Kconfig.projbuild +12 -0
- package/targets/esp32-p4-m5stack-tab5/main/app_main.cpp +177 -0
- package/targets/esp32-p4-m5stack-tab5/main/camera.cpp +2025 -0
- package/targets/esp32-p4-m5stack-tab5/main/display.cpp +4033 -0
- package/targets/esp32-p4-m5stack-tab5/main/fatfs_ffconf.h +383 -0
- package/targets/esp32-p4-m5stack-tab5/main/i2c.cpp +39 -0
- package/targets/esp32-p4-m5stack-tab5/main/idf_component.yml +21 -0
- package/targets/esp32-p4-m5stack-tab5/main/include/board.h +130 -0
- package/targets/esp32-p4-m5stack-tab5/main/include/tab5_drivers.h +68 -0
- package/targets/esp32-p4-m5stack-tab5/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-p4-m5stack-tab5/main/launcher_button.cpp +188 -0
- package/targets/esp32-p4-m5stack-tab5/main/power.cpp +22 -0
- package/targets/esp32-p4-m5stack-tab5/main/sdcard_mount.cpp +125 -0
- package/targets/esp32-p4-m5stack-tab5/main/tab5_audio.cpp +345 -0
- package/targets/esp32-p4-m5stack-tab5/main/tab5_drivers.cpp +871 -0
- package/targets/esp32-p4-m5stack-tab5/main/tab5_imu.cpp +246 -0
- package/targets/esp32-p4-m5stack-tab5/main/touch.cpp +206 -0
- package/targets/esp32-p4-m5stack-tab5/partitions.csv +12 -0
- package/targets/esp32-p4-m5stack-tab5/sdkconfig.defaults +128 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/CMakeLists.txt +19 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/0001-esp_video-csi-raw-passthrough-p4-rev-lt-v3.patch +28 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/README.md +45 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/apply.sh +37 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/dependencies.lock +196 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/CMakeLists.txt +562 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/Kconfig.projbuild +12 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/app_main.cpp +166 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/camera.cpp +2105 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/display.cpp +1730 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/fatfs_ffconf.h +383 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/i2c.cpp +39 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/idf_component.yml +11 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/board.h +87 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/panel_native.h +59 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/launcher_button.cpp +191 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/power.cpp +15 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/touch.cpp +306 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/partitions.csv +13 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/patches/README.md +22 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/patches/espressif__esp_video-csi-bypass.patch +28 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/sdkconfig.defaults +109 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/tools/README-camera-capture.md +84 -0
- package/targets/esp32-p4-waveshare-touch-lcd-3.5/tools/capture-camera.py +369 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/CMakeLists.txt +10 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/dependencies.lock +258 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/CMakeLists.txt +577 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/Kconfig.projbuild +12 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/app_main.cpp +177 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/camera.cpp +1935 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/display.cpp +2832 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/fatfs_ffconf.h +383 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/i2c.cpp +39 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/idf_component.yml +23 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/include/board.h +68 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/launcher_button.cpp +191 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/power.cpp +15 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/sdcard_mount.cpp +125 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/main/touch.cpp +332 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/partitions.csv +12 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/sdkconfig.defaults +122 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/tools/README-camera-capture.md +84 -0
- package/targets/esp32-p4-waveshare-touch-lcd-7/tools/capture-camera.py +369 -0
- package/targets/esp32-s3-devkit-n16r8.json +31 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/CMakeLists.txt +10 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/dependencies.lock +40 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/CMakeLists.txt +549 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/app_main.cpp +187 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/display_rgb.cpp +1338 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/i2c.cpp +39 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/idf_component.yml +5 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/include/board.h +142 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/include/pcf8574.h +16 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/include/rotary_encoder.h +7 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/pcf8574.cpp +86 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/platform_stubs.cpp +47 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/rotary_encoder.cpp +135 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/main/touch.cpp +250 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/partitions.csv +8 -0
- package/targets/esp32-s3-elecrow-rotary-2.1/sdkconfig.defaults +116 -0
- package/targets/esp32-s3-epaper-1.54/CMakeLists.txt +10 -0
- package/targets/esp32-s3-epaper-1.54/dependencies.lock +76 -0
- package/targets/esp32-s3-epaper-1.54/main/CMakeLists.txt +691 -0
- package/targets/esp32-s3-epaper-1.54/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-epaper-1.54/main/app_main.cpp +181 -0
- package/targets/esp32-s3-epaper-1.54/main/buttons.cpp +144 -0
- package/targets/esp32-s3-epaper-1.54/main/display.cpp +1281 -0
- package/targets/esp32-s3-epaper-1.54/main/fatfs_ffconf.h +377 -0
- package/targets/esp32-s3-epaper-1.54/main/i2c.cpp +39 -0
- package/targets/esp32-s3-epaper-1.54/main/idf_component.yml +7 -0
- package/targets/esp32-s3-epaper-1.54/main/imu_stub.cpp +21 -0
- package/targets/esp32-s3-epaper-1.54/main/include/board.h +119 -0
- package/targets/esp32-s3-epaper-1.54/main/include/buttons.h +9 -0
- package/targets/esp32-s3-epaper-1.54/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-epaper-1.54/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-epaper-1.54/main/power.cpp +15 -0
- package/targets/esp32-s3-epaper-1.54/main/sdcard_mount.cpp +89 -0
- package/targets/esp32-s3-epaper-1.54/main/touch.cpp +299 -0
- package/targets/esp32-s3-epaper-1.54/partitions.csv +8 -0
- package/targets/esp32-s3-epaper-1.54/sdkconfig.defaults +217 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/CMakeLists.txt +10 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/README.md +29 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/dependencies.lock +116 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/CMakeLists.txt +90 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/idf_component.yml +7 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/include/board.h +61 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/main/touch.cpp +299 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/partitions.csv +7 -0
- package/targets/esp32-s3-lilygo-t-display-s3-long/sdkconfig.defaults +50 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/CMakeLists.txt +12 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/CMakeLists.txt +17 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/ed047tc1.c +269 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/ed047tc1.h +142 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/epd_driver.c +1114 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/epd_driver.h +410 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/gea_epd.c +989 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/i2s_data_bus.c +489 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/i2s_data_bus.h +104 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/rmt_pulse.c +136 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/rmt_pulse.h +78 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/utilities.h +49 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/dependencies.lock +35 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/CMakeLists.txt +30 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/Kconfig.projbuild +10 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/app_main.cpp +95 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/audio_stub.cpp +27 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/buttons.cpp +40 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/display.cpp +627 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/i2c.cpp +36 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/idf_component.yml +4 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/imu_stub.cpp +20 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/include/board.h +85 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/include/buttons.h +8 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/launcher_button.cpp +82 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/power.cpp +36 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/sdcard_mount.cpp +90 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/touch.cpp +293 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/partitions.csv +9 -0
- package/targets/esp32-s3-lilygo-t5-epaper-4.7/sdkconfig.defaults +217 -0
- package/targets/esp32-s3-m5stack-papers3/CMakeLists.txt +13 -0
- package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/CMakeLists.txt +5 -0
- package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/include/papers3_epd.h +74 -0
- package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/papers3_epd.c +671 -0
- package/targets/esp32-s3-m5stack-papers3/dependencies.lock +76 -0
- package/targets/esp32-s3-m5stack-papers3/main/CMakeLists.txt +64 -0
- package/targets/esp32-s3-m5stack-papers3/main/Kconfig.projbuild +10 -0
- package/targets/esp32-s3-m5stack-papers3/main/app_main.cpp +96 -0
- package/targets/esp32-s3-m5stack-papers3/main/audio_stub.cpp +27 -0
- package/targets/esp32-s3-m5stack-papers3/main/buttons.cpp +49 -0
- package/targets/esp32-s3-m5stack-papers3/main/display.cpp +706 -0
- package/targets/esp32-s3-m5stack-papers3/main/i2c.cpp +36 -0
- package/targets/esp32-s3-m5stack-papers3/main/idf_component.yml +14 -0
- package/targets/esp32-s3-m5stack-papers3/main/imu.cpp +351 -0
- package/targets/esp32-s3-m5stack-papers3/main/include/board.h +101 -0
- package/targets/esp32-s3-m5stack-papers3/main/include/buttons.h +8 -0
- package/targets/esp32-s3-m5stack-papers3/main/launcher_button.cpp +96 -0
- package/targets/esp32-s3-m5stack-papers3/main/power.cpp +102 -0
- package/targets/esp32-s3-m5stack-papers3/main/sdcard_mount.cpp +88 -0
- package/targets/esp32-s3-m5stack-papers3/main/touch.cpp +287 -0
- package/targets/esp32-s3-m5stack-papers3/partitions.csv +9 -0
- package/targets/esp32-s3-m5stack-papers3/sdkconfig.defaults +232 -0
- package/targets/esp32-s3-m5stack-sticks3/CMakeLists.txt +10 -0
- package/targets/esp32-s3-m5stack-sticks3/dependencies.lock +51 -0
- package/targets/esp32-s3-m5stack-sticks3/main/CMakeLists.txt +51 -0
- package/targets/esp32-s3-m5stack-sticks3/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-m5stack-sticks3/main/app_main.cpp +130 -0
- package/targets/esp32-s3-m5stack-sticks3/main/buttons.cpp +101 -0
- package/targets/esp32-s3-m5stack-sticks3/main/display.cpp +1391 -0
- package/targets/esp32-s3-m5stack-sticks3/main/i2c.cpp +39 -0
- package/targets/esp32-s3-m5stack-sticks3/main/idf_component.yml +8 -0
- package/targets/esp32-s3-m5stack-sticks3/main/imu_stub.cpp +9 -0
- package/targets/esp32-s3-m5stack-sticks3/main/include/board.h +89 -0
- package/targets/esp32-s3-m5stack-sticks3/main/include/buttons.h +9 -0
- package/targets/esp32-s3-m5stack-sticks3/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-m5stack-sticks3/main/power.cpp +15 -0
- package/targets/esp32-s3-m5stack-sticks3/main/sdcard_mount.cpp +8 -0
- package/targets/esp32-s3-m5stack-sticks3/main/touch.cpp +65 -0
- package/targets/esp32-s3-m5stack-sticks3/partitions.csv +8 -0
- package/targets/esp32-s3-m5stack-sticks3/sdkconfig.defaults +130 -0
- package/targets/esp32-s3-touch-amoled-1.75/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-1.75/dependencies.lock +130 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/CMakeLists.txt +589 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/app_main.cpp +153 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/i2c.cpp +39 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/idf_component.yml +9 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/include/board.h +110 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-touch-amoled-1.75/main/touch.cpp +45 -0
- package/targets/esp32-s3-touch-amoled-1.75/partitions.csv +8 -0
- package/targets/esp32-s3-touch-amoled-1.75/sdkconfig.defaults +179 -0
- package/targets/esp32-s3-touch-amoled-1.8/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-1.8/dependencies.lock +105 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +768 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/app_main.cpp +172 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/i2c.cpp +39 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/idf_component.yml +8 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/include/board.h +83 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/launcher_button.cpp +191 -0
- package/targets/esp32-s3-touch-amoled-1.8/main/touch.cpp +41 -0
- package/targets/esp32-s3-touch-amoled-1.8/partitions.csv +8 -0
- package/targets/esp32-s3-touch-amoled-1.8/sdkconfig.defaults +179 -0
- package/targets/esp32-s3-touch-amoled-2.06/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +64 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +1121 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/app_main.cpp +333 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/i2c.cpp +39 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/idf_component.yml +27 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/include/board.h +114 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/launcher_button.cpp +199 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/sdcard_mount.cpp +105 -0
- package/targets/esp32-s3-touch-amoled-2.06/main/touch.cpp +49 -0
- package/targets/esp32-s3-touch-amoled-2.06/partitions.csv +14 -0
- package/targets/esp32-s3-touch-amoled-2.06/sdkconfig.defaults +273 -0
- package/targets/esp32-s3-touch-amoled-2.41/CMakeLists.txt +10 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/CMakeLists.txt +71 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/Kconfig.projbuild +12 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/idf_component.yml +27 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/include/board.h +108 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/include/wifi_config.h.example +5 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/panel_reset.cpp +82 -0
- package/targets/esp32-s3-touch-amoled-2.41/main/touch.cpp +49 -0
- package/targets/esp32-s3-touch-amoled-2.41/partitions.csv +8 -0
- package/targets/esp32-s3-touch-amoled-2.41/sdkconfig.defaults +273 -0
- package/targets/rp2350-tufty-2350/CMakeLists.txt +348 -0
- package/targets/rp2350-tufty-2350/README.md +53 -0
- package/targets/rp2350-tufty-2350/boards/pimoroni_tufty2350.h +87 -0
- package/targets/rp2350-tufty-2350/main/bringup.cpp +187 -0
- package/targets/rp2350-tufty-2350/main/include/board.h +124 -0
- package/targets/rp2350-tufty-2350/main/rp2350_panel.cpp +428 -0
- package/targets/rp2350-tufty-2350/main/rp2350_panel.h +46 -0
- package/targets/rp2350-tufty-2350/main/st7789_parallel.pio +7 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/CMakeLists.txt +345 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/README.md +153 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/boards/waveshare_rp2350_touch_amoled_2_41.h +59 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/app.cpp +984 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/bringup.cpp +222 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/include/board.h +138 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.cpp +2553 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.h +18 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_host_fetch_stub.cpp +64 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.cpp +677 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.h +48 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/rp_pico_alloc.c +354 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/rp_pico_alloc.h +56 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf.c +1284 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf.h +95 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf_block_functions.h +123 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf_common.h +127 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/tools/rp2350-scroll-bench.py +162 -0
- package/targets/rp2350-waveshare-touch-amoled-2.41/tools/rp2350-scroll-parity.py +198 -0
- package/targets.json +154 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
#include "ft3168_controller.h"
|
|
2
|
+
#include "board.h"
|
|
3
|
+
#include "i2c.h"
|
|
4
|
+
|
|
5
|
+
#include "driver/gpio.h"
|
|
6
|
+
#include "esp_attr.h"
|
|
7
|
+
#include "esp_log.h"
|
|
8
|
+
#include "esp_timer.h"
|
|
9
|
+
#include "freertos/FreeRTOS.h"
|
|
10
|
+
#include "freertos/task.h"
|
|
11
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
12
|
+
#include "esp_heap_caps.h"
|
|
13
|
+
#include "freertos/idf_additions.h"
|
|
14
|
+
#include <new>
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
namespace {
|
|
18
|
+
|
|
19
|
+
constexpr char kTag[] = "ft3168";
|
|
20
|
+
constexpr gpio_num_t kResetPin = gea::platform::board::touch.reset;
|
|
21
|
+
constexpr gpio_num_t kInterruptPin = gea::platform::board::touch.interrupt;
|
|
22
|
+
constexpr int kPollIntervalMs = 10;
|
|
23
|
+
// BELOW the render. The renderer rasters in parallel across both cores — the
|
|
24
|
+
// main task on CPU0 (priority 5) plus a worker pinned to CPU1 at the SAME
|
|
25
|
+
// priority 5 that the main task spin-waits on (display.cpp gea_render_parallel
|
|
26
|
+
// _submit/_wait). This poll task shares CPU1 with that worker. At its old
|
|
27
|
+
// priority 10 every I2C read (~140/sec, ~550us each, while a finger is down)
|
|
28
|
+
// PREEMPTED the worker mid-band, stalling it and forcing the main task to spin
|
|
29
|
+
// on CPU0 — ~6ms/frame, dropping a finger-down drag from ~60 to ~42fps (injected
|
|
30
|
+
// drags don't run this task, so they rastered uncontended at ~86fps). At
|
|
31
|
+
// priority 4 it can't preempt the raster; it samples in the render's idle
|
|
32
|
+
// windows instead, still at the panel's full report rate.
|
|
33
|
+
//
|
|
34
|
+
// That reasoning holds only while the render IS the busiest thing on CPU1. A
|
|
35
|
+
// board whose app also runs hard real-time work there -- the NAM pedalboard
|
|
36
|
+
// keeps a DSP stage at priority 19 and a USB audio client at 20, together ~95%
|
|
37
|
+
// of the core -- leaves a priority-4 task essentially unschedulable: the INT
|
|
38
|
+
// fires, the notify lands, and the task still waits seconds for a slot, so a
|
|
39
|
+
// finger-down is READ seconds after it happened. Such a board raises this to
|
|
40
|
+
// sit above its render and below its own audio deadline tasks. The work per
|
|
41
|
+
// iteration is one I2C transaction that blocks on the bus, so a higher priority
|
|
42
|
+
// costs the core microseconds, not bandwidth.
|
|
43
|
+
#ifndef GEA_EMBEDDED_TOUCH_TASK_PRIORITY
|
|
44
|
+
#define GEA_EMBEDDED_TOUCH_TASK_PRIORITY 4
|
|
45
|
+
#endif
|
|
46
|
+
constexpr int kTaskPriority = GEA_EMBEDDED_TOUCH_TASK_PRIORITY;
|
|
47
|
+
constexpr TickType_t kI2cTimeoutTicks = pdMS_TO_TICKS(100);
|
|
48
|
+
|
|
49
|
+
// Finger-to-queue instrumentation. The INT edge is the first instant the panel
|
|
50
|
+
// knows about the contact; everything after it is ours. Recorded in the ISR and
|
|
51
|
+
// read once per reported transition, so the steady state costs one timer read.
|
|
52
|
+
volatile std::int64_t g_touchIntUs = 0;
|
|
53
|
+
|
|
54
|
+
} // namespace
|
|
55
|
+
|
|
56
|
+
namespace gea::platform::esp32::chip_bindings::ft3168 {
|
|
57
|
+
|
|
58
|
+
bool EspI2cRegisterBus::attach(i2c_master_bus_handle_t bus) {
|
|
59
|
+
if (device_) return true;
|
|
60
|
+
|
|
61
|
+
i2c_device_config_t config = {};
|
|
62
|
+
config.dev_addr_length = I2C_ADDR_BIT_LEN_7;
|
|
63
|
+
config.device_address = gea::chips::ft3168::kI2cAddress;
|
|
64
|
+
config.scl_speed_hz = gea::chips::ft3168::kI2cFrequencyHz;
|
|
65
|
+
return i2c_master_bus_add_device(bus, &config, &device_) == ESP_OK;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
bool EspI2cRegisterBus::writeRegister(std::uint8_t reg, std::uint8_t value) {
|
|
69
|
+
std::uint8_t data[2] = {reg, value};
|
|
70
|
+
return device_ && i2c_master_transmit(device_, data, sizeof(data), kI2cTimeoutTicks) == ESP_OK;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
bool EspI2cRegisterBus::readRegisters(std::uint8_t reg, std::uint8_t *data, std::size_t length) {
|
|
74
|
+
return device_ && i2c_master_transmit_receive(device_, ®, 1, data, length, kI2cTimeoutTicks) == ESP_OK;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
TouchController &TouchController::instance() {
|
|
78
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
79
|
+
static TouchController *controller = [] {
|
|
80
|
+
void *memory = heap_caps_malloc(sizeof(TouchController), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
81
|
+
if (!memory) memory = heap_caps_malloc(sizeof(TouchController), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
|
82
|
+
return new (memory) TouchController();
|
|
83
|
+
}();
|
|
84
|
+
return *controller;
|
|
85
|
+
#else
|
|
86
|
+
static TouchController controller;
|
|
87
|
+
return controller;
|
|
88
|
+
#endif
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
void TouchController::setObserver(Observer observer) {
|
|
92
|
+
observer_ = observer;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void TouchController::setPointerObserver(PointerObserver observer) {
|
|
96
|
+
pointerObserver_ = observer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
esp_err_t TouchController::begin() {
|
|
100
|
+
if (initialized_) return ESP_OK;
|
|
101
|
+
|
|
102
|
+
ESP_LOGI(kTag, "Initializing FT3168 touch (RST=%d, INT=%d)", static_cast<int>(kResetPin), static_cast<int>(kInterruptPin));
|
|
103
|
+
|
|
104
|
+
auto bus = gea::platform::i2c::Bus::primary();
|
|
105
|
+
if (!bus.available()) return ESP_ERR_INVALID_STATE;
|
|
106
|
+
bus_ = static_cast<i2c_master_bus_handle_t>(bus.nativeHandle());
|
|
107
|
+
|
|
108
|
+
esp_err_t err = resetChip();
|
|
109
|
+
if (err != ESP_OK) return err;
|
|
110
|
+
|
|
111
|
+
err = attachI2cDevice();
|
|
112
|
+
if (err != ESP_OK) return err;
|
|
113
|
+
|
|
114
|
+
err = configureChip();
|
|
115
|
+
if (err != ESP_OK) return err;
|
|
116
|
+
|
|
117
|
+
err = startTask();
|
|
118
|
+
if (err != ESP_OK) return err;
|
|
119
|
+
|
|
120
|
+
err = attachInterrupt();
|
|
121
|
+
if (err != ESP_OK) return err;
|
|
122
|
+
|
|
123
|
+
initialized_ = true;
|
|
124
|
+
ESP_LOGI(kTag, "Touch controller ready (%s)", kInterruptPin >= 0 ? "interrupt-driven" : "polled");
|
|
125
|
+
return ESP_OK;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
bool TouchController::read(TouchSample &sample) {
|
|
129
|
+
const bool touching = core_.read(device_, sample);
|
|
130
|
+
current_ = sample;
|
|
131
|
+
return touching;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
TouchSample TouchController::cached() const {
|
|
135
|
+
return current_;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
void TouchController::consumeLatestMove(int *x, int *y) {
|
|
139
|
+
latestMoveQueued_.store(false, std::memory_order_release);
|
|
140
|
+
if (x) *x = latestMove_.x;
|
|
141
|
+
if (y) *y = latestMove_.y;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
esp_err_t TouchController::resetChip() {
|
|
145
|
+
if constexpr (static_cast<int>(kResetPin) < 0) {
|
|
146
|
+
vTaskDelay(pdMS_TO_TICKS(50));
|
|
147
|
+
return ESP_OK;
|
|
148
|
+
} else {
|
|
149
|
+
gpio_config_t config = {};
|
|
150
|
+
config.pin_bit_mask = 1ULL << static_cast<unsigned>(kResetPin);
|
|
151
|
+
config.mode = GPIO_MODE_OUTPUT;
|
|
152
|
+
esp_err_t err = gpio_config(&config);
|
|
153
|
+
if (err != ESP_OK) return err;
|
|
154
|
+
|
|
155
|
+
gpio_set_level(kResetPin, 0);
|
|
156
|
+
vTaskDelay(pdMS_TO_TICKS(5));
|
|
157
|
+
gpio_set_level(kResetPin, 1);
|
|
158
|
+
vTaskDelay(pdMS_TO_TICKS(300));
|
|
159
|
+
return ESP_OK;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
esp_err_t TouchController::attachI2cDevice() {
|
|
164
|
+
return device_.attach(bus_) ? ESP_OK : ESP_FAIL;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
esp_err_t TouchController::configureChip() {
|
|
168
|
+
return core_.configure(device_) ? ESP_OK : ESP_FAIL;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
esp_err_t TouchController::startTask() {
|
|
172
|
+
// Pinned to CPU1, where the parallel render worker also runs. kTaskPriority
|
|
173
|
+
// defaults BELOW that worker so reads sample in its idle windows instead of
|
|
174
|
+
// preempting its raster band; a board with real-time audio on CPU1 overrides
|
|
175
|
+
// it upward — see the kTaskPriority comment for the full why.
|
|
176
|
+
#if GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
177
|
+
const BaseType_t created = xTaskCreatePinnedToCoreWithCaps(
|
|
178
|
+
taskEntry, "ft3168-touch", static_cast<std::uint32_t>(kTaskStackWords * sizeof(StackType_t)), this, kTaskPriority,
|
|
179
|
+
&task_, 1, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
180
|
+
if (created != pdPASS) task_ = nullptr;
|
|
181
|
+
#else
|
|
182
|
+
task_ = xTaskCreateStaticPinnedToCore(taskEntry, "ft3168-touch",
|
|
183
|
+
static_cast<std::uint32_t>(sizeof(taskStack_) / sizeof(taskStack_[0])), this,
|
|
184
|
+
kTaskPriority, taskStack_, &taskControlBlock_, 1);
|
|
185
|
+
#endif
|
|
186
|
+
if (task_) return ESP_OK;
|
|
187
|
+
ESP_LOGE(kTag, "Failed to start touch task");
|
|
188
|
+
return ESP_ERR_NO_MEM;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
esp_err_t TouchController::attachInterrupt() {
|
|
192
|
+
// A board can route the controller's INT to an I2C expander rather than to a
|
|
193
|
+
// GPIO, leaving board::touch.interrupt as GPIO_NUM_NC. Shifting by -1 is
|
|
194
|
+
// undefined -- the compiler rejects it outright -- so skip the attach and let
|
|
195
|
+
// the task poll instead: it reads the controller on its own cadence anyway,
|
|
196
|
+
// and the interrupt only ever woke it sooner.
|
|
197
|
+
// `if constexpr`, not `if`: kInterruptPin is a compile-time constant, so the
|
|
198
|
+
// shift below is still evaluated -- and rejected -- in a plain branch.
|
|
199
|
+
if constexpr (kInterruptPin < 0) {
|
|
200
|
+
ESP_LOGI(kTag, "no interrupt GPIO for touch; polling instead");
|
|
201
|
+
return ESP_OK;
|
|
202
|
+
} else {
|
|
203
|
+
gpio_config_t config = {};
|
|
204
|
+
config.pin_bit_mask = 1ULL << static_cast<unsigned>(kInterruptPin);
|
|
205
|
+
config.mode = GPIO_MODE_INPUT;
|
|
206
|
+
config.intr_type = GPIO_INTR_NEGEDGE;
|
|
207
|
+
esp_err_t err = gpio_config(&config);
|
|
208
|
+
if (err != ESP_OK) return err;
|
|
209
|
+
|
|
210
|
+
err = gpio_install_isr_service(0);
|
|
211
|
+
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) return err;
|
|
212
|
+
|
|
213
|
+
return gpio_isr_handler_add(kInterruptPin, interruptEntry, this);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
void IRAM_ATTR TouchController::interruptEntry(void *arg) {
|
|
218
|
+
auto *self = static_cast<TouchController *>(arg);
|
|
219
|
+
if (self) self->notifyTaskFromInterrupt();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
void IRAM_ATTR TouchController::notifyTaskFromInterrupt() {
|
|
223
|
+
g_touchIntUs = esp_timer_get_time();
|
|
224
|
+
BaseType_t woken = pdFALSE;
|
|
225
|
+
if (task_) vTaskNotifyGiveFromISR(task_, &woken);
|
|
226
|
+
portYIELD_FROM_ISR(woken);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
void TouchController::taskEntry(void *arg) {
|
|
230
|
+
static_cast<TouchController *>(arg)->pollLoop();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
void TouchController::pollLoop() {
|
|
234
|
+
// Per-finger slot tracking (mirrors the CST9217 multi-touch controller): each
|
|
235
|
+
// slot emits its own Down/Move/Up tagged with its pointerId, so a second
|
|
236
|
+
// finger (pointerId 1) reaches the maps pinch-zoom gesture. Slot 0 remains the
|
|
237
|
+
// primary pointer (drives scroll/focus + the consumeLatestMove fast path).
|
|
238
|
+
bool slotActive[kMaxFingers] = {false, false};
|
|
239
|
+
int slotX[kMaxFingers] = {0, 0};
|
|
240
|
+
int slotY[kMaxFingers] = {0, 0};
|
|
241
|
+
bool anyActive = false;
|
|
242
|
+
|
|
243
|
+
while (true) {
|
|
244
|
+
// Interrupt-driven while idle (wait for the touch INT); poll at the report
|
|
245
|
+
// rate while any finger is down.
|
|
246
|
+
// Waiting forever while idle is only safe when an interrupt can wake this
|
|
247
|
+
// task. A board that routes INT to an I2C expander has none, so it polls on
|
|
248
|
+
// the report interval instead -- otherwise the first touch is never read.
|
|
249
|
+
constexpr bool kInterruptDriven = kInterruptPin >= 0;
|
|
250
|
+
const TickType_t wait =
|
|
251
|
+
(anyActive || !kInterruptDriven) ? pdMS_TO_TICKS(kPollIntervalMs) : portMAX_DELAY;
|
|
252
|
+
ulTaskNotifyTake(pdTRUE, wait);
|
|
253
|
+
const std::int64_t wakeUs = esp_timer_get_time();
|
|
254
|
+
|
|
255
|
+
gea::chips::ft3168::MultiTouchSample multi;
|
|
256
|
+
core_.readMulti(device_, multi); // multi.count == 0 when no contact
|
|
257
|
+
const std::int64_t readUs = esp_timer_get_time();
|
|
258
|
+
|
|
259
|
+
// DIAG: does the chip ever report a 2nd contact?
|
|
260
|
+
static int s_maxCount = 0;
|
|
261
|
+
if (multi.count > s_maxCount) {
|
|
262
|
+
s_maxCount = multi.count;
|
|
263
|
+
ESP_LOGW(kTag, "DIAG maxCount=%d (p0=%d,%d p1=%d,%d)", multi.count, multi.x[0], multi.y[0], multi.x[1],
|
|
264
|
+
multi.y[1]);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
current_ = multi.count > 0 ? TouchSample{true, multi.x[0], multi.y[0]}
|
|
268
|
+
: TouchSample{false, current_.x, current_.y};
|
|
269
|
+
|
|
270
|
+
for (int slot = 0; slot < kMaxFingers; slot++) {
|
|
271
|
+
const bool nowActive = slot < multi.count;
|
|
272
|
+
const int x = nowActive ? multi.x[slot] : slotX[slot];
|
|
273
|
+
const int y = nowActive ? multi.y[slot] : slotY[slot];
|
|
274
|
+
|
|
275
|
+
if (nowActive && !slotActive[slot]) {
|
|
276
|
+
ESP_LOGW(kTag, "TOUCH down slot=%d %d,%d int->wake=%lldus wake->read=%lldus", slot, x, y,
|
|
277
|
+
static_cast<long long>(wakeUs - g_touchIntUs), static_cast<long long>(readUs - wakeUs));
|
|
278
|
+
if (slot == 0) latestMove_ = TouchSample{true, x, y};
|
|
279
|
+
notifyPointer(Phase::Down, true, x, y, slot);
|
|
280
|
+
} else if (nowActive && slotActive[slot] && (x != slotX[slot] || y != slotY[slot])) {
|
|
281
|
+
if (slot == 0) {
|
|
282
|
+
// Coalesce primary moves through latestMove_ so the runtime's
|
|
283
|
+
// consumeLatestMove drains the freshest coord (queued-move fast path).
|
|
284
|
+
latestMove_ = TouchSample{true, x, y};
|
|
285
|
+
if (!latestMoveQueued_.exchange(true, std::memory_order_acq_rel)) {
|
|
286
|
+
notifyPointer(Phase::Move, true, x, y, slot);
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
notifyPointer(Phase::Move, true, x, y, slot);
|
|
290
|
+
}
|
|
291
|
+
} else if (!nowActive && slotActive[slot]) {
|
|
292
|
+
ESP_LOGW(kTag, "TOUCH up slot=%d %d,%d wake->read=%lldus", slot, x, y,
|
|
293
|
+
static_cast<long long>(readUs - wakeUs));
|
|
294
|
+
notifyPointer(Phase::Up, false, x, y, slot);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (nowActive) {
|
|
298
|
+
slotX[slot] = x;
|
|
299
|
+
slotY[slot] = y;
|
|
300
|
+
}
|
|
301
|
+
slotActive[slot] = nowActive;
|
|
302
|
+
}
|
|
303
|
+
anyActive = multi.count > 0;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
void TouchController::notifyObserver(Phase phase, const TouchSample &sample) {
|
|
308
|
+
notifyPointer(phase, sample.touching, sample.x, sample.y, 0);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
void TouchController::notifyPointer(Phase phase, bool touching, int x, int y, int pointerId) {
|
|
312
|
+
// A multi-finger observer (set by the runtime when an app uses multi-touch)
|
|
313
|
+
// takes every contact; otherwise the legacy single Observer gets the primary.
|
|
314
|
+
if (pointerObserver_) {
|
|
315
|
+
pointerObserver_(phase, touching, x, y, pointerId);
|
|
316
|
+
} else if (observer_ && pointerId == 0) {
|
|
317
|
+
observer_(phase, touching, x, y);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
void TouchController::notifyMove(const TouchSample &sample) {
|
|
322
|
+
latestMove_ = sample;
|
|
323
|
+
if (latestMoveQueued_.exchange(true, std::memory_order_acq_rel)) return;
|
|
324
|
+
notifyPointer(Phase::Move, true, sample.x, sample.y, 0);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
void TouchController::injectEvent(Phase phase, bool touching, int x, int y) {
|
|
328
|
+
TouchSample sample;
|
|
329
|
+
sample.x = x;
|
|
330
|
+
sample.y = y;
|
|
331
|
+
sample.touching = touching;
|
|
332
|
+
current_ = sample;
|
|
333
|
+
// Route Move through notifyMove so latestMove_ is set — otherwise the
|
|
334
|
+
// TouchRuntime's consumeLatestMove would overwrite the injected coords with
|
|
335
|
+
// the last real hardware sample and the synthetic drag wouldn't scroll.
|
|
336
|
+
if (phase == Phase::Move) notifyMove(sample);
|
|
337
|
+
else notifyObserver(phase, sample);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
} // namespace gea::platform::esp32::chip_bindings::ft3168
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "touch/ft3168/ft3168.h"
|
|
4
|
+
#include "touch.h"
|
|
5
|
+
|
|
6
|
+
#include <cstddef>
|
|
7
|
+
#include <cstdint>
|
|
8
|
+
#include <atomic>
|
|
9
|
+
|
|
10
|
+
#include "driver/gpio.h"
|
|
11
|
+
#include "driver/i2c_master.h"
|
|
12
|
+
#include "esp_err.h"
|
|
13
|
+
#include "freertos/FreeRTOS.h"
|
|
14
|
+
#include "freertos/task.h"
|
|
15
|
+
|
|
16
|
+
// GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL=1 keeps the controller and its task
|
|
17
|
+
// stack out of internal SRAM: the object comes from external RAM and the task
|
|
18
|
+
// is created with a heap stack there (its control block from the internal
|
|
19
|
+
// heap, which FreeRTOS requires). Default off: everything is static, as
|
|
20
|
+
// before. The task waits on a notification and talks I2C; when the app
|
|
21
|
+
// executes from external RAM it never runs with the flash cache disabled, so
|
|
22
|
+
// nothing here needs internal memory. Needs
|
|
23
|
+
// CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY.
|
|
24
|
+
#ifndef GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
25
|
+
#define GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL 0
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
namespace gea::platform::esp32::chip_bindings::ft3168 {
|
|
29
|
+
|
|
30
|
+
using TouchSample = gea::chips::ft3168::TouchSample;
|
|
31
|
+
|
|
32
|
+
class EspI2cRegisterBus final : public gea::chips::ft3168::RegisterBus {
|
|
33
|
+
public:
|
|
34
|
+
bool attach(i2c_master_bus_handle_t bus);
|
|
35
|
+
bool writeRegister(std::uint8_t reg, std::uint8_t value) override;
|
|
36
|
+
bool readRegisters(std::uint8_t reg, std::uint8_t *data, std::size_t length) override;
|
|
37
|
+
|
|
38
|
+
private:
|
|
39
|
+
i2c_master_dev_handle_t device_ = nullptr;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
class TouchController {
|
|
43
|
+
public:
|
|
44
|
+
using Observer = gea::platform::touch::Touchscreen::Observer;
|
|
45
|
+
using PointerObserver = gea::platform::touch::Touchscreen::PointerObserver;
|
|
46
|
+
using Phase = gea::platform::touch::Phase;
|
|
47
|
+
|
|
48
|
+
TouchController(const TouchController &) = delete;
|
|
49
|
+
TouchController &operator=(const TouchController &) = delete;
|
|
50
|
+
|
|
51
|
+
static TouchController &instance();
|
|
52
|
+
|
|
53
|
+
void setObserver(Observer observer);
|
|
54
|
+
// Strong override of the runtime's weak default: a multi-finger observer that
|
|
55
|
+
// receives every contact tagged with a pointerId (0 = primary). The maps
|
|
56
|
+
// pinch-zoom gesture needs the second finger (pointerId 1).
|
|
57
|
+
void setPointerObserver(PointerObserver observer);
|
|
58
|
+
esp_err_t begin();
|
|
59
|
+
bool read(TouchSample &sample);
|
|
60
|
+
TouchSample cached() const;
|
|
61
|
+
void consumeLatestMove(int *x, int *y);
|
|
62
|
+
// Inject a synthetic touch event through the same notify path as the hardware
|
|
63
|
+
// poll loop. A Move updates latestMove_ (so the TouchRuntime's
|
|
64
|
+
// consumeLatestMove returns these coords instead of stale hardware samples),
|
|
65
|
+
// letting GEADEV DRAG/SWIPE drive scroll gestures exactly like a real finger.
|
|
66
|
+
void injectEvent(Phase phase, bool touching, int x, int y);
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
TouchController() = default;
|
|
70
|
+
|
|
71
|
+
esp_err_t resetChip();
|
|
72
|
+
esp_err_t attachI2cDevice();
|
|
73
|
+
esp_err_t configureChip();
|
|
74
|
+
esp_err_t startTask();
|
|
75
|
+
esp_err_t attachInterrupt();
|
|
76
|
+
static void interruptEntry(void *arg);
|
|
77
|
+
void notifyTaskFromInterrupt();
|
|
78
|
+
static void taskEntry(void *arg);
|
|
79
|
+
void pollLoop();
|
|
80
|
+
void notifyObserver(Phase phase, const TouchSample &sample);
|
|
81
|
+
void notifyPointer(Phase phase, bool touching, int x, int y, int pointerId);
|
|
82
|
+
void notifyMove(const TouchSample &sample);
|
|
83
|
+
|
|
84
|
+
static constexpr std::size_t kTaskStackWords = 4096;
|
|
85
|
+
static constexpr int kMaxFingers = gea::chips::ft3168::kMaxTouchPoints;
|
|
86
|
+
|
|
87
|
+
bool initialized_ = false;
|
|
88
|
+
i2c_master_bus_handle_t bus_ = nullptr;
|
|
89
|
+
EspI2cRegisterBus device_;
|
|
90
|
+
gea::chips::ft3168::ControllerCore core_;
|
|
91
|
+
TaskHandle_t task_ = nullptr;
|
|
92
|
+
#if !GEA_EMBEDDED_TOUCH_TASK_STACK_EXTERNAL
|
|
93
|
+
StaticTask_t taskControlBlock_ = {};
|
|
94
|
+
StackType_t taskStack_[kTaskStackWords] = {};
|
|
95
|
+
#endif
|
|
96
|
+
gea::chips::ft3168::TouchSample current_ = {};
|
|
97
|
+
gea::chips::ft3168::TouchSample latestMove_ = {};
|
|
98
|
+
std::atomic<bool> latestMoveQueued_{false};
|
|
99
|
+
Observer observer_ = nullptr;
|
|
100
|
+
PointerObserver pointerObserver_ = nullptr;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} // namespace gea::platform::esp32::chip_bindings::ft3168
|