@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,2553 @@
|
|
|
1
|
+
#include "rp2350_gea_platform.h"
|
|
2
|
+
|
|
3
|
+
#include <rp2350_panel.h>
|
|
4
|
+
|
|
5
|
+
#include "app.h"
|
|
6
|
+
#include "audio.h"
|
|
7
|
+
#include "board.h"
|
|
8
|
+
#include "canvas.h"
|
|
9
|
+
#include "display.h"
|
|
10
|
+
#include "display_present.h"
|
|
11
|
+
#include "event.h"
|
|
12
|
+
#include "events.h"
|
|
13
|
+
#include "host/audio.h"
|
|
14
|
+
#include "host/backends.h"
|
|
15
|
+
#include "host/display_orientation.h"
|
|
16
|
+
#include "host/timers.h"
|
|
17
|
+
#include "input.h"
|
|
18
|
+
#include "memory.h"
|
|
19
|
+
#include "pixel.h"
|
|
20
|
+
#include "services/frame_scheduler.h"
|
|
21
|
+
#include "services/storage_service.h"
|
|
22
|
+
#include "touch.h"
|
|
23
|
+
#ifndef GEA_RP2350_HAS_TOUCH
|
|
24
|
+
#define GEA_RP2350_HAS_TOUCH 1
|
|
25
|
+
#endif
|
|
26
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
27
|
+
#include "touch/ft6336/ft6336.h"
|
|
28
|
+
#endif
|
|
29
|
+
#include "ui/document.h"
|
|
30
|
+
#include "ui/internal.h"
|
|
31
|
+
#include "ui/style.h"
|
|
32
|
+
#include "ui/tree_internal.h"
|
|
33
|
+
|
|
34
|
+
#if __has_include("gea_embedded_app_config.h")
|
|
35
|
+
#include "gea_embedded_app_config.h"
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#include "hardware/adc.h"
|
|
39
|
+
#include "hardware/gpio.h"
|
|
40
|
+
#include "hardware/i2c.h"
|
|
41
|
+
#include "hardware/sync.h"
|
|
42
|
+
#include "pico/bootrom.h"
|
|
43
|
+
#include "pico/multicore.h"
|
|
44
|
+
#include "pico/stdlib.h"
|
|
45
|
+
|
|
46
|
+
#include <algorithm>
|
|
47
|
+
#include <array>
|
|
48
|
+
#include <cstddef>
|
|
49
|
+
#include <cstdint>
|
|
50
|
+
#include <cstdio>
|
|
51
|
+
#include <cstdlib>
|
|
52
|
+
#include <cstring>
|
|
53
|
+
#include <functional>
|
|
54
|
+
#include <new>
|
|
55
|
+
#include <string>
|
|
56
|
+
#include <utility>
|
|
57
|
+
#include <vector>
|
|
58
|
+
|
|
59
|
+
extern "C" {
|
|
60
|
+
#include "rp_pico_alloc.h"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#ifndef GEA_RP2350_HAS_BUTTONS
|
|
64
|
+
#define GEA_RP2350_HAS_BUTTONS 0
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
// Opt-in: make the hardware Up/Down buttons scroll the primary scrollable
|
|
68
|
+
// container by default (browser-style arrow-key page scroll). Off by default;
|
|
69
|
+
// enabled only by boards that want it (e.g. the touchless Tufty 2350).
|
|
70
|
+
#ifndef GEA_RP2350_DEFAULT_BUTTON_SCROLL
|
|
71
|
+
#define GEA_RP2350_DEFAULT_BUTTON_SCROLL 0
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#ifndef GEA_RP2350_FRAMEBUFFER_IN_SRAM
|
|
75
|
+
#define GEA_RP2350_FRAMEBUFFER_IN_SRAM 0
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
#ifndef GEA_RP2350_BACKGROUND_CACHE_IN_SRAM
|
|
79
|
+
#ifdef GEA_EMBEDDED_DISPLAY_BACKGROUND_CACHE_IN_SRAM
|
|
80
|
+
#define GEA_RP2350_BACKGROUND_CACHE_IN_SRAM GEA_EMBEDDED_DISPLAY_BACKGROUND_CACHE_IN_SRAM
|
|
81
|
+
#elif defined(GEA_RP2350_DEFAULT_BACKGROUND_CACHE_IN_SRAM)
|
|
82
|
+
#define GEA_RP2350_BACKGROUND_CACHE_IN_SRAM GEA_RP2350_DEFAULT_BACKGROUND_CACHE_IN_SRAM
|
|
83
|
+
#else
|
|
84
|
+
#define GEA_RP2350_BACKGROUND_CACHE_IN_SRAM 0
|
|
85
|
+
#endif
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#ifndef GEA_RP2350_DISPLAY_COMMAND_BUFFER_BYTES
|
|
89
|
+
#define GEA_RP2350_DISPLAY_COMMAND_BUFFER_BYTES 0
|
|
90
|
+
#endif
|
|
91
|
+
|
|
92
|
+
#ifndef GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS
|
|
93
|
+
#ifdef GEA_EMBEDDED_DISPLAY_COMMAND_BUFFER_COMMANDS
|
|
94
|
+
#define GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS GEA_EMBEDDED_DISPLAY_COMMAND_BUFFER_COMMANDS
|
|
95
|
+
#elif defined(GEA_RP2350_DEFAULT_DISPLAY_COMMAND_BUFFER_COMMANDS)
|
|
96
|
+
#define GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS GEA_RP2350_DEFAULT_DISPLAY_COMMAND_BUFFER_COMMANDS
|
|
97
|
+
#else
|
|
98
|
+
#define GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS 0
|
|
99
|
+
#endif
|
|
100
|
+
#endif
|
|
101
|
+
|
|
102
|
+
#ifndef GEA_RP2350_PIE_BLEND
|
|
103
|
+
#define GEA_RP2350_PIE_BLEND 0
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
#ifndef GEA_RP2350_EARLY_PSRAM_ALLOC
|
|
107
|
+
#define GEA_RP2350_EARLY_PSRAM_ALLOC 0
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#ifndef GEA_RP2350_RENDER_CORE1
|
|
111
|
+
// Second M33 rasters the bottom half of each present chunk in parallel with the
|
|
112
|
+
// first core's top half — the present is raster-bound, not bus-bound, so this is
|
|
113
|
+
// the main fps lever. See rasterPresentChunk.
|
|
114
|
+
#define GEA_RP2350_RENDER_CORE1 1
|
|
115
|
+
#endif
|
|
116
|
+
|
|
117
|
+
#ifndef GEA_RP2350_RENDER_CORE1_STACK_BYTES
|
|
118
|
+
// Dedicated stack: the worker runs present::rasterFrameRows (local Canvas + the
|
|
119
|
+
// per-command raster recursion), which needs more than the 2KB pico-sdk default.
|
|
120
|
+
#define GEA_RP2350_RENDER_CORE1_STACK_BYTES 8192
|
|
121
|
+
#endif
|
|
122
|
+
|
|
123
|
+
#ifndef GEA_RP2350_RENDER_CORE1_WAIT_TIMEOUT_US
|
|
124
|
+
#define GEA_RP2350_RENDER_CORE1_WAIT_TIMEOUT_US 0
|
|
125
|
+
#endif
|
|
126
|
+
|
|
127
|
+
#ifndef GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
128
|
+
#define GEA_RP2350_SOFTWARE_SCROLL_REGISTER 1
|
|
129
|
+
#endif
|
|
130
|
+
|
|
131
|
+
// Use a panel's DCS vertical-scroll register (VSCRDEF/VSCSAD) for full-screen
|
|
132
|
+
// vertical scrolls: the framebuffer keeps its circular row layout, GRAM mirrors
|
|
133
|
+
// it 1:1, and the panel applies the display-order rotation itself — so a scroll
|
|
134
|
+
// frame only streams the revealed strip (plus scrollbar/slot damage) instead of
|
|
135
|
+
// re-streaming the whole region. Requires GEA_RP2350_SOFTWARE_SCROLL_REGISTER.
|
|
136
|
+
// ⚠ MUST STAY OFF for the Waveshare 2.41 RM690B0: this panel IGNORES
|
|
137
|
+
// VSCRDEF/VSCSAD (verified 2026-07-02 — the display shows stale content while
|
|
138
|
+
// fps soars because nothing streams). That's exactly why the software scroll
|
|
139
|
+
// register exists. Only enable on a panel proven to honor 0x33/0x37.
|
|
140
|
+
#ifndef GEA_RP2350_PANEL_HW_VSCROLL
|
|
141
|
+
#define GEA_RP2350_PANEL_HW_VSCROLL 0
|
|
142
|
+
#endif
|
|
143
|
+
|
|
144
|
+
namespace gea::framework::app::generated {
|
|
145
|
+
void drainMicrotasks();
|
|
146
|
+
} // namespace gea::framework::app::generated
|
|
147
|
+
|
|
148
|
+
namespace {
|
|
149
|
+
|
|
150
|
+
namespace board = gea::platform::board;
|
|
151
|
+
constexpr std::uint32_t kAllocMagic = 0x47454152u;
|
|
152
|
+
|
|
153
|
+
i2c_inst_t *boardI2c()
|
|
154
|
+
{
|
|
155
|
+
return board::i2c.bus == 1 ? i2c1 : i2c0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
struct AllocHeader {
|
|
159
|
+
std::uint32_t magic = kAllocMagic;
|
|
160
|
+
std::uint32_t flags = 0;
|
|
161
|
+
std::size_t size = 0;
|
|
162
|
+
std::size_t alignment = 0;
|
|
163
|
+
void *raw = nullptr;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
bool gUseRpAllocator = false;
|
|
167
|
+
|
|
168
|
+
struct PoolAllocationStats {
|
|
169
|
+
std::uint32_t allocCount = 0;
|
|
170
|
+
std::uint32_t freeCount = 0;
|
|
171
|
+
std::size_t liveBytes = 0;
|
|
172
|
+
std::size_t peakBytes = 0;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
PoolAllocationStats gSramAllocStats;
|
|
176
|
+
PoolAllocationStats gPsramAllocStats;
|
|
177
|
+
|
|
178
|
+
PoolAllocationStats &poolStats(bool rp)
|
|
179
|
+
{
|
|
180
|
+
return rp ? gPsramAllocStats : gSramAllocStats;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
void noteAllocation(bool rp, std::size_t size)
|
|
184
|
+
{
|
|
185
|
+
auto &stats = poolStats(rp);
|
|
186
|
+
stats.allocCount++;
|
|
187
|
+
stats.liveBytes += size;
|
|
188
|
+
if (stats.liveBytes > stats.peakBytes) stats.peakBytes = stats.liveBytes;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
void noteFree(bool rp, std::size_t size)
|
|
192
|
+
{
|
|
193
|
+
auto &stats = poolStats(rp);
|
|
194
|
+
stats.freeCount++;
|
|
195
|
+
stats.liveBytes = size <= stats.liveBytes ? stats.liveBytes - size : 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
struct RawAllocation {
|
|
199
|
+
void *ptr = nullptr;
|
|
200
|
+
bool rp = false;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
RawAllocation rawAlloc(std::size_t size)
|
|
204
|
+
{
|
|
205
|
+
if (gUseRpAllocator) {
|
|
206
|
+
if (void *ptr = rp_mem_malloc(size)) return {ptr, true};
|
|
207
|
+
}
|
|
208
|
+
#if GEA_RP2350_EARLY_PSRAM_ALLOC
|
|
209
|
+
if (void *ptr = rp_mem_malloc(size)) return {ptr, true};
|
|
210
|
+
#endif
|
|
211
|
+
return {std::malloc(size), false};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
void rawFree(void *ptr, bool rp)
|
|
215
|
+
{
|
|
216
|
+
if (!ptr) return;
|
|
217
|
+
if (rp) rp_mem_free(ptr);
|
|
218
|
+
else std::free(ptr);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
void *allocBlock(std::size_t size, std::size_t alignment)
|
|
222
|
+
{
|
|
223
|
+
if (size == 0) size = 1;
|
|
224
|
+
if (alignment < alignof(void *)) alignment = alignof(void *);
|
|
225
|
+
const std::size_t total = size + alignment - 1 + sizeof(AllocHeader);
|
|
226
|
+
RawAllocation raw = rawAlloc(total);
|
|
227
|
+
if (!raw.ptr) {
|
|
228
|
+
reset_usb_boot(0, 0);
|
|
229
|
+
std::abort();
|
|
230
|
+
}
|
|
231
|
+
const auto base = reinterpret_cast<std::uintptr_t>(raw.ptr) + sizeof(AllocHeader);
|
|
232
|
+
const auto aligned = (base + alignment - 1) & ~(static_cast<std::uintptr_t>(alignment) - 1);
|
|
233
|
+
auto *header = reinterpret_cast<AllocHeader *>(aligned - sizeof(AllocHeader));
|
|
234
|
+
header->magic = kAllocMagic;
|
|
235
|
+
header->flags = raw.rp ? 1u : 0u;
|
|
236
|
+
header->size = size;
|
|
237
|
+
header->alignment = alignment;
|
|
238
|
+
header->raw = raw.ptr;
|
|
239
|
+
noteAllocation(raw.rp, size);
|
|
240
|
+
return reinterpret_cast<void *>(aligned);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
AllocHeader *headerFor(void *ptr)
|
|
244
|
+
{
|
|
245
|
+
if (!ptr) return nullptr;
|
|
246
|
+
auto *header = reinterpret_cast<AllocHeader *>(reinterpret_cast<std::uintptr_t>(ptr) - sizeof(AllocHeader));
|
|
247
|
+
return header->magic == kAllocMagic ? header : nullptr;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
void freeBlock(void *ptr) noexcept
|
|
251
|
+
{
|
|
252
|
+
if (!ptr) return;
|
|
253
|
+
AllocHeader *header = headerFor(ptr);
|
|
254
|
+
if (!header) {
|
|
255
|
+
std::free(ptr);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
void *raw = header->raw;
|
|
259
|
+
const bool rp = (header->flags & 1u) != 0;
|
|
260
|
+
const std::size_t size = header->size;
|
|
261
|
+
header->magic = 0;
|
|
262
|
+
noteFree(rp, size);
|
|
263
|
+
rawFree(raw, rp);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
void *reallocBlock(void *ptr, std::size_t size)
|
|
267
|
+
{
|
|
268
|
+
if (!ptr) return allocBlock(size, alignof(std::max_align_t));
|
|
269
|
+
AllocHeader *header = headerFor(ptr);
|
|
270
|
+
if (!header) return std::realloc(ptr, size);
|
|
271
|
+
void *next = allocBlock(size, header->alignment);
|
|
272
|
+
std::memcpy(next, ptr, std::min(size, header->size));
|
|
273
|
+
freeBlock(ptr);
|
|
274
|
+
return next;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
using Pixel = gea::framework::graphics::pixel::native_t;
|
|
278
|
+
namespace present = gea::framework::display_present;
|
|
279
|
+
gea::framework::graphics::Canvas gDisplayCanvas;
|
|
280
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
281
|
+
gea::framework::graphics::Canvas gRenderWorkerCanvas;
|
|
282
|
+
#endif
|
|
283
|
+
#if GEA_RP2350_FRAMEBUFFER_IN_SRAM
|
|
284
|
+
alignas(4) Pixel gSramFramebuffer[gea::rp2350::kPanelWidth * gea::rp2350::kPanelHeight]
|
|
285
|
+
__attribute__((section(".uninitialized_data")));
|
|
286
|
+
#endif
|
|
287
|
+
#if GEA_RP2350_BACKGROUND_CACHE_IN_SRAM
|
|
288
|
+
alignas(4) Pixel gSramBackgroundCache[gea::rp2350::kPanelWidth * gea::rp2350::kPanelHeight]
|
|
289
|
+
__attribute__((section(".uninitialized_data")));
|
|
290
|
+
#endif
|
|
291
|
+
#if GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS > 0
|
|
292
|
+
alignas(gea::embedded::ui::DisplayCommand) gea::embedded::ui::DisplayCommand
|
|
293
|
+
gSramDisplayCommandBuffer[GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS]
|
|
294
|
+
__attribute__((section(".uninitialized_data")));
|
|
295
|
+
#elif GEA_RP2350_DISPLAY_COMMAND_BUFFER_BYTES > 0
|
|
296
|
+
alignas(16) std::uint8_t gSramDisplayCommandBuffer[GEA_RP2350_DISPLAY_COMMAND_BUFFER_BYTES]
|
|
297
|
+
__attribute__((section(".uninitialized_data")));
|
|
298
|
+
#endif
|
|
299
|
+
Pixel *gFramebuffer = nullptr;
|
|
300
|
+
std::uint8_t gDisplayAlpha = 255;
|
|
301
|
+
int gFlushRows = 64;
|
|
302
|
+
int gFlushDepth = 2;
|
|
303
|
+
int gFrameIntervalMs = gea::framework::services::FrameScheduler::kDefaultFrameIntervalMs;
|
|
304
|
+
int gFlushCalls = 0;
|
|
305
|
+
int gFlushPixels = 0;
|
|
306
|
+
int gBrightness = 100;
|
|
307
|
+
bool gVsyncDriven = false;
|
|
308
|
+
bool gInvalidated = true;
|
|
309
|
+
present::Frame gPreviousPresentFrame;
|
|
310
|
+
bool gPreviousPresentValid = false;
|
|
311
|
+
// Present render-scale (1 = native, 2 = app renders a half-panel viewport and the
|
|
312
|
+
// present 2x-upscales each chunk). gea3d opts in via Display::setPresentScale(2)
|
|
313
|
+
// when it renders into a width/2 x height/2 viewport — half the fill/overdraw,
|
|
314
|
+
// full-res out. Matches the ESP32 backend's presentScale_ behaviour.
|
|
315
|
+
int gPresentScale = 1;
|
|
316
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
317
|
+
int gScrollRegionY = 0;
|
|
318
|
+
int gScrollRegionH = 0;
|
|
319
|
+
int gScrollOffsetY = 0;
|
|
320
|
+
#endif
|
|
321
|
+
|
|
322
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
323
|
+
struct RenderWorkerTask {
|
|
324
|
+
void (*fn)(void *, int, int) = nullptr;
|
|
325
|
+
void *ctx = nullptr;
|
|
326
|
+
int y0 = 0;
|
|
327
|
+
int y1 = -1;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
constexpr std::uint32_t kRenderWorkerRun = 0x47455231u; // "GER1"
|
|
331
|
+
constexpr std::uint32_t kRenderWorkerDone = 0x47455244u; // "GERD"
|
|
332
|
+
RenderWorkerTask gRenderWorkerTask;
|
|
333
|
+
volatile bool gRenderWorkerReady = false;
|
|
334
|
+
volatile bool gRenderWorkerInFlight = false;
|
|
335
|
+
#if GEA_RP2350_RENDER_CORE1_STACK_BYTES > 0
|
|
336
|
+
static_assert((GEA_RP2350_RENDER_CORE1_STACK_BYTES % sizeof(std::uint32_t)) == 0,
|
|
337
|
+
"Core1 render stack size must be a multiple of 4 bytes");
|
|
338
|
+
alignas(8) std::uint32_t gRenderWorkerStack[GEA_RP2350_RENDER_CORE1_STACK_BYTES / sizeof(std::uint32_t)]
|
|
339
|
+
__attribute__((section(".uninitialized_data")));
|
|
340
|
+
#endif
|
|
341
|
+
#endif
|
|
342
|
+
|
|
343
|
+
bool onRenderWorkerCore()
|
|
344
|
+
{
|
|
345
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
346
|
+
return get_core_num() == 1;
|
|
347
|
+
#else
|
|
348
|
+
return false;
|
|
349
|
+
#endif
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
gea::framework::graphics::Canvas &activeDisplayCanvas()
|
|
353
|
+
{
|
|
354
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
355
|
+
if (onRenderWorkerCore()) return gRenderWorkerCanvas;
|
|
356
|
+
#endif
|
|
357
|
+
return gDisplayCanvas;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
361
|
+
void setScrollRegionAll(int regionY, int regionH, int scrollOffsetY)
|
|
362
|
+
{
|
|
363
|
+
gScrollRegionY = regionY;
|
|
364
|
+
gScrollRegionH = regionH;
|
|
365
|
+
gScrollOffsetY = scrollOffsetY;
|
|
366
|
+
gDisplayCanvas.setScrollRegion(regionY, regionH, scrollOffsetY);
|
|
367
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
368
|
+
gRenderWorkerCanvas.setScrollRegion(regionY, regionH, scrollOffsetY);
|
|
369
|
+
#endif
|
|
370
|
+
#if GEA_RP2350_PANEL_HW_VSCROLL
|
|
371
|
+
// Full-screen regions ride the panel's scroll register; partial-height
|
|
372
|
+
// regions keep VSCSAD at identity and flush through the software remap.
|
|
373
|
+
if (regionH > 0 && regionY == 0 && regionH == gea::rp2350::kPanelHeight) {
|
|
374
|
+
gea::rp2350::panelSetVerticalScroll(scrollOffsetY);
|
|
375
|
+
} else {
|
|
376
|
+
gea::rp2350::panelSetVerticalScroll(0);
|
|
377
|
+
}
|
|
378
|
+
#endif
|
|
379
|
+
}
|
|
380
|
+
#endif
|
|
381
|
+
|
|
382
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
383
|
+
void bindRenderWorkerCanvas()
|
|
384
|
+
{
|
|
385
|
+
if (gFramebuffer) {
|
|
386
|
+
gRenderWorkerCanvas.bindPixels(gFramebuffer, gea::rp2350::kPanelWidth, gea::rp2350::kPanelHeight);
|
|
387
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
388
|
+
gRenderWorkerCanvas.setScrollRegion(gScrollRegionY, gScrollRegionH, gScrollOffsetY);
|
|
389
|
+
#endif
|
|
390
|
+
gRenderWorkerCanvas.resetDirty();
|
|
391
|
+
gRenderWorkerCanvas.resetClip();
|
|
392
|
+
gRenderWorkerCanvas.setGlobalAlpha(255);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
void renderWorkerMain()
|
|
397
|
+
{
|
|
398
|
+
bindRenderWorkerCanvas();
|
|
399
|
+
__dmb();
|
|
400
|
+
gRenderWorkerReady = true;
|
|
401
|
+
while (true) {
|
|
402
|
+
const std::uint32_t cmd = multicore_fifo_pop_blocking();
|
|
403
|
+
if (cmd != kRenderWorkerRun) continue;
|
|
404
|
+
__dmb();
|
|
405
|
+
bindRenderWorkerCanvas();
|
|
406
|
+
RenderWorkerTask task = gRenderWorkerTask;
|
|
407
|
+
if (task.fn && task.y0 <= task.y1) {
|
|
408
|
+
task.fn(task.ctx, task.y0, task.y1);
|
|
409
|
+
}
|
|
410
|
+
__dmb();
|
|
411
|
+
multicore_fifo_push_blocking(kRenderWorkerDone);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
void startRenderWorker()
|
|
416
|
+
{
|
|
417
|
+
static bool launched = false;
|
|
418
|
+
if (launched) return;
|
|
419
|
+
launched = true;
|
|
420
|
+
#if GEA_RP2350_RENDER_CORE1_STACK_BYTES > 0
|
|
421
|
+
multicore_launch_core1_with_stack(renderWorkerMain, gRenderWorkerStack, sizeof(gRenderWorkerStack));
|
|
422
|
+
#else
|
|
423
|
+
multicore_launch_core1(renderWorkerMain);
|
|
424
|
+
#endif
|
|
425
|
+
for (int i = 0; i < 200000 && !gRenderWorkerReady; ++i) {
|
|
426
|
+
tight_loop_contents();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
#endif
|
|
430
|
+
|
|
431
|
+
struct FlushWindow {
|
|
432
|
+
int x0 = 0;
|
|
433
|
+
int y0 = 0;
|
|
434
|
+
int x1 = 0;
|
|
435
|
+
int y1 = 0;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
constexpr int kMaxCollectedWindows = 64;
|
|
439
|
+
constexpr int kWindowMergeGapShift = 2;
|
|
440
|
+
constexpr int kDenseWindowMergeThresholdPercent = 75;
|
|
441
|
+
|
|
442
|
+
struct ScheduledTimer {
|
|
443
|
+
double id = 0;
|
|
444
|
+
gea::host::TimerCallback callback;
|
|
445
|
+
double delayMs = 0;
|
|
446
|
+
double nextFireMs = 0;
|
|
447
|
+
bool interval = false;
|
|
448
|
+
bool active = false;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
std::array<ScheduledTimer, 16> gTimers{};
|
|
452
|
+
std::array<gea::host::AnimationFrameCallback, 16> gPendingRaf{};
|
|
453
|
+
std::array<gea::host::AnimationFrameCallback, 16> gActiveRaf{};
|
|
454
|
+
int gPendingRafCount = 0;
|
|
455
|
+
double gNextTimerId = 1;
|
|
456
|
+
double gLastTimestampMs = 0;
|
|
457
|
+
|
|
458
|
+
std::array<gea::framework::events::Event, gea::framework::services::FrameScheduler::kEventQueueDepth> gEvents{};
|
|
459
|
+
int gEventHead = 0;
|
|
460
|
+
int gEventTail = 0;
|
|
461
|
+
bool gEventQueueStarted = false;
|
|
462
|
+
|
|
463
|
+
#if GEA_RP2350_HAS_BUTTONS
|
|
464
|
+
std::array<bool, board::buttons.size()> gButtonDown{};
|
|
465
|
+
// Next time (µs since boot) a held auto-repeat button re-fires its keydown.
|
|
466
|
+
std::array<std::uint64_t, board::buttons.size()> gButtonNextRepeatUs{};
|
|
467
|
+
|
|
468
|
+
void dispatchKeyInput()
|
|
469
|
+
{
|
|
470
|
+
auto &tree = gea::embedded::ui::Tree::instance();
|
|
471
|
+
for (int keyCode = gea::framework::input::consumeKeyDown(); keyCode != 0;
|
|
472
|
+
keyCode = gea::framework::input::consumeKeyDown()) {
|
|
473
|
+
gea::framework::events::PointerEvent event{};
|
|
474
|
+
event.type = gea::framework::events::PointerEventType::KeyDown;
|
|
475
|
+
event.keyCode = keyCode;
|
|
476
|
+
event.bubbles = true;
|
|
477
|
+
event.cancelable = true;
|
|
478
|
+
|
|
479
|
+
const int inputId = tree.activeInputId();
|
|
480
|
+
bool stopped = false;
|
|
481
|
+
if (inputId >= 0) {
|
|
482
|
+
event.targetId = inputId;
|
|
483
|
+
event.currentTargetId = inputId;
|
|
484
|
+
tree.dispatchEvent(event);
|
|
485
|
+
stopped = event.propagationStopped;
|
|
486
|
+
}
|
|
487
|
+
if (!stopped) {
|
|
488
|
+
event.propagationStopped = false;
|
|
489
|
+
gea::embedded::ui::dispatchDocumentKeyDown(event);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
#if GEA_RP2350_DEFAULT_BUTTON_SCROLL
|
|
493
|
+
// Default action for the hardware Up/Down buttons on this touchless
|
|
494
|
+
// board: scroll the primary scrollable container, mirroring a browser's
|
|
495
|
+
// arrow-key page scroll. Skipped when a text input is focused (arrows
|
|
496
|
+
// move the caret there) or the app consumed the key via
|
|
497
|
+
// preventDefault().
|
|
498
|
+
constexpr int kKeyCodeArrowUp = 38; // web keyCode for ArrowUp
|
|
499
|
+
constexpr int kKeyCodeArrowDown = 40; // web keyCode for ArrowDown
|
|
500
|
+
constexpr int kButtonScrollStepPx = 12;
|
|
501
|
+
if (inputId < 0 && !event.defaultPrevented) {
|
|
502
|
+
if (keyCode == kKeyCodeArrowDown) {
|
|
503
|
+
tree.scrollByKeyStep(kButtonScrollStepPx);
|
|
504
|
+
} else if (keyCode == kKeyCodeArrowUp) {
|
|
505
|
+
tree.scrollByKeyStep(-kButtonScrollStepPx);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
#endif
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
#endif
|
|
512
|
+
|
|
513
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
514
|
+
class Ft6336Bus final : public gea::chips::ft6336::RegisterBus {
|
|
515
|
+
public:
|
|
516
|
+
bool writeRegister(std::uint8_t reg, std::uint8_t value) override
|
|
517
|
+
{
|
|
518
|
+
const std::uint8_t data[2] = {reg, value};
|
|
519
|
+
return i2c_write_blocking(boardI2c(), board::touch.address, data, 2, false) == 2;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
bool readRegister(std::uint8_t reg, std::uint8_t &value) override
|
|
523
|
+
{
|
|
524
|
+
if (i2c_write_blocking(boardI2c(), board::touch.address, ®, 1, true) != 1) return false;
|
|
525
|
+
return i2c_read_blocking(boardI2c(), board::touch.address, &value, 1, false) == 1;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
bool readRegisters(std::uint8_t reg, std::uint8_t *data, std::size_t length) override
|
|
529
|
+
{
|
|
530
|
+
if (!data || length == 0) return false;
|
|
531
|
+
if (i2c_write_blocking(boardI2c(), board::touch.address, ®, 1, true) != 1) return false;
|
|
532
|
+
return i2c_read_blocking(boardI2c(), board::touch.address, data, length, false) ==
|
|
533
|
+
static_cast<int>(length);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
Ft6336Bus gTouchBus;
|
|
538
|
+
gea::chips::ft6336::ControllerCore gTouchCore;
|
|
539
|
+
gea::platform::touch::Touchscreen::Observer gTouchObserver = nullptr;
|
|
540
|
+
bool gTouchInitialized = false;
|
|
541
|
+
bool gTouching = false;
|
|
542
|
+
int gTouchX = 0;
|
|
543
|
+
int gTouchY = 0;
|
|
544
|
+
|
|
545
|
+
// Synthetic drag driven by GEADEV DRAG: a per-frame state machine advanced by
|
|
546
|
+
// pollTouch() that feeds gTouchObserver the same Down/Move/Up sequence a
|
|
547
|
+
// finger would, at delayUs cadence. While active, hardware samples are
|
|
548
|
+
// ignored so a benchmark run can't be disturbed by an accidental touch.
|
|
549
|
+
struct SyntheticDrag {
|
|
550
|
+
bool active = false;
|
|
551
|
+
std::uint64_t startUs = 0;
|
|
552
|
+
std::uint64_t delayUs = 0;
|
|
553
|
+
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
|
|
554
|
+
int steps = 0;
|
|
555
|
+
int lastStep = -1;
|
|
556
|
+
};
|
|
557
|
+
SyntheticDrag gSyntheticDrag;
|
|
558
|
+
|
|
559
|
+
void pollSyntheticDrag()
|
|
560
|
+
{
|
|
561
|
+
SyntheticDrag &drag = gSyntheticDrag;
|
|
562
|
+
const std::uint64_t elapsedUs = time_us_64() - drag.startUs;
|
|
563
|
+
const int step = drag.delayUs > 0 ? static_cast<int>(elapsedUs / drag.delayUs) : drag.steps + 1;
|
|
564
|
+
if (drag.lastStep < 0) {
|
|
565
|
+
gTouchObserver(gea::platform::touch::Phase::Down, true, drag.x1, drag.y1);
|
|
566
|
+
gTouching = true;
|
|
567
|
+
gTouchX = drag.x1;
|
|
568
|
+
gTouchY = drag.y1;
|
|
569
|
+
drag.lastStep = 0;
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
if (step > drag.steps) {
|
|
573
|
+
gTouchObserver(gea::platform::touch::Phase::Up, false, gTouchX, gTouchY);
|
|
574
|
+
gTouching = false;
|
|
575
|
+
drag.active = false;
|
|
576
|
+
std::printf("GEADEV:OK DRAG x1=%d y1=%d x2=%d y2=%d steps=%d\n",
|
|
577
|
+
drag.x1, drag.y1, drag.x2, drag.y2, drag.steps);
|
|
578
|
+
std::fflush(stdout);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
if (step > drag.lastStep) {
|
|
582
|
+
const int clamped = std::min(step, drag.steps);
|
|
583
|
+
const int x = drag.x1 + ((drag.x2 - drag.x1) * clamped) / drag.steps;
|
|
584
|
+
const int y = drag.y1 + ((drag.y2 - drag.y1) * clamped) / drag.steps;
|
|
585
|
+
if (x != gTouchX || y != gTouchY) {
|
|
586
|
+
gTouchObserver(gea::platform::touch::Phase::Move, true, x, y);
|
|
587
|
+
gTouchX = x;
|
|
588
|
+
gTouchY = y;
|
|
589
|
+
}
|
|
590
|
+
drag.lastStep = step;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
#endif
|
|
594
|
+
|
|
595
|
+
void flushRectClipped(int x0, int y0, int x1, int y1)
|
|
596
|
+
{
|
|
597
|
+
if (!gFramebuffer) return;
|
|
598
|
+
x0 = std::max(0, x0);
|
|
599
|
+
y0 = std::max(0, y0);
|
|
600
|
+
x1 = std::min(gea::rp2350::kPanelWidth - 1, x1);
|
|
601
|
+
y1 = std::min(gea::rp2350::kPanelHeight - 1, y1);
|
|
602
|
+
if (x0 > x1 || y0 > y1) return;
|
|
603
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
604
|
+
if (gDisplayCanvas.scrollRegionH() > 0) {
|
|
605
|
+
#if GEA_RP2350_PANEL_HW_VSCROLL
|
|
606
|
+
if (gScrollRegionY == 0 && gScrollRegionH == gea::rp2350::kPanelHeight) {
|
|
607
|
+
// GRAM mirrors the framebuffer's circular layout and the panel
|
|
608
|
+
// rotates scanout via VSCSAD, so flush each logical rect as its
|
|
609
|
+
// contiguous physical row spans (≤2: a rect crossing the wrap).
|
|
610
|
+
int y = y0;
|
|
611
|
+
while (y <= y1) {
|
|
612
|
+
const int physY = gDisplayCanvas.rowToPhysical(y);
|
|
613
|
+
int run = 1;
|
|
614
|
+
while (y + run <= y1 && gDisplayCanvas.rowToPhysical(y + run) == physY + run) run++;
|
|
615
|
+
gea::rp2350::panelFlushRect(gFramebuffer, gea::rp2350::kPanelWidth, x0, physY, x1, physY + run - 1);
|
|
616
|
+
y += run;
|
|
617
|
+
}
|
|
618
|
+
gFlushCalls++;
|
|
619
|
+
gFlushPixels += (x1 - x0 + 1) * (y1 - y0 + 1);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
#endif
|
|
623
|
+
if (x0 == 0 && x1 == gea::rp2350::kPanelWidth - 1) {
|
|
624
|
+
// Full-width flush of a circularly remapped region: the display-order
|
|
625
|
+
// rows form contiguous framebuffer spans — DMA them straight from
|
|
626
|
+
// PSRAM (panelFlushFullWidthSpans), no per-row CPU copies. Round rows
|
|
627
|
+
// to the panel's window alignment first (extra rows are clean pixels).
|
|
628
|
+
y0 &= ~1;
|
|
629
|
+
y1 = std::min(gea::rp2350::kPanelHeight - 1, y1 | 1);
|
|
630
|
+
int y = y0;
|
|
631
|
+
while (y <= y1) {
|
|
632
|
+
const int phys0 = gDisplayCanvas.rowToPhysical(y);
|
|
633
|
+
int run0 = 1;
|
|
634
|
+
while (y + run0 <= y1 && gDisplayCanvas.rowToPhysical(y + run0) == phys0 + run0) run0++;
|
|
635
|
+
const int yNext = y + run0;
|
|
636
|
+
int run1 = 0;
|
|
637
|
+
int phys1 = 0;
|
|
638
|
+
if (yNext <= y1) {
|
|
639
|
+
phys1 = gDisplayCanvas.rowToPhysical(yNext);
|
|
640
|
+
run1 = 1;
|
|
641
|
+
while (yNext + run1 <= y1 && gDisplayCanvas.rowToPhysical(yNext + run1) == phys1 + run1) run1++;
|
|
642
|
+
}
|
|
643
|
+
gea::rp2350::panelFlushFullWidthSpans(
|
|
644
|
+
gFramebuffer + static_cast<std::size_t>(phys0) * gea::rp2350::kPanelWidth,
|
|
645
|
+
run0,
|
|
646
|
+
run1 > 0 ? gFramebuffer + static_cast<std::size_t>(phys1) * gea::rp2350::kPanelWidth : nullptr,
|
|
647
|
+
run1,
|
|
648
|
+
y);
|
|
649
|
+
y = yNext + run1;
|
|
650
|
+
}
|
|
651
|
+
gFlushCalls++;
|
|
652
|
+
gFlushPixels += (x1 - x0 + 1) * (y1 - y0 + 1);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
gea::rp2350::panelStreamRect(x0,
|
|
656
|
+
y0,
|
|
657
|
+
x1,
|
|
658
|
+
y1,
|
|
659
|
+
[](std::uint16_t *dst, int width, int height, int originX, int originY, void *) {
|
|
660
|
+
if (!gFramebuffer) return;
|
|
661
|
+
for (int row = 0; row < height; ++row) {
|
|
662
|
+
const int physicalY = gDisplayCanvas.rowToPhysical(originY + row);
|
|
663
|
+
std::copy_n(gFramebuffer + static_cast<std::size_t>(physicalY) * gea::rp2350::kPanelWidth + originX,
|
|
664
|
+
width,
|
|
665
|
+
dst + static_cast<std::size_t>(row) * width);
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
nullptr);
|
|
669
|
+
} else
|
|
670
|
+
#endif
|
|
671
|
+
gea::rp2350::panelFlushRect(gFramebuffer, gea::rp2350::kPanelWidth, x0, y0, x1, y1);
|
|
672
|
+
gFlushCalls++;
|
|
673
|
+
gFlushPixels += (x1 - x0 + 1) * (y1 - y0 + 1);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
int flushWindowArea(const FlushWindow &window)
|
|
677
|
+
{
|
|
678
|
+
if (window.x0 > window.x1 || window.y0 > window.y1) return 0;
|
|
679
|
+
return (window.x1 - window.x0 + 1) * (window.y1 - window.y0 + 1);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
FlushWindow uniteFlushWindows(const FlushWindow &a, const FlushWindow &b)
|
|
683
|
+
{
|
|
684
|
+
if (flushWindowArea(a) <= 0) return b;
|
|
685
|
+
if (flushWindowArea(b) <= 0) return a;
|
|
686
|
+
return {std::min(a.x0, b.x0), std::min(a.y0, b.y0), std::max(a.x1, b.x1), std::max(a.y1, b.y1)};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
bool flushWindowsOverlapOrTouch(const FlushWindow &a, const FlushWindow &b)
|
|
690
|
+
{
|
|
691
|
+
return a.x0 <= b.x1 + 1 && a.x1 + 1 >= b.x0 && a.y0 <= b.y1 + 1 && a.y1 + 1 >= b.y0;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
FlushWindow alignedFlushWindow(const gea::platform::display::DisplayFlushRect &rect)
|
|
695
|
+
{
|
|
696
|
+
const present::Rect aligned = present::clampAndAlign({rect.x0, rect.y0, rect.x1, rect.y1},
|
|
697
|
+
gea::rp2350::kPanelWidth,
|
|
698
|
+
gea::rp2350::kPanelHeight);
|
|
699
|
+
return {aligned.x0, aligned.y0, aligned.x1, aligned.y1};
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
int collectFlushWindows(const gea::platform::display::DisplayFlushRect *rects,
|
|
703
|
+
int count,
|
|
704
|
+
std::array<FlushWindow, kMaxCollectedWindows> &windows)
|
|
705
|
+
{
|
|
706
|
+
int windowCount = 0;
|
|
707
|
+
for (int i = 0; i < count; ++i) {
|
|
708
|
+
FlushWindow window = alignedFlushWindow(rects[i]);
|
|
709
|
+
if (flushWindowArea(window) <= 0) continue;
|
|
710
|
+
|
|
711
|
+
bool merged = false;
|
|
712
|
+
for (int existing = 0; existing < windowCount; ++existing) {
|
|
713
|
+
if (!flushWindowsOverlapOrTouch(windows[static_cast<std::size_t>(existing)], window)) continue;
|
|
714
|
+
windows[static_cast<std::size_t>(existing)] =
|
|
715
|
+
uniteFlushWindows(windows[static_cast<std::size_t>(existing)], window);
|
|
716
|
+
merged = true;
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
if (merged) continue;
|
|
720
|
+
|
|
721
|
+
if (windowCount < static_cast<int>(windows.size())) {
|
|
722
|
+
windows[static_cast<std::size_t>(windowCount++)] = window;
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
int best = 0;
|
|
727
|
+
int bestCost = 0x7fffffff;
|
|
728
|
+
for (int existing = 0; existing < windowCount; ++existing) {
|
|
729
|
+
const FlushWindow united = uniteFlushWindows(windows[static_cast<std::size_t>(existing)], window);
|
|
730
|
+
const int cost = flushWindowArea(united) - flushWindowArea(windows[static_cast<std::size_t>(existing)]);
|
|
731
|
+
if (cost < bestCost) {
|
|
732
|
+
bestCost = cost;
|
|
733
|
+
best = existing;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
windows[static_cast<std::size_t>(best)] = uniteFlushWindows(windows[static_cast<std::size_t>(best)], window);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
bool changed = true;
|
|
740
|
+
while (changed) {
|
|
741
|
+
changed = false;
|
|
742
|
+
for (int i = 0; i < windowCount && !changed; ++i) {
|
|
743
|
+
for (int j = i + 1; j < windowCount; ++j) {
|
|
744
|
+
const int areaI = flushWindowArea(windows[static_cast<std::size_t>(i)]);
|
|
745
|
+
const int areaJ = flushWindowArea(windows[static_cast<std::size_t>(j)]);
|
|
746
|
+
const FlushWindow united =
|
|
747
|
+
uniteFlushWindows(windows[static_cast<std::size_t>(i)], windows[static_cast<std::size_t>(j)]);
|
|
748
|
+
const int extra = flushWindowArea(united) - areaI - areaJ;
|
|
749
|
+
const int allowance = std::min(areaI, areaJ) >> kWindowMergeGapShift;
|
|
750
|
+
if (extra > allowance) continue;
|
|
751
|
+
windows[static_cast<std::size_t>(i)] = united;
|
|
752
|
+
windows[static_cast<std::size_t>(j)] = windows[static_cast<std::size_t>(--windowCount)];
|
|
753
|
+
changed = true;
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
if (windowCount >= 2) {
|
|
760
|
+
FlushWindow bounds = windows[0];
|
|
761
|
+
int areaSum = 0;
|
|
762
|
+
for (int i = 0; i < windowCount; ++i) {
|
|
763
|
+
bounds = uniteFlushWindows(bounds, windows[static_cast<std::size_t>(i)]);
|
|
764
|
+
areaSum += flushWindowArea(windows[static_cast<std::size_t>(i)]);
|
|
765
|
+
}
|
|
766
|
+
const int boundsArea = flushWindowArea(bounds);
|
|
767
|
+
if (boundsArea > 0 &&
|
|
768
|
+
areaSum * 100 >= boundsArea * kDenseWindowMergeThresholdPercent) {
|
|
769
|
+
windows[0] = bounds;
|
|
770
|
+
windowCount = 1;
|
|
771
|
+
} else {
|
|
772
|
+
const FlushWindow band{0, bounds.y0, gea::rp2350::kPanelWidth - 1, bounds.y1};
|
|
773
|
+
const int bandArea = flushWindowArea(band);
|
|
774
|
+
if (bandArea > 0 && bandArea <= areaSum * 3) {
|
|
775
|
+
windows[0] = band;
|
|
776
|
+
windowCount = 1;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
std::sort(windows.begin(), windows.begin() + windowCount, [](const FlushWindow &a, const FlushWindow &b) {
|
|
782
|
+
if (a.y0 != b.y0) return a.y0 < b.y0;
|
|
783
|
+
if (a.x0 != b.x0) return a.x0 < b.x0;
|
|
784
|
+
if (a.y1 != b.y1) return a.y1 < b.y1;
|
|
785
|
+
return a.x1 < b.x1;
|
|
786
|
+
});
|
|
787
|
+
return windowCount;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
void setGlobalAlpha(std::uint8_t alpha)
|
|
791
|
+
{
|
|
792
|
+
gDisplayAlpha = alpha;
|
|
793
|
+
gDisplayCanvas.setGlobalAlpha(alpha);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
struct PresentRasterContext {
|
|
797
|
+
const present::Frame *frame = nullptr;
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
// Half-res upscale scratch, one bank per core so core 0 (top rows) and core 1
|
|
801
|
+
// (bottom rows) never share it. Sized for a full DMA chunk (64 rows) at half-res.
|
|
802
|
+
constexpr int kMaxHalfChunkRows = 64 / 2 + 2;
|
|
803
|
+
alignas(4) std::uint16_t gUpscaleScratch[2][(gea::rp2350::kPanelWidth / 2 + 2) * kMaxHalfChunkRows];
|
|
804
|
+
|
|
805
|
+
struct ChunkRasterJob {
|
|
806
|
+
const present::Frame *frame = nullptr;
|
|
807
|
+
std::uint16_t *pixels = nullptr;
|
|
808
|
+
int width = 0;
|
|
809
|
+
int height = 0;
|
|
810
|
+
int originX = 0;
|
|
811
|
+
int originY = 0;
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
// Rasters chunk rows [ry0, ry1] (inclusive, chunk-local). Safe to run on either
|
|
815
|
+
// core: it reads the shared read-only Frame and writes only its own rows of
|
|
816
|
+
// `pixels` and its own per-core scratch bank.
|
|
817
|
+
void rasterChunkRows(const ChunkRasterJob &job, int ry0, int ry1)
|
|
818
|
+
{
|
|
819
|
+
if (ry1 < ry0) return;
|
|
820
|
+
const int rows = ry1 - ry0 + 1;
|
|
821
|
+
if (gPresentScale == 2) {
|
|
822
|
+
// The frame's commands are in half-panel (viewport) coordinates. Raster the
|
|
823
|
+
// half-res source region covering these rows into the scratch, then
|
|
824
|
+
// nearest-2x-expand it into the full-res chunk that streams to the panel.
|
|
825
|
+
const int hx0 = job.originX / 2;
|
|
826
|
+
const int hy0 = (job.originY + ry0) / 2;
|
|
827
|
+
const int hx1 = (job.originX + job.width - 1) / 2;
|
|
828
|
+
const int hy1 = (job.originY + ry1) / 2;
|
|
829
|
+
const int hw = hx1 - hx0 + 1;
|
|
830
|
+
const int hh = hy1 - hy0 + 1;
|
|
831
|
+
std::uint16_t *scratch = gUpscaleScratch[onRenderWorkerCore() ? 1 : 0];
|
|
832
|
+
present::rasterFrameRows(scratch, hx0, hw, hy0, hh,
|
|
833
|
+
gea::rp2350::kPanelHeight / 2, *job.frame);
|
|
834
|
+
for (int ly = ry0; ly <= ry1; ++ly) {
|
|
835
|
+
const int sy = (job.originY + ly) / 2 - hy0;
|
|
836
|
+
const std::uint16_t *srow = scratch + static_cast<std::size_t>(sy) * hw;
|
|
837
|
+
std::uint16_t *drow = job.pixels + static_cast<std::size_t>(ly) * job.width;
|
|
838
|
+
for (int lx = 0; lx < job.width; ++lx) {
|
|
839
|
+
drow[lx] = srow[(job.originX + lx) / 2 - hx0];
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
present::rasterFrameRows(job.pixels + static_cast<std::size_t>(ry0) * job.width,
|
|
845
|
+
job.originX, job.width, job.originY + ry0, rows,
|
|
846
|
+
gea::rp2350::kPanelHeight, *job.frame);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
850
|
+
void chunkRowsTrampoline(void *ctx, int y0, int y1)
|
|
851
|
+
{
|
|
852
|
+
rasterChunkRows(*static_cast<const ChunkRasterJob *>(ctx), y0, y1);
|
|
853
|
+
}
|
|
854
|
+
#endif
|
|
855
|
+
|
|
856
|
+
void rasterPresentChunk(std::uint16_t *pixels, int width, int height, int originX, int originY, void *user)
|
|
857
|
+
{
|
|
858
|
+
auto *context = static_cast<PresentRasterContext *>(user);
|
|
859
|
+
if (!context || !context->frame) return;
|
|
860
|
+
const ChunkRasterJob job{context->frame, pixels, width, height, originX, originY};
|
|
861
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
862
|
+
// Split the chunk: core 1 rasters the bottom half while this core does the top.
|
|
863
|
+
// The FIFO handshake only pays off for chunks tall enough to halve; `job` lives
|
|
864
|
+
// on this core's stack and stays valid because we block here until core 1 is done.
|
|
865
|
+
if (gRenderWorkerReady && height >= 16) {
|
|
866
|
+
const int mid = height / 2;
|
|
867
|
+
gRenderWorkerTask.fn = chunkRowsTrampoline;
|
|
868
|
+
gRenderWorkerTask.ctx = const_cast<ChunkRasterJob *>(&job);
|
|
869
|
+
gRenderWorkerTask.y0 = mid;
|
|
870
|
+
gRenderWorkerTask.y1 = height - 1;
|
|
871
|
+
__dmb();
|
|
872
|
+
multicore_fifo_push_blocking(kRenderWorkerRun);
|
|
873
|
+
rasterChunkRows(job, 0, mid - 1);
|
|
874
|
+
while (multicore_fifo_pop_blocking() != kRenderWorkerDone) {
|
|
875
|
+
}
|
|
876
|
+
__dmb();
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
#endif
|
|
880
|
+
rasterChunkRows(job, 0, height - 1);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
bool presentDirectToPanel(const gea::platform::display::DisplayPresentCommand *commands, int commandCount)
|
|
884
|
+
{
|
|
885
|
+
#if GEA_RP2350_PANEL_HW_VSCROLL
|
|
886
|
+
// With the panel scroll register engaged, GRAM rows are circularly offset
|
|
887
|
+
// from logical rows; the direct present rasters at logical coordinates, so
|
|
888
|
+
// route those frames through the framebuffer path instead.
|
|
889
|
+
if (gDisplayCanvas.scrollRegionH() > 0 && gScrollOffsetY != 0) return false;
|
|
890
|
+
#endif
|
|
891
|
+
#if GEA_EMBEDDED_TTF_RUNTIME_FONTS
|
|
892
|
+
for (int i = 0; i < commandCount; ++i) {
|
|
893
|
+
if (commands[i].type == gea::platform::display::DisplayPresentCommandType::FillText) {
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
#endif
|
|
898
|
+
present::Frame current;
|
|
899
|
+
if (!present::extractFrame(commands, commandCount, current)) return false;
|
|
900
|
+
|
|
901
|
+
std::array<present::Rect, kMaxCollectedWindows> dirty{};
|
|
902
|
+
int dirtyCount = 0;
|
|
903
|
+
if (gInvalidated || gPresentScale == 2) {
|
|
904
|
+
// scale==2: frame commands are half-res, so a command-space diff can't map to
|
|
905
|
+
// full-res panel windows — always repaint the whole panel (upscaled). For a
|
|
906
|
+
// full-screen 3D flythrough every frame is fully dirty anyway.
|
|
907
|
+
dirty[0] = present::fullScreen(gea::rp2350::kPanelWidth, gea::rp2350::kPanelHeight);
|
|
908
|
+
dirtyCount = 1;
|
|
909
|
+
} else {
|
|
910
|
+
dirtyCount = present::dirtyRects(gPreviousPresentValid ? &gPreviousPresentFrame : nullptr,
|
|
911
|
+
current,
|
|
912
|
+
dirty.data(),
|
|
913
|
+
static_cast<int>(dirty.size()),
|
|
914
|
+
gea::rp2350::kPanelWidth,
|
|
915
|
+
gea::rp2350::kPanelHeight);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
if (dirtyCount > 0) {
|
|
919
|
+
std::array<gea::platform::display::DisplayFlushRect, kMaxCollectedWindows> rects{};
|
|
920
|
+
for (int i = 0; i < dirtyCount; ++i) {
|
|
921
|
+
rects[static_cast<std::size_t>(i)] = {dirty[static_cast<std::size_t>(i)].x0,
|
|
922
|
+
dirty[static_cast<std::size_t>(i)].y0,
|
|
923
|
+
dirty[static_cast<std::size_t>(i)].x1,
|
|
924
|
+
dirty[static_cast<std::size_t>(i)].y1};
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
std::array<FlushWindow, kMaxCollectedWindows> windows{};
|
|
928
|
+
const int mergedCount = collectFlushWindows(rects.data(), dirtyCount, windows);
|
|
929
|
+
PresentRasterContext context{¤t};
|
|
930
|
+
for (int i = 0; i < mergedCount; ++i) {
|
|
931
|
+
const FlushWindow &window = windows[static_cast<std::size_t>(i)];
|
|
932
|
+
gea::rp2350::panelStreamRect(window.x0,
|
|
933
|
+
window.y0,
|
|
934
|
+
window.x1,
|
|
935
|
+
window.y1,
|
|
936
|
+
rasterPresentChunk,
|
|
937
|
+
&context);
|
|
938
|
+
gFlushCalls++;
|
|
939
|
+
gFlushPixels += flushWindowArea(window);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
gPreviousPresentFrame = std::move(current);
|
|
944
|
+
gPreviousPresentValid = true;
|
|
945
|
+
gDisplayCanvas.resetDirty();
|
|
946
|
+
gDisplayCanvas.setGlobalAlpha(gDisplayAlpha);
|
|
947
|
+
gInvalidated = false;
|
|
948
|
+
return true;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
} // namespace
|
|
952
|
+
|
|
953
|
+
extern "C" gea::framework::graphics::pixel::native_t *gea_bg_cache(int *cap_px)
|
|
954
|
+
{
|
|
955
|
+
#if GEA_RP2350_BACKGROUND_CACHE_IN_SRAM
|
|
956
|
+
if (cap_px) *cap_px = gea::rp2350::kPanelWidth * gea::rp2350::kPanelHeight;
|
|
957
|
+
return gSramBackgroundCache;
|
|
958
|
+
#else
|
|
959
|
+
if (cap_px) *cap_px = 0;
|
|
960
|
+
return nullptr;
|
|
961
|
+
#endif
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
extern "C" void *gea_display_command_buffer(int *cap_commands, int command_size, int command_align)
|
|
965
|
+
{
|
|
966
|
+
#if GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS > 0
|
|
967
|
+
if (command_size != static_cast<int>(sizeof(gea::embedded::ui::DisplayCommand)) ||
|
|
968
|
+
command_align > static_cast<int>(alignof(gea::embedded::ui::DisplayCommand))) {
|
|
969
|
+
if (cap_commands) *cap_commands = 0;
|
|
970
|
+
return nullptr;
|
|
971
|
+
}
|
|
972
|
+
if (cap_commands) *cap_commands = GEA_RP2350_DISPLAY_COMMAND_BUFFER_COMMANDS;
|
|
973
|
+
return gSramDisplayCommandBuffer;
|
|
974
|
+
#elif GEA_RP2350_DISPLAY_COMMAND_BUFFER_BYTES > 0
|
|
975
|
+
if (command_size <= 0) {
|
|
976
|
+
if (cap_commands) *cap_commands = 0;
|
|
977
|
+
return nullptr;
|
|
978
|
+
}
|
|
979
|
+
if (command_align <= 0) command_align = 1;
|
|
980
|
+
const std::uintptr_t raw = reinterpret_cast<std::uintptr_t>(gSramDisplayCommandBuffer);
|
|
981
|
+
const std::uintptr_t aligned = (raw + static_cast<std::uintptr_t>(command_align - 1)) &
|
|
982
|
+
~static_cast<std::uintptr_t>(command_align - 1);
|
|
983
|
+
const std::size_t offset = static_cast<std::size_t>(aligned - raw);
|
|
984
|
+
const std::size_t usable = offset < sizeof(gSramDisplayCommandBuffer) ? sizeof(gSramDisplayCommandBuffer) - offset : 0;
|
|
985
|
+
if (cap_commands) *cap_commands = static_cast<int>(usable / static_cast<std::size_t>(command_size));
|
|
986
|
+
return usable >= static_cast<std::size_t>(command_size) ? reinterpret_cast<void *>(aligned) : nullptr;
|
|
987
|
+
#else
|
|
988
|
+
(void)command_size;
|
|
989
|
+
(void)command_align;
|
|
990
|
+
if (cap_commands) *cap_commands = 0;
|
|
991
|
+
return nullptr;
|
|
992
|
+
#endif
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
extern "C" bool gea_render_parallel_submit(void (*fn)(void *, int, int), void *ctx, int y0, int y1)
|
|
996
|
+
{
|
|
997
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
998
|
+
if (!fn || y0 > y1 || !gRenderWorkerReady || gRenderWorkerInFlight || onRenderWorkerCore())
|
|
999
|
+
return false;
|
|
1000
|
+
gRenderWorkerTask = {fn, ctx, y0, y1};
|
|
1001
|
+
__dmb();
|
|
1002
|
+
gRenderWorkerInFlight = true;
|
|
1003
|
+
multicore_fifo_push_blocking(kRenderWorkerRun);
|
|
1004
|
+
return true;
|
|
1005
|
+
#else
|
|
1006
|
+
(void)fn;
|
|
1007
|
+
(void)ctx;
|
|
1008
|
+
(void)y0;
|
|
1009
|
+
(void)y1;
|
|
1010
|
+
return false;
|
|
1011
|
+
#endif
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
extern "C" void gea_render_parallel_wait()
|
|
1015
|
+
{
|
|
1016
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
1017
|
+
if (!gRenderWorkerInFlight)
|
|
1018
|
+
return;
|
|
1019
|
+
#if GEA_RP2350_RENDER_CORE1_WAIT_TIMEOUT_US > 0
|
|
1020
|
+
const std::uint64_t startUs = time_us_64();
|
|
1021
|
+
while (true)
|
|
1022
|
+
{
|
|
1023
|
+
if (multicore_fifo_rvalid() && multicore_fifo_pop_blocking() == kRenderWorkerDone)
|
|
1024
|
+
break;
|
|
1025
|
+
if (time_us_64() - startUs >= GEA_RP2350_RENDER_CORE1_WAIT_TIMEOUT_US)
|
|
1026
|
+
{
|
|
1027
|
+
gRenderWorkerReady = false;
|
|
1028
|
+
gRenderWorkerInFlight = false;
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
tight_loop_contents();
|
|
1032
|
+
}
|
|
1033
|
+
#else
|
|
1034
|
+
while (multicore_fifo_pop_blocking() != kRenderWorkerDone)
|
|
1035
|
+
{
|
|
1036
|
+
}
|
|
1037
|
+
#endif
|
|
1038
|
+
__dmb();
|
|
1039
|
+
gRenderWorkerInFlight = false;
|
|
1040
|
+
#endif
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
extern "C" void gea_render_parallel_merge_dirty()
|
|
1044
|
+
{
|
|
1045
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
1046
|
+
int x0 = 0, y0 = 0, x1 = -1, y1 = -1;
|
|
1047
|
+
if (gRenderWorkerCanvas.dirty(&x0, &y0, &x1, &y1)) {
|
|
1048
|
+
gDisplayCanvas.markDirty(x0, y0, x1, y1);
|
|
1049
|
+
gRenderWorkerCanvas.resetDirty();
|
|
1050
|
+
}
|
|
1051
|
+
#endif
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
extern "C" int gea_current_render_core()
|
|
1055
|
+
{
|
|
1056
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
1057
|
+
return get_core_num();
|
|
1058
|
+
#else
|
|
1059
|
+
return 0;
|
|
1060
|
+
#endif
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
extern "C" int gea_render_parallel_main_share_permille()
|
|
1064
|
+
{
|
|
1065
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
1066
|
+
return 500;
|
|
1067
|
+
#else
|
|
1068
|
+
return 500;
|
|
1069
|
+
#endif
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
extern "C" bool gea_pie_blend_available()
|
|
1073
|
+
{
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
extern "C" bool gea_rgb565_lut_blend_available()
|
|
1078
|
+
{
|
|
1079
|
+
return GEA_RP2350_PIE_BLEND != 0;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
extern "C" bool gea_rgb565_lut_blend_const_alpha_available()
|
|
1083
|
+
{
|
|
1084
|
+
return GEA_RP2350_PIE_BLEND != 0;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
extern "C" void __not_in_flash_func(gea_rgb565_lut_blend_const_alpha_span)(std::uint16_t *dst,
|
|
1088
|
+
const std::uint16_t *colorRgb565,
|
|
1089
|
+
std::int16_t a5,
|
|
1090
|
+
std::int32_t bucketFx,
|
|
1091
|
+
std::int32_t dBucketFx,
|
|
1092
|
+
int count)
|
|
1093
|
+
{
|
|
1094
|
+
#if GEA_RP2350_PIE_BLEND
|
|
1095
|
+
if (count <= 0)
|
|
1096
|
+
return;
|
|
1097
|
+
const std::uint32_t av = static_cast<std::uint32_t>(a5);
|
|
1098
|
+
if (av == 0)
|
|
1099
|
+
return;
|
|
1100
|
+
auto swap16 = [](std::uint16_t v) -> std::uint16_t {
|
|
1101
|
+
#if GEA_EMBEDDED_PIXEL_PANEL_ENDIAN
|
|
1102
|
+
return __builtin_bswap16(v);
|
|
1103
|
+
#else
|
|
1104
|
+
return v;
|
|
1105
|
+
#endif
|
|
1106
|
+
};
|
|
1107
|
+
auto clampBucket = [](std::int32_t fx) -> int {
|
|
1108
|
+
int bucket = fx >> 16;
|
|
1109
|
+
if (bucket < 0)
|
|
1110
|
+
return 0;
|
|
1111
|
+
if (bucket > 250)
|
|
1112
|
+
return 250;
|
|
1113
|
+
return bucket;
|
|
1114
|
+
};
|
|
1115
|
+
auto splitInsideBuckets = [](std::int32_t fx0, std::int32_t step32, int n, int &insideStart, int &insideEnd) {
|
|
1116
|
+
insideStart = 0;
|
|
1117
|
+
insideEnd = 0;
|
|
1118
|
+
if (n <= 0)
|
|
1119
|
+
return;
|
|
1120
|
+
constexpr std::int64_t kBucketHi = 251LL << 16;
|
|
1121
|
+
const std::int64_t start = fx0;
|
|
1122
|
+
const std::int64_t step = step32;
|
|
1123
|
+
const std::int64_t last = start + static_cast<std::int64_t>(n - 1) * step;
|
|
1124
|
+
if (step == 0) {
|
|
1125
|
+
if (start >= 0 && start < kBucketHi)
|
|
1126
|
+
insideEnd = n;
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
auto ceilDivPositive = [](std::int64_t a, std::int64_t b) -> std::int64_t {
|
|
1130
|
+
return (a + b - 1) / b;
|
|
1131
|
+
};
|
|
1132
|
+
std::int64_t first = 0;
|
|
1133
|
+
std::int64_t end = n;
|
|
1134
|
+
if (step > 0) {
|
|
1135
|
+
if (start < 0)
|
|
1136
|
+
first = ceilDivPositive(-start, step);
|
|
1137
|
+
if (first >= n)
|
|
1138
|
+
return;
|
|
1139
|
+
if (start >= kBucketHi)
|
|
1140
|
+
end = 0;
|
|
1141
|
+
else if (last >= kBucketHi)
|
|
1142
|
+
end = (kBucketHi - 1 - start) / step + 1;
|
|
1143
|
+
} else {
|
|
1144
|
+
const std::int64_t down = -step;
|
|
1145
|
+
if (start >= kBucketHi)
|
|
1146
|
+
first = ceilDivPositive(start - (kBucketHi - 1), down);
|
|
1147
|
+
if (first >= n)
|
|
1148
|
+
return;
|
|
1149
|
+
if (start < 0)
|
|
1150
|
+
end = 0;
|
|
1151
|
+
else if (last < 0)
|
|
1152
|
+
end = start / down + 1;
|
|
1153
|
+
}
|
|
1154
|
+
if (end > n)
|
|
1155
|
+
end = n;
|
|
1156
|
+
if (end <= first)
|
|
1157
|
+
return;
|
|
1158
|
+
insideStart = static_cast<int>(first);
|
|
1159
|
+
insideEnd = static_cast<int>(end);
|
|
1160
|
+
};
|
|
1161
|
+
auto advanceFx = [](std::int32_t fx, std::int32_t step, int n) -> std::int32_t {
|
|
1162
|
+
return static_cast<std::int32_t>(static_cast<std::int64_t>(fx) + static_cast<std::int64_t>(step) * n);
|
|
1163
|
+
};
|
|
1164
|
+
auto halfBlendRgb565 = [](std::uint16_t fg, std::uint16_t bg) -> std::uint16_t {
|
|
1165
|
+
const std::uint32_t x = static_cast<std::uint32_t>(fg ^ bg);
|
|
1166
|
+
return static_cast<std::uint16_t>((fg & bg) + ((x & 0xF7DEu) >> 1) + (x & 0x0821u));
|
|
1167
|
+
};
|
|
1168
|
+
auto halfBlendRgb565Pair = [](std::uint32_t fg, std::uint32_t bg) -> std::uint32_t {
|
|
1169
|
+
const std::uint32_t x = fg ^ bg;
|
|
1170
|
+
return ((fg & bg) + ((x & 0xF7DEF7DEu) >> 1) + (x & 0x08210821u));
|
|
1171
|
+
};
|
|
1172
|
+
auto swap16Pair = [](std::uint32_t v) -> std::uint32_t {
|
|
1173
|
+
#if GEA_EMBEDDED_PIXEL_PANEL_ENDIAN
|
|
1174
|
+
return ((v & 0x00FF00FFu) << 8) | ((v & 0xFF00FF00u) >> 8);
|
|
1175
|
+
#else
|
|
1176
|
+
return v;
|
|
1177
|
+
#endif
|
|
1178
|
+
};
|
|
1179
|
+
auto loadPairNormal = [&](const std::uint16_t *p) -> std::uint32_t {
|
|
1180
|
+
std::uint32_t stored = 0;
|
|
1181
|
+
std::memcpy(&stored, p, sizeof(stored));
|
|
1182
|
+
return swap16Pair(stored);
|
|
1183
|
+
};
|
|
1184
|
+
auto storePairNormal = [&](std::uint16_t *p, std::uint32_t normal) {
|
|
1185
|
+
const std::uint32_t stored = swap16Pair(normal);
|
|
1186
|
+
std::memcpy(p, &stored, sizeof(stored));
|
|
1187
|
+
};
|
|
1188
|
+
auto halfBlend = [&](std::uint16_t fc, std::uint16_t storedDst) -> std::uint16_t {
|
|
1189
|
+
return swap16(halfBlendRgb565(fc, swap16(storedDst)));
|
|
1190
|
+
};
|
|
1191
|
+
auto paintHalfConst = [&](int bucket, int n) {
|
|
1192
|
+
const std::uint16_t fc = colorRgb565[bucket];
|
|
1193
|
+
if ((reinterpret_cast<std::uintptr_t>(dst) & 2u) && n > 0) {
|
|
1194
|
+
*dst = halfBlend(fc, *dst);
|
|
1195
|
+
dst++;
|
|
1196
|
+
n--;
|
|
1197
|
+
}
|
|
1198
|
+
const std::uint32_t fgPair = static_cast<std::uint32_t>(fc) |
|
|
1199
|
+
(static_cast<std::uint32_t>(fc) << 16);
|
|
1200
|
+
while (n >= 4) {
|
|
1201
|
+
storePairNormal(dst, halfBlendRgb565Pair(fgPair, loadPairNormal(dst)));
|
|
1202
|
+
storePairNormal(dst + 2, halfBlendRgb565Pair(fgPair, loadPairNormal(dst + 2)));
|
|
1203
|
+
dst += 4;
|
|
1204
|
+
n -= 4;
|
|
1205
|
+
}
|
|
1206
|
+
while (n >= 2) {
|
|
1207
|
+
storePairNormal(dst, halfBlendRgb565Pair(fgPair, loadPairNormal(dst)));
|
|
1208
|
+
dst += 2;
|
|
1209
|
+
n -= 2;
|
|
1210
|
+
}
|
|
1211
|
+
if (n > 0) {
|
|
1212
|
+
*dst = halfBlend(fc, *dst);
|
|
1213
|
+
dst++;
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
auto paintHalfUnclamped = [&](std::int32_t &fx, int n) {
|
|
1217
|
+
if ((reinterpret_cast<std::uintptr_t>(dst) & 2u) && n > 0) {
|
|
1218
|
+
const std::uint16_t fc = colorRgb565[fx >> 16];
|
|
1219
|
+
*dst = halfBlend(fc, *dst);
|
|
1220
|
+
dst++;
|
|
1221
|
+
fx += dBucketFx;
|
|
1222
|
+
n--;
|
|
1223
|
+
}
|
|
1224
|
+
while (n >= 4) {
|
|
1225
|
+
const std::uint16_t fc0 = colorRgb565[fx >> 16];
|
|
1226
|
+
const std::int32_t fx1 = fx + dBucketFx;
|
|
1227
|
+
const std::uint16_t fc1 = colorRgb565[fx1 >> 16];
|
|
1228
|
+
const std::int32_t fx2 = fx1 + dBucketFx;
|
|
1229
|
+
const std::uint16_t fc2 = colorRgb565[fx2 >> 16];
|
|
1230
|
+
const std::int32_t fx3 = fx2 + dBucketFx;
|
|
1231
|
+
const std::uint16_t fc3 = colorRgb565[fx3 >> 16];
|
|
1232
|
+
const std::uint32_t fgPair0 = static_cast<std::uint32_t>(fc0) |
|
|
1233
|
+
(static_cast<std::uint32_t>(fc1) << 16);
|
|
1234
|
+
const std::uint32_t fgPair1 = static_cast<std::uint32_t>(fc2) |
|
|
1235
|
+
(static_cast<std::uint32_t>(fc3) << 16);
|
|
1236
|
+
storePairNormal(dst, halfBlendRgb565Pair(fgPair0, loadPairNormal(dst)));
|
|
1237
|
+
storePairNormal(dst + 2, halfBlendRgb565Pair(fgPair1, loadPairNormal(dst + 2)));
|
|
1238
|
+
dst += 4;
|
|
1239
|
+
fx = fx3 + dBucketFx;
|
|
1240
|
+
n -= 4;
|
|
1241
|
+
}
|
|
1242
|
+
while (n >= 2) {
|
|
1243
|
+
const std::uint16_t fc0 = colorRgb565[fx >> 16];
|
|
1244
|
+
const std::int32_t fx1 = fx + dBucketFx;
|
|
1245
|
+
const std::uint16_t fc1 = colorRgb565[fx1 >> 16];
|
|
1246
|
+
const std::uint32_t fgPair = static_cast<std::uint32_t>(fc0) |
|
|
1247
|
+
(static_cast<std::uint32_t>(fc1) << 16);
|
|
1248
|
+
storePairNormal(dst, halfBlendRgb565Pair(fgPair, loadPairNormal(dst)));
|
|
1249
|
+
dst += 2;
|
|
1250
|
+
fx = fx1 + dBucketFx;
|
|
1251
|
+
n -= 2;
|
|
1252
|
+
}
|
|
1253
|
+
if (n > 0) {
|
|
1254
|
+
const std::uint16_t fc = colorRgb565[fx >> 16];
|
|
1255
|
+
*dst = halfBlend(fc, *dst);
|
|
1256
|
+
dst++;
|
|
1257
|
+
fx += dBucketFx;
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
if (av == 16) {
|
|
1261
|
+
int insideStart = 0;
|
|
1262
|
+
int insideEnd = 0;
|
|
1263
|
+
splitInsideBuckets(bucketFx, dBucketFx, count, insideStart, insideEnd);
|
|
1264
|
+
if (insideEnd > insideStart) {
|
|
1265
|
+
if (insideStart > 0) {
|
|
1266
|
+
paintHalfConst(clampBucket(bucketFx), insideStart);
|
|
1267
|
+
bucketFx = advanceFx(bucketFx, dBucketFx, insideStart);
|
|
1268
|
+
}
|
|
1269
|
+
if (dBucketFx == 0)
|
|
1270
|
+
paintHalfConst(bucketFx >> 16, insideEnd - insideStart);
|
|
1271
|
+
else
|
|
1272
|
+
paintHalfUnclamped(bucketFx, insideEnd - insideStart);
|
|
1273
|
+
if (insideEnd < count)
|
|
1274
|
+
paintHalfConst(clampBucket(bucketFx), count - insideEnd);
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
paintHalfConst(clampBucket(bucketFx), count);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
const std::uint32_t inv = 32u - av;
|
|
1282
|
+
while (count-- > 0) {
|
|
1283
|
+
int bucket = bucketFx >> 16;
|
|
1284
|
+
if (bucket < 0)
|
|
1285
|
+
bucket = 0;
|
|
1286
|
+
else if (bucket > 250)
|
|
1287
|
+
bucket = 250;
|
|
1288
|
+
const std::uint16_t fc = colorRgb565[bucket];
|
|
1289
|
+
const std::uint16_t dc = swap16(*dst);
|
|
1290
|
+
const std::uint32_t f = (static_cast<std::uint32_t>(fc) | (static_cast<std::uint32_t>(fc) << 16)) & 0x07E0F81Fu;
|
|
1291
|
+
const std::uint32_t b = (static_cast<std::uint32_t>(dc) | (static_cast<std::uint32_t>(dc) << 16)) & 0x07E0F81Fu;
|
|
1292
|
+
const std::uint32_t o = ((f * av + b * inv + 0x02008010u) >> 5) & 0x07E0F81Fu;
|
|
1293
|
+
const std::uint16_t rn = static_cast<std::uint16_t>(o | (o >> 16));
|
|
1294
|
+
*dst++ = swap16(rn);
|
|
1295
|
+
bucketFx += dBucketFx;
|
|
1296
|
+
}
|
|
1297
|
+
#else
|
|
1298
|
+
(void)dst;
|
|
1299
|
+
(void)colorRgb565;
|
|
1300
|
+
(void)a5;
|
|
1301
|
+
(void)bucketFx;
|
|
1302
|
+
(void)dBucketFx;
|
|
1303
|
+
(void)count;
|
|
1304
|
+
#endif
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
extern "C" void __not_in_flash_func(gea_rgb565_lut_blend_span)(std::uint16_t *dst,
|
|
1308
|
+
const std::uint16_t *colorRgb565,
|
|
1309
|
+
const std::uint8_t *a5,
|
|
1310
|
+
std::int32_t bucketFx,
|
|
1311
|
+
std::int32_t dBucketFx,
|
|
1312
|
+
int count)
|
|
1313
|
+
{
|
|
1314
|
+
#if GEA_RP2350_PIE_BLEND
|
|
1315
|
+
auto swap16 = [](std::uint16_t v) -> std::uint16_t {
|
|
1316
|
+
#if GEA_EMBEDDED_PIXEL_PANEL_ENDIAN
|
|
1317
|
+
return __builtin_bswap16(v);
|
|
1318
|
+
#else
|
|
1319
|
+
return v;
|
|
1320
|
+
#endif
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
while (count-- > 0) {
|
|
1324
|
+
int bucket = bucketFx >> 16;
|
|
1325
|
+
if (bucket < 0)
|
|
1326
|
+
bucket = 0;
|
|
1327
|
+
else if (bucket > 250)
|
|
1328
|
+
bucket = 250;
|
|
1329
|
+
const std::uint32_t av = static_cast<std::uint32_t>(a5[bucket]);
|
|
1330
|
+
if (av == 0) {
|
|
1331
|
+
dst++;
|
|
1332
|
+
bucketFx += dBucketFx;
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
const std::uint16_t fc = colorRgb565[bucket];
|
|
1336
|
+
const std::uint16_t dc = swap16(*dst);
|
|
1337
|
+
const std::uint32_t f = (static_cast<std::uint32_t>(fc) | (static_cast<std::uint32_t>(fc) << 16)) & 0x07E0F81Fu;
|
|
1338
|
+
const std::uint32_t b = (static_cast<std::uint32_t>(dc) | (static_cast<std::uint32_t>(dc) << 16)) & 0x07E0F81Fu;
|
|
1339
|
+
const std::uint32_t o = ((f * av + b * (32u - av) + 0x02008010u) >> 5) & 0x07E0F81Fu;
|
|
1340
|
+
const std::uint16_t rn = static_cast<std::uint16_t>(o | (o >> 16));
|
|
1341
|
+
*dst++ = swap16(rn);
|
|
1342
|
+
bucketFx += dBucketFx;
|
|
1343
|
+
}
|
|
1344
|
+
#else
|
|
1345
|
+
(void)dst;
|
|
1346
|
+
(void)colorRgb565;
|
|
1347
|
+
(void)a5;
|
|
1348
|
+
(void)bucketFx;
|
|
1349
|
+
(void)dBucketFx;
|
|
1350
|
+
(void)count;
|
|
1351
|
+
#endif
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
void *operator new(std::size_t size)
|
|
1355
|
+
{
|
|
1356
|
+
return allocBlock(size, alignof(std::max_align_t));
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
void *operator new[](std::size_t size)
|
|
1360
|
+
{
|
|
1361
|
+
return allocBlock(size, alignof(std::max_align_t));
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
void *operator new(std::size_t size, std::align_val_t alignment)
|
|
1365
|
+
{
|
|
1366
|
+
return allocBlock(size, static_cast<std::size_t>(alignment));
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
void *operator new[](std::size_t size, std::align_val_t alignment)
|
|
1370
|
+
{
|
|
1371
|
+
return allocBlock(size, static_cast<std::size_t>(alignment));
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
void *operator new(std::size_t size, const std::nothrow_t &) noexcept
|
|
1375
|
+
{
|
|
1376
|
+
return allocBlock(size, alignof(std::max_align_t));
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
void *operator new[](std::size_t size, const std::nothrow_t &) noexcept
|
|
1380
|
+
{
|
|
1381
|
+
return allocBlock(size, alignof(std::max_align_t));
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
void operator delete(void *ptr) noexcept
|
|
1385
|
+
{
|
|
1386
|
+
freeBlock(ptr);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
void operator delete[](void *ptr) noexcept
|
|
1390
|
+
{
|
|
1391
|
+
freeBlock(ptr);
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
void operator delete(void *ptr, std::size_t) noexcept
|
|
1395
|
+
{
|
|
1396
|
+
freeBlock(ptr);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
void operator delete[](void *ptr, std::size_t) noexcept
|
|
1400
|
+
{
|
|
1401
|
+
freeBlock(ptr);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
void operator delete(void *ptr, std::align_val_t) noexcept
|
|
1405
|
+
{
|
|
1406
|
+
freeBlock(ptr);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
void operator delete[](void *ptr, std::align_val_t) noexcept
|
|
1410
|
+
{
|
|
1411
|
+
freeBlock(ptr);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
void operator delete(void *ptr, std::size_t, std::align_val_t) noexcept
|
|
1415
|
+
{
|
|
1416
|
+
freeBlock(ptr);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
void operator delete[](void *ptr, std::size_t, std::align_val_t) noexcept
|
|
1420
|
+
{
|
|
1421
|
+
freeBlock(ptr);
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
namespace gea::rp2350 {
|
|
1425
|
+
|
|
1426
|
+
void memoryInit()
|
|
1427
|
+
{
|
|
1428
|
+
const size_t maxFree = rp_mem_max_free_size();
|
|
1429
|
+
gUseRpAllocator = maxFree > 0;
|
|
1430
|
+
std::printf("rp2350 psram allocator: max_free=%u enabled=%d\n", static_cast<unsigned>(maxFree), gUseRpAllocator ? 1 : 0);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
void boardIoInit()
|
|
1434
|
+
{
|
|
1435
|
+
if (board::power.powerHold >= 0) {
|
|
1436
|
+
gpio_init(board::power.powerHold);
|
|
1437
|
+
gpio_set_dir(board::power.powerHold, GPIO_OUT);
|
|
1438
|
+
gpio_put(board::power.powerHold, 1);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
if (board::power.powerKey >= 0) {
|
|
1442
|
+
gpio_init(board::power.powerKey);
|
|
1443
|
+
gpio_pull_up(board::power.powerKey);
|
|
1444
|
+
gpio_set_dir(board::power.powerKey, GPIO_IN);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
adc_init();
|
|
1448
|
+
if (board::power.batteryAdc >= 0) {
|
|
1449
|
+
adc_gpio_init(board::power.batteryAdc);
|
|
1450
|
+
adc_select_input(board::power.batteryAdcChannel);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
i2c_init(boardI2c(), board::i2c.frequencyHz);
|
|
1454
|
+
gpio_set_function(board::i2c.sda, GPIO_FUNC_I2C);
|
|
1455
|
+
gpio_set_function(board::i2c.scl, GPIO_FUNC_I2C);
|
|
1456
|
+
gpio_pull_up(board::i2c.sda);
|
|
1457
|
+
gpio_pull_up(board::i2c.scl);
|
|
1458
|
+
|
|
1459
|
+
#if GEA_RP2350_HAS_BUTTONS
|
|
1460
|
+
for (std::size_t i = 0; i < board::buttons.size(); ++i) {
|
|
1461
|
+
const auto &button = board::buttons[i];
|
|
1462
|
+
gpio_init(button.pin);
|
|
1463
|
+
gpio_set_dir(button.pin, GPIO_IN);
|
|
1464
|
+
if (button.pullUp) gpio_pull_up(button.pin);
|
|
1465
|
+
gButtonDown[i] = button.activeLow ? gpio_get(button.pin) == 0 : gpio_get(button.pin) != 0;
|
|
1466
|
+
}
|
|
1467
|
+
#endif
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
void pollTouch()
|
|
1471
|
+
{
|
|
1472
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
1473
|
+
if (!gTouchInitialized || !gTouchObserver) return;
|
|
1474
|
+
if (gSyntheticDrag.active) {
|
|
1475
|
+
pollSyntheticDrag();
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
gea::chips::ft6336::MultiTouchSample sample{};
|
|
1479
|
+
const bool ok = gTouchCore.readMulti(gTouchBus, sample);
|
|
1480
|
+
if (ok && sample.count > 0) {
|
|
1481
|
+
const int x = std::clamp(sample.x[0], 0, kPanelWidth - 1);
|
|
1482
|
+
const int y = std::clamp(sample.y[0], 0, kPanelHeight - 1);
|
|
1483
|
+
const auto phase = gTouching ? gea::platform::touch::Phase::Move : gea::platform::touch::Phase::Down;
|
|
1484
|
+
if (!gTouching || x != gTouchX || y != gTouchY) {
|
|
1485
|
+
gTouchObserver(phase, true, x, y);
|
|
1486
|
+
}
|
|
1487
|
+
gTouching = true;
|
|
1488
|
+
gTouchX = x;
|
|
1489
|
+
gTouchY = y;
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
if (gTouching) {
|
|
1493
|
+
gTouchObserver(gea::platform::touch::Phase::Up, false, gTouchX, gTouchY);
|
|
1494
|
+
gTouching = false;
|
|
1495
|
+
}
|
|
1496
|
+
#endif
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
int scanoutRowToPhysical(int row)
|
|
1500
|
+
{
|
|
1501
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
1502
|
+
if (gDisplayCanvas.scrollRegionH() > 0) return gDisplayCanvas.rowToPhysical(row);
|
|
1503
|
+
#endif
|
|
1504
|
+
return row;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
bool startSyntheticDrag(int x1, int y1, int x2, int y2, int steps, int delayMs)
|
|
1508
|
+
{
|
|
1509
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
1510
|
+
if (!gTouchInitialized || !gTouchObserver) return false;
|
|
1511
|
+
if (gSyntheticDrag.active) return false;
|
|
1512
|
+
gSyntheticDrag.x1 = std::clamp(x1, 0, kPanelWidth - 1);
|
|
1513
|
+
gSyntheticDrag.y1 = std::clamp(y1, 0, kPanelHeight - 1);
|
|
1514
|
+
gSyntheticDrag.x2 = std::clamp(x2, 0, kPanelWidth - 1);
|
|
1515
|
+
gSyntheticDrag.y2 = std::clamp(y2, 0, kPanelHeight - 1);
|
|
1516
|
+
gSyntheticDrag.steps = std::clamp(steps, 1, 256);
|
|
1517
|
+
gSyntheticDrag.delayUs = static_cast<std::uint64_t>(std::clamp(delayMs, 1, 250)) * 1000u;
|
|
1518
|
+
gSyntheticDrag.lastStep = -1;
|
|
1519
|
+
gSyntheticDrag.startUs = time_us_64();
|
|
1520
|
+
gSyntheticDrag.active = true;
|
|
1521
|
+
return true;
|
|
1522
|
+
#else
|
|
1523
|
+
(void)x1; (void)y1; (void)x2; (void)y2; (void)steps; (void)delayMs;
|
|
1524
|
+
return false;
|
|
1525
|
+
#endif
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
void pollButtons()
|
|
1529
|
+
{
|
|
1530
|
+
#if GEA_RP2350_HAS_BUTTONS
|
|
1531
|
+
// Press edge always queues one keydown. Buttons flagged `repeat` also
|
|
1532
|
+
// auto-repeat while held — an initial delay, then a steady interval —
|
|
1533
|
+
// matching a keyboard's typematic repeat, so holding Up/Down keeps the
|
|
1534
|
+
// view scrolling instead of nudging once per press.
|
|
1535
|
+
constexpr std::uint64_t kButtonRepeatInitialDelayUs = 300000; // 300 ms hold before repeat
|
|
1536
|
+
constexpr std::uint64_t kButtonRepeatIntervalUs = 55000; // ~18 repeats/sec
|
|
1537
|
+
const std::uint64_t nowUs = time_us_64();
|
|
1538
|
+
for (std::size_t i = 0; i < board::buttons.size(); ++i) {
|
|
1539
|
+
const auto &button = board::buttons[i];
|
|
1540
|
+
const bool down = button.activeLow ? gpio_get(button.pin) == 0 : gpio_get(button.pin) != 0;
|
|
1541
|
+
if (down && !gButtonDown[i]) {
|
|
1542
|
+
gea::framework::input::queueKeyDown(button.keyCode);
|
|
1543
|
+
gButtonNextRepeatUs[i] = nowUs + kButtonRepeatInitialDelayUs;
|
|
1544
|
+
} else if (down && button.repeat && nowUs >= gButtonNextRepeatUs[i]) {
|
|
1545
|
+
gea::framework::input::queueKeyDown(button.keyCode);
|
|
1546
|
+
gButtonNextRepeatUs[i] = nowUs + kButtonRepeatIntervalUs;
|
|
1547
|
+
}
|
|
1548
|
+
gButtonDown[i] = down;
|
|
1549
|
+
}
|
|
1550
|
+
#endif
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
void dispatchQueuedEvents()
|
|
1554
|
+
{
|
|
1555
|
+
gea::framework::events::Event event{};
|
|
1556
|
+
while (gea::framework::services::FrameScheduler::receiveEvent(&event)) {
|
|
1557
|
+
if (event.type == gea::framework::events::EventType::Touch) {
|
|
1558
|
+
gea::framework::events::TouchRuntime::dispatchEvent(event);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
#if GEA_RP2350_HAS_BUTTONS
|
|
1562
|
+
dispatchKeyInput();
|
|
1563
|
+
#endif
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
} // namespace gea::rp2350
|
|
1567
|
+
|
|
1568
|
+
namespace gea::framework::memory {
|
|
1569
|
+
|
|
1570
|
+
void *Allocator::allocatePreferSpiram(std::size_t size, std::size_t alignment)
|
|
1571
|
+
{
|
|
1572
|
+
return allocBlock(size, alignment);
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
void *Allocator::reallocatePreferSpiram(void *ptr, std::size_t size)
|
|
1576
|
+
{
|
|
1577
|
+
return reallocBlock(ptr, size);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
void Allocator::free(void *ptr) noexcept
|
|
1581
|
+
{
|
|
1582
|
+
freeBlock(ptr);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
double MemoryBackend::internalFree() { return 0.0; }
|
|
1586
|
+
double MemoryBackend::internalLargestFreeBlock() { return 0.0; }
|
|
1587
|
+
double MemoryBackend::internalMinimumFree() { return 0.0; }
|
|
1588
|
+
double MemoryBackend::psramFree() { return static_cast<double>(rp_mem_max_free_size()); }
|
|
1589
|
+
double MemoryBackend::currentTaskStackHighWaterMark() { return 0.0; }
|
|
1590
|
+
double MemoryBackend::geaMainStackBytes() { return 0.0; }
|
|
1591
|
+
double MemoryBackend::geaInitStackBytes() { return 0.0; }
|
|
1592
|
+
double MemoryBackend::appFrameStackWords() { return 0.0; }
|
|
1593
|
+
double MemoryBackend::appFrameStackBytes() { return 0.0; }
|
|
1594
|
+
double MemoryBackend::displayFlushConfiguredRows() { return static_cast<double>(gFlushRows); }
|
|
1595
|
+
double MemoryBackend::displayFlushConfiguredDepth() { return static_cast<double>(gFlushDepth); }
|
|
1596
|
+
double MemoryBackend::displayFlushBufferMaxBytes() { return static_cast<double>(gea::rp2350::kPanelWidth * gFlushRows * 2 * gFlushDepth); }
|
|
1597
|
+
double MemoryBackend::displayFlushRows() { return static_cast<double>(gFlushRows); }
|
|
1598
|
+
double MemoryBackend::displayFlushDepth() { return static_cast<double>(gFlushDepth); }
|
|
1599
|
+
double MemoryBackend::displayFlushBufferBytes() { return static_cast<double>(gea::rp2350::kPanelWidth * gFlushRows * 2 * gFlushDepth); }
|
|
1600
|
+
double MemoryBackend::allocationSramCount() { return static_cast<double>(gSramAllocStats.allocCount); }
|
|
1601
|
+
double MemoryBackend::allocationPsramCount() { return static_cast<double>(gPsramAllocStats.allocCount); }
|
|
1602
|
+
double MemoryBackend::allocationSramBytes() { return static_cast<double>(gSramAllocStats.liveBytes); }
|
|
1603
|
+
double MemoryBackend::allocationPsramBytes() { return static_cast<double>(gPsramAllocStats.liveBytes); }
|
|
1604
|
+
double MemoryBackend::allocationSramPeakBytes() { return static_cast<double>(gSramAllocStats.peakBytes); }
|
|
1605
|
+
double MemoryBackend::allocationPsramPeakBytes() { return static_cast<double>(gPsramAllocStats.peakBytes); }
|
|
1606
|
+
|
|
1607
|
+
} // namespace gea::framework::memory
|
|
1608
|
+
|
|
1609
|
+
namespace gea::host {
|
|
1610
|
+
|
|
1611
|
+
double setTimeout(TimerCallback callback, double delayMs)
|
|
1612
|
+
{
|
|
1613
|
+
if (!callback) return 0;
|
|
1614
|
+
for (auto &timer : gTimers) {
|
|
1615
|
+
if (timer.active) continue;
|
|
1616
|
+
timer.id = gNextTimerId++;
|
|
1617
|
+
timer.callback = std::move(callback);
|
|
1618
|
+
timer.delayMs = std::max(0.0, delayMs);
|
|
1619
|
+
timer.nextFireMs = gLastTimestampMs + timer.delayMs;
|
|
1620
|
+
timer.interval = false;
|
|
1621
|
+
timer.active = true;
|
|
1622
|
+
return timer.id;
|
|
1623
|
+
}
|
|
1624
|
+
return 0;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
double setInterval(TimerCallback callback, double delayMs)
|
|
1628
|
+
{
|
|
1629
|
+
if (!callback) return 0;
|
|
1630
|
+
for (auto &timer : gTimers) {
|
|
1631
|
+
if (timer.active) continue;
|
|
1632
|
+
timer.id = gNextTimerId++;
|
|
1633
|
+
timer.callback = std::move(callback);
|
|
1634
|
+
timer.delayMs = std::max(1.0, delayMs);
|
|
1635
|
+
timer.nextFireMs = gLastTimestampMs + timer.delayMs;
|
|
1636
|
+
timer.interval = true;
|
|
1637
|
+
timer.active = true;
|
|
1638
|
+
return timer.id;
|
|
1639
|
+
}
|
|
1640
|
+
return 0;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
void clearTimeout(double id)
|
|
1644
|
+
{
|
|
1645
|
+
for (auto &timer : gTimers) {
|
|
1646
|
+
if (timer.id == id) timer.active = false;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
void clearInterval(double id)
|
|
1651
|
+
{
|
|
1652
|
+
clearTimeout(id);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
void resetScheduledTimers()
|
|
1656
|
+
{
|
|
1657
|
+
for (auto &timer : gTimers) timer.active = false;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
double requestAnimationFrame(AnimationFrameCallback callback)
|
|
1661
|
+
{
|
|
1662
|
+
if (!callback || gPendingRafCount >= static_cast<int>(gPendingRaf.size())) return 0;
|
|
1663
|
+
const double id = gNextTimerId++;
|
|
1664
|
+
gPendingRaf[static_cast<std::size_t>(gPendingRafCount++)] = std::move(callback);
|
|
1665
|
+
return id;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
void runAnimationFrameCallbacks(double timestampMs)
|
|
1669
|
+
{
|
|
1670
|
+
gLastTimestampMs = timestampMs;
|
|
1671
|
+
for (auto &timer : gTimers) {
|
|
1672
|
+
if (!timer.active || timer.nextFireMs > timestampMs || !timer.callback) continue;
|
|
1673
|
+
timer.callback();
|
|
1674
|
+
if (timer.interval) timer.nextFireMs = timestampMs + timer.delayMs;
|
|
1675
|
+
else timer.active = false;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
const int count = gPendingRafCount;
|
|
1679
|
+
for (int i = 0; i < count; ++i) {
|
|
1680
|
+
gActiveRaf[static_cast<std::size_t>(i)] = std::move(gPendingRaf[static_cast<std::size_t>(i)]);
|
|
1681
|
+
gPendingRaf[static_cast<std::size_t>(i)] = nullptr;
|
|
1682
|
+
}
|
|
1683
|
+
gPendingRafCount = 0;
|
|
1684
|
+
for (int i = 0; i < count; ++i) {
|
|
1685
|
+
auto &callback = gActiveRaf[static_cast<std::size_t>(i)];
|
|
1686
|
+
if (callback) callback(timestampMs);
|
|
1687
|
+
callback = nullptr;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
void resetAnimationFrameCallbacks()
|
|
1692
|
+
{
|
|
1693
|
+
for (auto &callback : gPendingRaf) callback = nullptr;
|
|
1694
|
+
for (auto &callback : gActiveRaf) callback = nullptr;
|
|
1695
|
+
gPendingRafCount = 0;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
void animationFramePerfStatsReset() {}
|
|
1699
|
+
AnimationFramePerfStats animationFramePerfStatsRead() { return {}; }
|
|
1700
|
+
|
|
1701
|
+
AudioDestinationProperty::operator AudioDestinationNode() const { return AudioDestinationNode(); }
|
|
1702
|
+
AudioDestinationProperty::operator double() const { return 0.0; }
|
|
1703
|
+
AudioContextCurrentTimeProperty::operator double() const { return 0.0; }
|
|
1704
|
+
const AudioParamValueProperty &AudioParamValueProperty::operator=(double) const { return *this; }
|
|
1705
|
+
AudioParamValueProperty::operator double() const { return 0.0; }
|
|
1706
|
+
const AudioParam &AudioParam::operator=(double) const { return *this; }
|
|
1707
|
+
void AudioParam::setValueAtTime(double, double) const {}
|
|
1708
|
+
const OscillatorTypeProperty &OscillatorTypeProperty::operator=(double) const { return *this; }
|
|
1709
|
+
const OscillatorTypeProperty &OscillatorTypeProperty::operator=(const char *) const { return *this; }
|
|
1710
|
+
const OscillatorTypeProperty &OscillatorTypeProperty::operator=(const std::string &) const { return *this; }
|
|
1711
|
+
void OscillatorNode::connect(AudioDestinationNode) const {}
|
|
1712
|
+
void OscillatorNode::connect(AudioDestinationProperty) const {}
|
|
1713
|
+
void OscillatorNode::connect(double) const {}
|
|
1714
|
+
void OscillatorNode::start(double) const {}
|
|
1715
|
+
void OscillatorNode::stop(double) const {}
|
|
1716
|
+
AudioDestinationNode AudioBufferSourceNode::connect(AudioDestinationNode destination) const
|
|
1717
|
+
{
|
|
1718
|
+
connected = true;
|
|
1719
|
+
return destination;
|
|
1720
|
+
}
|
|
1721
|
+
AudioDestinationNode AudioBufferSourceNode::connect(AudioDestinationProperty destination) const
|
|
1722
|
+
{
|
|
1723
|
+
return connect(static_cast<AudioDestinationNode>(destination));
|
|
1724
|
+
}
|
|
1725
|
+
AudioDestinationNode AudioBufferSourceNode::connect(double destinationHandle) const
|
|
1726
|
+
{
|
|
1727
|
+
return connect(AudioDestinationNode(destinationHandle));
|
|
1728
|
+
}
|
|
1729
|
+
void AudioBufferSourceNode::start(double) const {}
|
|
1730
|
+
void AudioBufferSourceNode::stop(double) const {}
|
|
1731
|
+
OscillatorNode AudioContext::createOscillator() const { return OscillatorNode(); }
|
|
1732
|
+
AudioBufferSourceNode AudioContext::createBufferSource() const { return AudioBufferSourceNode(); }
|
|
1733
|
+
AudioBuffer AudioContext::decodeAudioData(const std::vector<std::uint8_t> &) const { return AudioBuffer(); }
|
|
1734
|
+
|
|
1735
|
+
HTMLAudioElement::HTMLAudioElement(const char *src) : src_(src ? src : "") {}
|
|
1736
|
+
HTMLAudioElement::HTMLAudioElement(const std::string &src) : src_(src) {}
|
|
1737
|
+
HTMLAudioElement::HTMLAudioElement(const gea::embedded::ui::NodeHandle &node) : nodeId_(node.id()) {}
|
|
1738
|
+
std::string HTMLAudioElement::src() const { return src_; }
|
|
1739
|
+
void HTMLAudioElement::setSrc(const std::string &src) { src_ = src; }
|
|
1740
|
+
bool HTMLAudioElement::play() const { return false; }
|
|
1741
|
+
void HTMLAudioElement::pause() const {}
|
|
1742
|
+
|
|
1743
|
+
} // namespace gea::host
|
|
1744
|
+
|
|
1745
|
+
// gea_host_image_load_asset_path now comes from core/packages/host/host/image.cpp
|
|
1746
|
+
// (real embedded-asset lookup + ImageStore decode), compiled into this target.
|
|
1747
|
+
|
|
1748
|
+
namespace gea::framework::services {
|
|
1749
|
+
|
|
1750
|
+
EventQueue FrameScheduler::createEventQueue()
|
|
1751
|
+
{
|
|
1752
|
+
gEventQueueStarted = true;
|
|
1753
|
+
return EventQueue(&gEvents);
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
EventQueue FrameScheduler::eventQueue()
|
|
1757
|
+
{
|
|
1758
|
+
return gEventQueueStarted ? EventQueue(&gEvents) : EventQueue();
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
bool FrameScheduler::sendEvent(const gea::framework::events::Event &event, int)
|
|
1762
|
+
{
|
|
1763
|
+
const int next = (gEventTail + 1) % static_cast<int>(gEvents.size());
|
|
1764
|
+
if (next == gEventHead) return false;
|
|
1765
|
+
gEvents[static_cast<std::size_t>(gEventTail)] = event;
|
|
1766
|
+
gEventTail = next;
|
|
1767
|
+
return true;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
bool FrameScheduler::receiveEvent(gea::framework::events::Event *event)
|
|
1771
|
+
{
|
|
1772
|
+
if (gEventHead == gEventTail) return false;
|
|
1773
|
+
if (event) *event = gEvents[static_cast<std::size_t>(gEventHead)];
|
|
1774
|
+
gEventHead = (gEventHead + 1) % static_cast<int>(gEvents.size());
|
|
1775
|
+
return true;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
void FrameScheduler::start(EventQueue queue)
|
|
1779
|
+
{
|
|
1780
|
+
gEventQueueStarted = static_cast<bool>(queue);
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
void FrameScheduler::runFrame(const FrameCallbacks &callbacks)
|
|
1784
|
+
{
|
|
1785
|
+
if (callbacks.frame) callbacks.frame(nowMs(), callbacks.context);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
bool FrameScheduler::takeCatchUpRequest() { return false; }
|
|
1789
|
+
bool FrameScheduler::drainFramesAndCheckInput() { return gEventHead != gEventTail; }
|
|
1790
|
+
void FrameScheduler::setVsyncDriven(bool driven) { gVsyncDriven = driven; }
|
|
1791
|
+
bool FrameScheduler::vsyncDriven() { return gVsyncDriven; }
|
|
1792
|
+
void FrameScheduler::notifyVsyncFromISR() {}
|
|
1793
|
+
|
|
1794
|
+
void FrameScheduler::setFrameIntervalMs(int intervalMs)
|
|
1795
|
+
{
|
|
1796
|
+
if (intervalMs < kMinFrameIntervalMs) intervalMs = kMinFrameIntervalMs;
|
|
1797
|
+
if (intervalMs > kMaxFrameIntervalMs) intervalMs = kMaxFrameIntervalMs;
|
|
1798
|
+
gFrameIntervalMs = intervalMs;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
int FrameScheduler::frameIntervalMs()
|
|
1802
|
+
{
|
|
1803
|
+
return gFrameIntervalMs;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
void FrameScheduler::setFrameRate(double fps)
|
|
1807
|
+
{
|
|
1808
|
+
if (fps <= 0.0) return;
|
|
1809
|
+
setFrameIntervalMs(static_cast<int>((1000.0 / fps) + 0.5));
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
double FrameScheduler::frameRate()
|
|
1813
|
+
{
|
|
1814
|
+
return gFrameIntervalMs > 0 ? 1000.0 / static_cast<double>(gFrameIntervalMs) : 0.0;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
int FrameScheduler::nowMs()
|
|
1818
|
+
{
|
|
1819
|
+
return static_cast<int>(time_us_64() / 1000u);
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
bool StorageService::init() { return true; }
|
|
1823
|
+
bool StorageService::getString(const char *, char *, unsigned) { return false; }
|
|
1824
|
+
bool StorageService::setString(const char *, const char *) { return false; }
|
|
1825
|
+
bool StorageService::loadKv(std::string &out)
|
|
1826
|
+
{
|
|
1827
|
+
out.clear();
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
void StorageService::saveKv(const std::string &) {}
|
|
1831
|
+
|
|
1832
|
+
} // namespace gea::framework::services
|
|
1833
|
+
|
|
1834
|
+
namespace gea::framework::app {
|
|
1835
|
+
|
|
1836
|
+
void Application::init(int width, int height, double devicePixelRatio)
|
|
1837
|
+
{
|
|
1838
|
+
gea::embedded::ui::Document::setPreferredMountSize(width, height);
|
|
1839
|
+
gea::embedded::ui::setViewportMetrics(width, height, devicePixelRatio);
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
void Application::frame(int timestampMs)
|
|
1843
|
+
{
|
|
1844
|
+
generated::drainMicrotasks();
|
|
1845
|
+
gea::host::runAnimationFrameCallbacks(static_cast<double>(timestampMs));
|
|
1846
|
+
gea::embedded::ui::Document::instance().frame(timestampMs);
|
|
1847
|
+
generated::drainMicrotasks();
|
|
1848
|
+
gea::embedded::ui::Document::instance().refreshMountedIfDirty();
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
void Application::toggleSettings() {}
|
|
1852
|
+
void applicationFramePerfStatsReset() {}
|
|
1853
|
+
void applicationFramePerfStatsAdd(ApplicationFramePhase, std::int64_t) {}
|
|
1854
|
+
void applicationFramePerfStatsAdd(ApplicationFramePerfStats &, ApplicationFramePhase, std::int64_t) {}
|
|
1855
|
+
ApplicationFramePerfStats applicationFramePerfStatsRead() { return {}; }
|
|
1856
|
+
void applicationFramePhaseSet(ApplicationFramePhase) {}
|
|
1857
|
+
ApplicationFramePhase applicationFramePhaseRead() { return ApplicationFramePhase::Idle; }
|
|
1858
|
+
const char *applicationFramePhaseName(ApplicationFramePhase phase)
|
|
1859
|
+
{
|
|
1860
|
+
switch (phase) {
|
|
1861
|
+
case ApplicationFramePhase::DrainMicrotasks:
|
|
1862
|
+
return "drainMicrotasks";
|
|
1863
|
+
case ApplicationFramePhase::AnimationFrameCallbacks:
|
|
1864
|
+
return "animationFrameCallbacks";
|
|
1865
|
+
case ApplicationFramePhase::StyleRecompute:
|
|
1866
|
+
return "styleRecompute";
|
|
1867
|
+
case ApplicationFramePhase::DocumentFrame:
|
|
1868
|
+
return "documentFrame";
|
|
1869
|
+
case ApplicationFramePhase::RefreshMounted:
|
|
1870
|
+
return "refreshMounted";
|
|
1871
|
+
case ApplicationFramePhase::Idle:
|
|
1872
|
+
default:
|
|
1873
|
+
return "idle";
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
} // namespace gea::framework::app
|
|
1878
|
+
|
|
1879
|
+
namespace gea::platform::display {
|
|
1880
|
+
|
|
1881
|
+
bool Display::init()
|
|
1882
|
+
{
|
|
1883
|
+
if (!gFramebuffer) {
|
|
1884
|
+
const auto bytes = static_cast<std::size_t>(gea::rp2350::kPanelWidth) * gea::rp2350::kPanelHeight * sizeof(Pixel);
|
|
1885
|
+
#if GEA_RP2350_FRAMEBUFFER_IN_SRAM
|
|
1886
|
+
gFramebuffer = gSramFramebuffer;
|
|
1887
|
+
#else
|
|
1888
|
+
gFramebuffer = static_cast<Pixel *>(gea::framework::memory::Allocator::allocatePreferSpiram(bytes, alignof(Pixel)));
|
|
1889
|
+
if (!gFramebuffer) return false;
|
|
1890
|
+
#endif
|
|
1891
|
+
std::memset(gFramebuffer, 0, bytes);
|
|
1892
|
+
gDisplayCanvas.bindPixels(gFramebuffer, gea::rp2350::kPanelWidth, gea::rp2350::kPanelHeight);
|
|
1893
|
+
}
|
|
1894
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
1895
|
+
startRenderWorker();
|
|
1896
|
+
#endif
|
|
1897
|
+
const bool ok = gea::rp2350::panelInit();
|
|
1898
|
+
gea::rp2350::panelSetBrightness(gBrightness);
|
|
1899
|
+
return ok;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
bool Display::start() { return init(); }
|
|
1903
|
+
gea::framework::graphics::Canvas *Display::canvas() { return &activeDisplayCanvas(); }
|
|
1904
|
+
bool Display::framebufferIsPanelDirect() { return true; }
|
|
1905
|
+
bool Display::panelScanoutSurface(std::uint16_t **outBuffer, int *outWidth, int *outHeight)
|
|
1906
|
+
{
|
|
1907
|
+
if (outBuffer) *outBuffer = gFramebuffer;
|
|
1908
|
+
if (outWidth) *outWidth = gea::rp2350::kPanelWidth;
|
|
1909
|
+
if (outHeight) *outHeight = gea::rp2350::kPanelHeight;
|
|
1910
|
+
return gFramebuffer != nullptr;
|
|
1911
|
+
}
|
|
1912
|
+
bool Display::panelDirectTarget(int, int, int, int, std::uint16_t **, int *, int *, int *, int *, int *, int *, int *, int *) { return false; }
|
|
1913
|
+
void Display::flipPanelToBack() {}
|
|
1914
|
+
bool Display::copySnapshotRgb565(std::uint16_t *dst, int pixelCapacity, int *width, int *height, bool)
|
|
1915
|
+
{
|
|
1916
|
+
if (width) *width = gea::rp2350::kPanelWidth;
|
|
1917
|
+
if (height) *height = gea::rp2350::kPanelHeight;
|
|
1918
|
+
const int pixels = gea::rp2350::kPanelWidth * gea::rp2350::kPanelHeight;
|
|
1919
|
+
if (!dst || pixelCapacity < pixels || !gFramebuffer) return false;
|
|
1920
|
+
std::memcpy(dst, gFramebuffer, static_cast<std::size_t>(pixels) * sizeof(std::uint16_t));
|
|
1921
|
+
return true;
|
|
1922
|
+
}
|
|
1923
|
+
int Display::countNonBlackPixels(bool)
|
|
1924
|
+
{
|
|
1925
|
+
if (!gFramebuffer) return 0;
|
|
1926
|
+
int count = 0;
|
|
1927
|
+
const int pixels = gea::rp2350::kPanelWidth * gea::rp2350::kPanelHeight;
|
|
1928
|
+
for (int i = 0; i < pixels; ++i) {
|
|
1929
|
+
if (gFramebuffer[i] != 0) ++count;
|
|
1930
|
+
}
|
|
1931
|
+
return count;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
void Display::clear()
|
|
1935
|
+
{
|
|
1936
|
+
gDisplayCanvas.clear(0);
|
|
1937
|
+
flush();
|
|
1938
|
+
}
|
|
1939
|
+
void Display::clearNoFlush() { gDisplayCanvas.clear(0); }
|
|
1940
|
+
void Display::print(const char *) {}
|
|
1941
|
+
void Display::flush()
|
|
1942
|
+
{
|
|
1943
|
+
int x0 = 0;
|
|
1944
|
+
int y0 = 0;
|
|
1945
|
+
int x1 = -1;
|
|
1946
|
+
int y1 = -1;
|
|
1947
|
+
if (gInvalidated) {
|
|
1948
|
+
x0 = 0;
|
|
1949
|
+
y0 = 0;
|
|
1950
|
+
x1 = gea::rp2350::kPanelWidth - 1;
|
|
1951
|
+
y1 = gea::rp2350::kPanelHeight - 1;
|
|
1952
|
+
gInvalidated = false;
|
|
1953
|
+
} else if (!gDisplayCanvas.dirty(&x0, &y0, &x1, &y1)) {
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
flushRectClipped(x0, y0, x1, y1);
|
|
1957
|
+
gDisplayCanvas.resetDirty();
|
|
1958
|
+
gPreviousPresentValid = false;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
void Display::flushRects(const DisplayFlushRect *rects, int count, bool)
|
|
1962
|
+
{
|
|
1963
|
+
if (!rects || count <= 0) return;
|
|
1964
|
+
std::array<FlushWindow, kMaxCollectedWindows> windows{};
|
|
1965
|
+
const int mergedCount = collectFlushWindows(rects, count, windows);
|
|
1966
|
+
for (int i = 0; i < mergedCount; ++i) {
|
|
1967
|
+
const FlushWindow &window = windows[static_cast<std::size_t>(i)];
|
|
1968
|
+
flushRectClipped(window.x0, window.y0, window.x1, window.y1);
|
|
1969
|
+
}
|
|
1970
|
+
gDisplayCanvas.resetDirty();
|
|
1971
|
+
gInvalidated = false;
|
|
1972
|
+
gPreviousPresentValid = false;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
void Display::flushRectsRasterized(const DisplayFlushRect *rects, int count, DisplayStreamRasterFn raster, void *user, bool)
|
|
1976
|
+
{
|
|
1977
|
+
if (!rects || count <= 0 || !raster) return;
|
|
1978
|
+
std::array<FlushWindow, kMaxCollectedWindows> windows{};
|
|
1979
|
+
const int mergedCount = collectFlushWindows(rects, count, windows);
|
|
1980
|
+
#if GEA_RP2350_PANEL_HW_VSCROLL
|
|
1981
|
+
if (gDisplayCanvas.scrollRegionH() > 0 && gScrollOffsetY != 0 && gFramebuffer) {
|
|
1982
|
+
// GRAM is circularly offset (panel scroll register engaged): the fused
|
|
1983
|
+
// stream would land at wrong rows. Raster row-by-row through the
|
|
1984
|
+
// framebuffer at its physical rows, then flush translated.
|
|
1985
|
+
for (int i = 0; i < mergedCount; ++i) {
|
|
1986
|
+
const FlushWindow &window = windows[static_cast<std::size_t>(i)];
|
|
1987
|
+
const int rowWidth = window.x1 - window.x0 + 1;
|
|
1988
|
+
std::uint16_t rowBuf[gea::rp2350::kPanelWidth];
|
|
1989
|
+
for (int yy = window.y0; yy <= window.y1; ++yy) {
|
|
1990
|
+
raster(rowBuf, rowWidth, 1, window.x0, yy, user);
|
|
1991
|
+
const int physY = gDisplayCanvas.rowToPhysical(yy);
|
|
1992
|
+
std::copy_n(rowBuf,
|
|
1993
|
+
rowWidth,
|
|
1994
|
+
gFramebuffer + static_cast<std::size_t>(physY) * gea::rp2350::kPanelWidth + window.x0);
|
|
1995
|
+
}
|
|
1996
|
+
flushRectClipped(window.x0, window.y0, window.x1, window.y1);
|
|
1997
|
+
}
|
|
1998
|
+
gDisplayCanvas.resetDirty();
|
|
1999
|
+
gInvalidated = false;
|
|
2000
|
+
gPreviousPresentValid = false;
|
|
2001
|
+
return;
|
|
2002
|
+
}
|
|
2003
|
+
#endif
|
|
2004
|
+
for (int i = 0; i < mergedCount; ++i) {
|
|
2005
|
+
const FlushWindow &window = windows[static_cast<std::size_t>(i)];
|
|
2006
|
+
streamRect(window.x0,
|
|
2007
|
+
window.y0,
|
|
2008
|
+
window.x1 - window.x0 + 1,
|
|
2009
|
+
window.y1 - window.y0 + 1,
|
|
2010
|
+
raster,
|
|
2011
|
+
user);
|
|
2012
|
+
}
|
|
2013
|
+
gDisplayCanvas.resetDirty();
|
|
2014
|
+
gInvalidated = false;
|
|
2015
|
+
gPreviousPresentValid = false;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
void Display::rebindCanvasToFramebuffer()
|
|
2019
|
+
{
|
|
2020
|
+
if (gFramebuffer) gDisplayCanvas.bindPixels(gFramebuffer, gea::rp2350::kPanelWidth, gea::rp2350::kPanelHeight);
|
|
2021
|
+
#if GEA_RP2350_RENDER_CORE1
|
|
2022
|
+
if (gFramebuffer) gRenderWorkerCanvas.bindPixels(gFramebuffer, gea::rp2350::kPanelWidth, gea::rp2350::kPanelHeight);
|
|
2023
|
+
#endif
|
|
2024
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
2025
|
+
setScrollRegionAll(gScrollRegionY, gScrollRegionH, gScrollOffsetY);
|
|
2026
|
+
#endif
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
bool Display::streamRect(int x, int y, int w, int h, DisplayStreamRasterFn raster, void *user)
|
|
2030
|
+
{
|
|
2031
|
+
if (!raster || w <= 0 || h <= 0) return false;
|
|
2032
|
+
#if GEA_RP2350_PANEL_HW_VSCROLL
|
|
2033
|
+
// GRAM rows are circularly offset while the panel scroll register is
|
|
2034
|
+
// engaged; a raster stream addressed at logical rows would land wrong.
|
|
2035
|
+
if (gDisplayCanvas.scrollRegionH() > 0 && gScrollOffsetY != 0) return false;
|
|
2036
|
+
#endif
|
|
2037
|
+
int x0 = std::max(0, x);
|
|
2038
|
+
int y0 = std::max(0, y);
|
|
2039
|
+
int x1 = std::min(gea::rp2350::kPanelWidth - 1, x + w - 1);
|
|
2040
|
+
int y1 = std::min(gea::rp2350::kPanelHeight - 1, y + h - 1);
|
|
2041
|
+
if (x0 > x1 || y0 > y1) return true;
|
|
2042
|
+
gea::rp2350::panelStreamRect(x0, y0, x1, y1, raster, user);
|
|
2043
|
+
gPreviousPresentValid = false;
|
|
2044
|
+
return true;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
bool Display::present(const DisplayPresentCommand *commands, int commandCount)
|
|
2048
|
+
{
|
|
2049
|
+
if (!commands || commandCount <= 0) return false;
|
|
2050
|
+
if (presentDirectToPanel(commands, commandCount)) return true;
|
|
2051
|
+
gPreviousPresentValid = false;
|
|
2052
|
+
for (int i = 0; i < commandCount; ++i) {
|
|
2053
|
+
const auto &command = commands[i];
|
|
2054
|
+
switch (command.type) {
|
|
2055
|
+
case DisplayPresentCommandType::Clear:
|
|
2056
|
+
gDisplayCanvas.clear(command.clear.color);
|
|
2057
|
+
break;
|
|
2058
|
+
case DisplayPresentCommandType::FillRectRgb565:
|
|
2059
|
+
gDisplayCanvas.setGlobalAlpha(command.fillRectRgb565.alpha);
|
|
2060
|
+
gDisplayCanvas.fillRect(command.fillRectRgb565.x, command.fillRectRgb565.y,
|
|
2061
|
+
command.fillRectRgb565.w, command.fillRectRgb565.h,
|
|
2062
|
+
command.fillRectRgb565.color);
|
|
2063
|
+
break;
|
|
2064
|
+
case DisplayPresentCommandType::StrokeRectRgb565:
|
|
2065
|
+
gDisplayCanvas.setGlobalAlpha(command.strokeRectRgb565.alpha);
|
|
2066
|
+
gDisplayCanvas.strokeRect(command.strokeRectRgb565.x, command.strokeRectRgb565.y,
|
|
2067
|
+
command.strokeRectRgb565.w, command.strokeRectRgb565.h,
|
|
2068
|
+
command.strokeRectRgb565.color);
|
|
2069
|
+
break;
|
|
2070
|
+
case DisplayPresentCommandType::FillTriangleRgb565:
|
|
2071
|
+
gDisplayCanvas.setGlobalAlpha(command.fillTriangleRgb565.alpha);
|
|
2072
|
+
gDisplayCanvas.fillTriangle(command.fillTriangleRgb565.x0, command.fillTriangleRgb565.y0,
|
|
2073
|
+
command.fillTriangleRgb565.x1, command.fillTriangleRgb565.y1,
|
|
2074
|
+
command.fillTriangleRgb565.x2, command.fillTriangleRgb565.y2,
|
|
2075
|
+
command.fillTriangleRgb565.color);
|
|
2076
|
+
break;
|
|
2077
|
+
case DisplayPresentCommandType::FillCircleRgb565:
|
|
2078
|
+
gDisplayCanvas.setGlobalAlpha(command.fillCircleRgb565.alpha);
|
|
2079
|
+
gDisplayCanvas.fillCircle(command.fillCircleRgb565.x, command.fillCircleRgb565.y,
|
|
2080
|
+
command.fillCircleRgb565.radius, command.fillCircleRgb565.color);
|
|
2081
|
+
break;
|
|
2082
|
+
case DisplayPresentCommandType::StrokeCircleRgb565:
|
|
2083
|
+
gDisplayCanvas.setGlobalAlpha(command.strokeCircleRgb565.alpha);
|
|
2084
|
+
gDisplayCanvas.strokeCircle(command.strokeCircleRgb565.x, command.strokeCircleRgb565.y,
|
|
2085
|
+
command.strokeCircleRgb565.radius, command.strokeCircleRgb565.color);
|
|
2086
|
+
break;
|
|
2087
|
+
case DisplayPresentCommandType::FillCirclesRgb565:
|
|
2088
|
+
gDisplayCanvas.setGlobalAlpha(command.fillCirclesRgb565.alpha);
|
|
2089
|
+
gDisplayCanvas.fillCirclesRgb565(command.fillCirclesRgb565.xs, command.fillCirclesRgb565.ys,
|
|
2090
|
+
command.fillCirclesRgb565.count, command.fillCirclesRgb565.radius,
|
|
2091
|
+
command.fillCirclesRgb565.colors);
|
|
2092
|
+
break;
|
|
2093
|
+
case DisplayPresentCommandType::DrawImage:
|
|
2094
|
+
gDisplayCanvas.setGlobalAlpha(command.drawImage.alpha);
|
|
2095
|
+
gDisplayCanvas.drawImage(command.drawImage.pixels, command.drawImage.alphaPixels,
|
|
2096
|
+
command.drawImage.srcWidth, command.drawImage.srcHeight,
|
|
2097
|
+
command.drawImage.x, command.drawImage.y);
|
|
2098
|
+
break;
|
|
2099
|
+
case DisplayPresentCommandType::DrawImageScaled:
|
|
2100
|
+
gDisplayCanvas.setGlobalAlpha(command.drawImageScaled.alpha);
|
|
2101
|
+
gDisplayCanvas.drawImage(command.drawImageScaled.pixels, command.drawImageScaled.alphaPixels,
|
|
2102
|
+
command.drawImageScaled.srcWidth, command.drawImageScaled.srcHeight,
|
|
2103
|
+
command.drawImageScaled.x, command.drawImageScaled.y,
|
|
2104
|
+
command.drawImageScaled.w, command.drawImageScaled.h);
|
|
2105
|
+
break;
|
|
2106
|
+
case DisplayPresentCommandType::DrawImageRotated90CW:
|
|
2107
|
+
gDisplayCanvas.setGlobalAlpha(command.drawImageRotated90CW.alpha);
|
|
2108
|
+
gDisplayCanvas.drawImageRotated90CW(command.drawImageRotated90CW.pixels,
|
|
2109
|
+
command.drawImageRotated90CW.alphaPixels,
|
|
2110
|
+
command.drawImageRotated90CW.srcWidth,
|
|
2111
|
+
command.drawImageRotated90CW.srcHeight,
|
|
2112
|
+
command.drawImageRotated90CW.x,
|
|
2113
|
+
command.drawImageRotated90CW.y,
|
|
2114
|
+
command.drawImageRotated90CW.w,
|
|
2115
|
+
command.drawImageRotated90CW.h);
|
|
2116
|
+
break;
|
|
2117
|
+
case DisplayPresentCommandType::DrawImageTiledX:
|
|
2118
|
+
gDisplayCanvas.setGlobalAlpha(command.drawImageTiledX.alpha);
|
|
2119
|
+
gDisplayCanvas.drawImageTiledX(command.drawImageTiledX.pixels, command.drawImageTiledX.alphaPixels,
|
|
2120
|
+
command.drawImageTiledX.srcWidth, command.drawImageTiledX.srcHeight,
|
|
2121
|
+
command.drawImageTiledX.x, command.drawImageTiledX.y,
|
|
2122
|
+
command.drawImageTiledX.w);
|
|
2123
|
+
break;
|
|
2124
|
+
case DisplayPresentCommandType::FillText:
|
|
2125
|
+
gDisplayCanvas.setGlobalAlpha(command.fillText.alpha);
|
|
2126
|
+
if (command.fillText.fontFamilyId >= 0) {
|
|
2127
|
+
gDisplayCanvas.drawTextFontFamily(command.fillText.text, command.fillText.x, command.fillText.y,
|
|
2128
|
+
command.fillText.color, command.fillText.fontFamilyId,
|
|
2129
|
+
command.fillText.fontSizePx);
|
|
2130
|
+
} else {
|
|
2131
|
+
gDisplayCanvas.drawText(command.fillText.text, command.fillText.x, command.fillText.y,
|
|
2132
|
+
command.fillText.color, command.fillText.scale);
|
|
2133
|
+
}
|
|
2134
|
+
break;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
gDisplayCanvas.setGlobalAlpha(gDisplayAlpha);
|
|
2138
|
+
flush();
|
|
2139
|
+
return true;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
void Display::setFlushConfig(int chunkRows, int queueDepth)
|
|
2143
|
+
{
|
|
2144
|
+
if (chunkRows > 0) gFlushRows = chunkRows;
|
|
2145
|
+
if (queueDepth > 0) gFlushDepth = queueDepth;
|
|
2146
|
+
gea::rp2350::panelSetFlushConfig(gFlushRows, gFlushDepth);
|
|
2147
|
+
}
|
|
2148
|
+
void Display::reserveInternal(std::size_t) {}
|
|
2149
|
+
bool Display::setHighBrightnessMode(bool) { return false; }
|
|
2150
|
+
bool Display::highBrightnessMode() { return false; }
|
|
2151
|
+
void Display::applyPendingInternalReserve() {}
|
|
2152
|
+
int Display::flushChunkRows() { return gFlushRows; }
|
|
2153
|
+
int Display::flushQueueDepth() { return gFlushDepth; }
|
|
2154
|
+
int Display::flushBufferBytes() { return gea::rp2350::kPanelWidth * gFlushRows * 2 * gFlushDepth; }
|
|
2155
|
+
void Display::pushClip(int x, int y, int w, int h) { activeDisplayCanvas().pushClip(x, y, w, h); }
|
|
2156
|
+
void Display::popClip() { activeDisplayCanvas().popClip(); }
|
|
2157
|
+
void Display::resetClip() { activeDisplayCanvas().resetClip(); }
|
|
2158
|
+
void Display::setAlpha(std::uint8_t alpha)
|
|
2159
|
+
{
|
|
2160
|
+
activeDisplayCanvas().setGlobalAlpha(alpha);
|
|
2161
|
+
if (!onRenderWorkerCore()) gDisplayAlpha = alpha;
|
|
2162
|
+
}
|
|
2163
|
+
std::uint8_t Display::alpha() { return activeDisplayCanvas().globalAlpha(); }
|
|
2164
|
+
int Display::brightness() { return gBrightness; }
|
|
2165
|
+
void Display::setBrightness(int brightnessPercent)
|
|
2166
|
+
{
|
|
2167
|
+
gBrightness = std::clamp(brightnessPercent, 0, 100);
|
|
2168
|
+
gea::rp2350::panelSetBrightness(gBrightness);
|
|
2169
|
+
}
|
|
2170
|
+
void Display::setVSync(bool on) { gVsyncDriven = on; }
|
|
2171
|
+
bool Display::vsyncEnabled() { return gVsyncDriven; }
|
|
2172
|
+
void Display::invalidate() { gInvalidated = true; }
|
|
2173
|
+
void Display::setPresentScale(int scale) { gPresentScale = scale >= 2 ? 2 : 1; }
|
|
2174
|
+
void Display::vsyncWaitForFrame() {}
|
|
2175
|
+
void Display::clip(int *x0, int *y0, int *x1, int *y1) { activeDisplayCanvas().currentClip(x0, y0, x1, y1); }
|
|
2176
|
+
void Display::fillRect(int x, int y, int w, int h, Pixel color) { activeDisplayCanvas().fillRect(x, y, w, h, color); }
|
|
2177
|
+
void Display::scrollRect(int x, int y, int w, int h, int dx, int dy)
|
|
2178
|
+
{
|
|
2179
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
2180
|
+
if (!onRenderWorkerCore() &&
|
|
2181
|
+
dx == 0 &&
|
|
2182
|
+
dy != 0 &&
|
|
2183
|
+
x == 0 &&
|
|
2184
|
+
w >= gea::rp2350::kPanelWidth &&
|
|
2185
|
+
h > 0 &&
|
|
2186
|
+
y >= 0 &&
|
|
2187
|
+
y + h <= gea::rp2350::kPanelHeight) {
|
|
2188
|
+
if (gScrollRegionY != y || gScrollRegionH != h) {
|
|
2189
|
+
gScrollRegionY = y;
|
|
2190
|
+
gScrollRegionH = h;
|
|
2191
|
+
gScrollOffsetY = 0;
|
|
2192
|
+
}
|
|
2193
|
+
gScrollOffsetY -= dy;
|
|
2194
|
+
gScrollOffsetY %= gScrollRegionH;
|
|
2195
|
+
if (gScrollOffsetY < 0) gScrollOffsetY += gScrollRegionH;
|
|
2196
|
+
setScrollRegionAll(gScrollRegionY, gScrollRegionH, gScrollOffsetY);
|
|
2197
|
+
#if GEA_RP2350_PANEL_HW_VSCROLL
|
|
2198
|
+
if (gScrollRegionY == 0 && gScrollRegionH == gea::rp2350::kPanelHeight) {
|
|
2199
|
+
// The panel rotates scanout itself (VSCSAD in setScrollRegionAll);
|
|
2200
|
+
// only the revealed strip needs pixels, and its replay marks its
|
|
2201
|
+
// own dirty rect.
|
|
2202
|
+
return;
|
|
2203
|
+
}
|
|
2204
|
+
#endif
|
|
2205
|
+
gDisplayCanvas.markDirty(0, y, gea::rp2350::kPanelWidth - 1, y + h - 1);
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
#endif
|
|
2209
|
+
activeDisplayCanvas().scrollRect(x, y, w, h, dx, dy);
|
|
2210
|
+
}
|
|
2211
|
+
void Display::resetScrollRegion()
|
|
2212
|
+
{
|
|
2213
|
+
#if GEA_RP2350_SOFTWARE_SCROLL_REGISTER
|
|
2214
|
+
setScrollRegionAll(0, 0, 0);
|
|
2215
|
+
#else
|
|
2216
|
+
activeDisplayCanvas().setScrollRegion(0, 0, 0);
|
|
2217
|
+
#endif
|
|
2218
|
+
}
|
|
2219
|
+
void Display::strokeRect(int x, int y, int w, int h, Pixel color) { activeDisplayCanvas().strokeRect(x, y, w, h, color); }
|
|
2220
|
+
void Display::fillCircle(int cx, int cy, int r, Pixel color) { activeDisplayCanvas().fillCircle(cx, cy, r, color); }
|
|
2221
|
+
void Display::strokeCircle(int cx, int cy, int r, Pixel color) { activeDisplayCanvas().strokeCircle(cx, cy, r, color); }
|
|
2222
|
+
void Display::drawLine(int x0, int y0, int x1, int y1, Pixel color) { activeDisplayCanvas().drawLine(x0, y0, x1, y1, color); }
|
|
2223
|
+
void Display::drawArc(int cx, int cy, int r, int startDeg, int endDeg, Pixel color) { activeDisplayCanvas().drawArc(cx, cy, r, startDeg, endDeg, color); }
|
|
2224
|
+
void Display::fillTriangle(int x0, int y0, int x1, int y1, int x2, int y2, Pixel color) { activeDisplayCanvas().fillTriangle(x0, y0, x1, y1, x2, y2, color); }
|
|
2225
|
+
void Display::drawText(const char *text, int x, int y, Pixel color, float scale) { activeDisplayCanvas().drawText(text, x, y, color, scale); }
|
|
2226
|
+
void Display::drawTextFont(const char *text, int x, int y, Pixel color, int fontId) { activeDisplayCanvas().drawTextFont(text, x, y, color, fontId); }
|
|
2227
|
+
void Display::drawTextFontFamily(const char *text, int x, int y, Pixel color, int familyId, int sizePx) { activeDisplayCanvas().drawTextFontFamily(text, x, y, color, familyId, sizePx); }
|
|
2228
|
+
void Display::setPixel(int x, int y, Pixel color) { activeDisplayCanvas().fillRect(x, y, 1, 1, color); }
|
|
2229
|
+
void Display::fillRoundedRect(int x, int y, int w, int h, int tl, int tr, int br, int bl, Pixel color) { activeDisplayCanvas().fillRoundedRect(x, y, w, h, tl, tr, br, bl, color); }
|
|
2230
|
+
void Display::fillRoundedRectBoxesRgb565(const std::int16_t *xs, const std::int16_t *ys, int count, int w, int h, int tl, int tr, int br, int bl, const Pixel *colors)
|
|
2231
|
+
{
|
|
2232
|
+
activeDisplayCanvas().fillRoundedRectBoxesRgb565(xs, ys, count, w, h, tl, tr, br, bl, colors);
|
|
2233
|
+
}
|
|
2234
|
+
void Display::strokeRoundedRect(int x, int y, int w, int h, int tl, int tr, int br, int bl, int lw, Pixel color) { activeDisplayCanvas().strokeRoundedRect(x, y, w, h, tl, tr, br, bl, lw, color); }
|
|
2235
|
+
void Display::blitImage(const Pixel *src, const std::uint8_t *alpha, int srcW, int srcH, int dx, int dy) { activeDisplayCanvas().drawImage(src, alpha, srcW, srcH, dx, dy); }
|
|
2236
|
+
void Display::blitImageScaled(const Pixel *src, const std::uint8_t *alpha, int srcW, int srcH, int dx, int dy, int dstW, int dstH) { activeDisplayCanvas().drawImage(src, alpha, srcW, srcH, dx, dy, dstW, dstH); }
|
|
2237
|
+
void Display::setWorldOverlay(const std::uint16_t *, int, int, int, int) {}
|
|
2238
|
+
void Display::setWorldScroll(int) {}
|
|
2239
|
+
void Display::flushStatsRead(std::int64_t *totalUs, int *callCount, int *pixelCount)
|
|
2240
|
+
{
|
|
2241
|
+
const auto stats = gea::rp2350::panelFlushStatsRead();
|
|
2242
|
+
if (totalUs) *totalUs = stats.totalUs;
|
|
2243
|
+
if (callCount) *callCount = stats.callCount;
|
|
2244
|
+
if (pixelCount) *pixelCount = stats.pixelCount;
|
|
2245
|
+
}
|
|
2246
|
+
DisplayFlushPerfStats Display::flushPerfStatsRead()
|
|
2247
|
+
{
|
|
2248
|
+
const auto panelStats = gea::rp2350::panelFlushStatsRead();
|
|
2249
|
+
DisplayFlushPerfStats stats{};
|
|
2250
|
+
stats.totalUs = panelStats.totalUs;
|
|
2251
|
+
stats.setWindowUs = panelStats.setWindowUs;
|
|
2252
|
+
stats.copyUs = panelStats.copyUs;
|
|
2253
|
+
stats.txUs = panelStats.txWaitUs;
|
|
2254
|
+
stats.completeWaitUs = panelStats.txWaitUs;
|
|
2255
|
+
stats.callCount = panelStats.callCount;
|
|
2256
|
+
stats.chunkCount = panelStats.chunkCount;
|
|
2257
|
+
stats.pixelCount = panelStats.pixelCount;
|
|
2258
|
+
return stats;
|
|
2259
|
+
}
|
|
2260
|
+
void Display::presentPathDebug(int *calls, int *direct, int *general, int *rejected, int *tileShapeFailKind, int *tileShapeFailType, int *tileShapeFailCount)
|
|
2261
|
+
{
|
|
2262
|
+
if (calls) *calls = 0;
|
|
2263
|
+
if (direct) *direct = 0;
|
|
2264
|
+
if (general) *general = 0;
|
|
2265
|
+
if (rejected) *rejected = 0;
|
|
2266
|
+
if (tileShapeFailKind) *tileShapeFailKind = 0;
|
|
2267
|
+
if (tileShapeFailType) *tileShapeFailType = 0;
|
|
2268
|
+
if (tileShapeFailCount) *tileShapeFailCount = 0;
|
|
2269
|
+
}
|
|
2270
|
+
void Display::landFrameDebug(int *total, int *align, int *raster, int *text, int *flip)
|
|
2271
|
+
{
|
|
2272
|
+
if (total) *total = 0;
|
|
2273
|
+
if (align) *align = 0;
|
|
2274
|
+
if (raster) *raster = 0;
|
|
2275
|
+
if (text) *text = 0;
|
|
2276
|
+
if (flip) *flip = 0;
|
|
2277
|
+
}
|
|
2278
|
+
void Display::landPanDebug(int *detect, int *kick, int *strips, int *wait, int *interior)
|
|
2279
|
+
{
|
|
2280
|
+
if (detect) *detect = 0;
|
|
2281
|
+
if (kick) *kick = 0;
|
|
2282
|
+
if (strips) *strips = 0;
|
|
2283
|
+
if (wait) *wait = 0;
|
|
2284
|
+
if (interior) *interior = 0;
|
|
2285
|
+
}
|
|
2286
|
+
void Display::flushStatsReset()
|
|
2287
|
+
{
|
|
2288
|
+
gFlushCalls = 0;
|
|
2289
|
+
gFlushPixels = 0;
|
|
2290
|
+
gea::rp2350::panelFlushStatsReset();
|
|
2291
|
+
}
|
|
2292
|
+
const char *Display::flushStageName() { return "idle"; }
|
|
2293
|
+
int Display::flushStageChunk() { return 0; }
|
|
2294
|
+
DisplayFlushStageDetail Display::flushStageDetail() { return {}; }
|
|
2295
|
+
|
|
2296
|
+
} // namespace gea::platform::display
|
|
2297
|
+
|
|
2298
|
+
namespace gea::framework::display {
|
|
2299
|
+
|
|
2300
|
+
double DisplayBackend::brightness() { return static_cast<double>(gea::platform::display::Display::brightness()); }
|
|
2301
|
+
void DisplayBackend::setBrightness(double brightness) { gea::platform::display::Display::setBrightness(static_cast<int>(brightness)); }
|
|
2302
|
+
void DisplayBackend::setAA(double samples) { gea::platform::display::Display::setAA(static_cast<int>(samples)); }
|
|
2303
|
+
void DisplayBackend::setFlushConfig(double rows, double depth) { gea::platform::display::Display::setFlushConfig(static_cast<int>(rows), static_cast<int>(depth)); }
|
|
2304
|
+
void DisplayBackend::setEpaperRefreshConfig(double, double, double, const std::vector<std::uint8_t> &, bool, const std::vector<std::uint8_t> &, bool) {}
|
|
2305
|
+
void DisplayBackend::epaperFullRefresh() {}
|
|
2306
|
+
void DisplayBackend::setEpaperGrayscale(bool) {}
|
|
2307
|
+
double DisplayBackend::nativeWidth() { return static_cast<double>(detail::DisplayOrientationState::nativeWidth()); }
|
|
2308
|
+
double DisplayBackend::nativeHeight() { return static_cast<double>(detail::DisplayOrientationState::nativeHeight()); }
|
|
2309
|
+
std::string DisplayBackend::orientation() { return detail::DisplayOrientationState::orientationString(); }
|
|
2310
|
+
void DisplayBackend::setOrientation(const std::string &orientation) { detail::DisplayOrientationState::setOrientation(orientation); }
|
|
2311
|
+
std::vector<std::string> DisplayBackend::supportedOrientations() { return detail::DisplayOrientationState::supportedOrientations(); }
|
|
2312
|
+
void DisplayBackend::setSupportedOrientations(const std::vector<std::string> &orientations) { detail::DisplayOrientationState::setSupportedOrientations(orientations); }
|
|
2313
|
+
void DisplayBackend::setSupportedOrientations(const std::string &orientation) { detail::DisplayOrientationState::setSupportedOrientations(orientation); }
|
|
2314
|
+
bool DisplayBackend::autoRotate() { return detail::DisplayOrientationState::autoRotate(); }
|
|
2315
|
+
void DisplayBackend::setAutoRotate(bool enabled) { detail::DisplayOrientationState::setAutoRotate(enabled); }
|
|
2316
|
+
void DisplayBackend::setVSync(bool on) { gea::platform::display::Display::setVSync(on); }
|
|
2317
|
+
void DisplayBackend::setTextRasterCache(bool on) { gea::framework::graphics::Canvas::setTextRasterCacheEnabled(on); }
|
|
2318
|
+
void DisplayBackend::invalidate() { gea::platform::display::Display::invalidate(); }
|
|
2319
|
+
std::string DisplayBackend::pixelFormat() { return "rgb565"; }
|
|
2320
|
+
void DisplayBackend::setPixelFormat(const std::string &) {}
|
|
2321
|
+
std::string DisplayBackend::panelPixelFormat() { return "rgb565"; }
|
|
2322
|
+
std::vector<std::string> DisplayBackend::supportedPixelFormats() { return {"rgb565"}; }
|
|
2323
|
+
void DisplayBackend::updateAutoRotationFromAccelerometer() { detail::DisplayOrientationState::updateAutoRotationFromAccelerometer(); }
|
|
2324
|
+
void DisplayBackend::updateAutoRotation(double x, double y, double z) { detail::DisplayOrientationState::updateAutoRotation(x, y, z); }
|
|
2325
|
+
|
|
2326
|
+
} // namespace gea::framework::display
|
|
2327
|
+
|
|
2328
|
+
namespace gea::platform::touch {
|
|
2329
|
+
|
|
2330
|
+
void Touchscreen::setObserver(Observer observer)
|
|
2331
|
+
{
|
|
2332
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
2333
|
+
gTouchObserver = observer;
|
|
2334
|
+
#else
|
|
2335
|
+
(void)observer;
|
|
2336
|
+
#endif
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
bool Touchscreen::init()
|
|
2340
|
+
{
|
|
2341
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
2342
|
+
gpio_init(board::touch.reset);
|
|
2343
|
+
gpio_set_dir(board::touch.reset, GPIO_OUT);
|
|
2344
|
+
gpio_put(board::touch.reset, 1);
|
|
2345
|
+
sleep_ms(10);
|
|
2346
|
+
gpio_put(board::touch.reset, 0);
|
|
2347
|
+
sleep_ms(10);
|
|
2348
|
+
gpio_put(board::touch.reset, 1);
|
|
2349
|
+
sleep_ms(300);
|
|
2350
|
+
|
|
2351
|
+
gpio_init(board::touch.interrupt);
|
|
2352
|
+
gpio_set_dir(board::touch.interrupt, GPIO_IN);
|
|
2353
|
+
gpio_pull_up(board::touch.interrupt);
|
|
2354
|
+
|
|
2355
|
+
std::uint8_t chipId = 0;
|
|
2356
|
+
const bool idOk = gTouchCore.readChipId(gTouchBus, chipId);
|
|
2357
|
+
gTouchInitialized = idOk && chipId == gea::chips::ft6336::kExpectedChipId &&
|
|
2358
|
+
gTouchCore.configure(gTouchBus, false);
|
|
2359
|
+
std::printf("ft6336 init=%d id_ok=%d id=0x%02x\n",
|
|
2360
|
+
gTouchInitialized ? 1 : 0,
|
|
2361
|
+
idOk ? 1 : 0,
|
|
2362
|
+
chipId);
|
|
2363
|
+
return gTouchInitialized;
|
|
2364
|
+
#else
|
|
2365
|
+
return false;
|
|
2366
|
+
#endif
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
int Touchscreen::read(int *x, int *y)
|
|
2370
|
+
{
|
|
2371
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
2372
|
+
gea::chips::ft6336::TouchSample sample{};
|
|
2373
|
+
const bool ok = gTouchCore.read(gTouchBus, sample);
|
|
2374
|
+
if (ok && sample.touching) {
|
|
2375
|
+
gTouchX = std::clamp(sample.x, 0, gea::rp2350::kPanelWidth - 1);
|
|
2376
|
+
gTouchY = std::clamp(sample.y, 0, gea::rp2350::kPanelHeight - 1);
|
|
2377
|
+
gTouching = true;
|
|
2378
|
+
if (x) *x = gTouchX;
|
|
2379
|
+
if (y) *y = gTouchY;
|
|
2380
|
+
return 1;
|
|
2381
|
+
}
|
|
2382
|
+
if (x) *x = gTouchX;
|
|
2383
|
+
if (y) *y = gTouchY;
|
|
2384
|
+
return 0;
|
|
2385
|
+
#else
|
|
2386
|
+
if (x) *x = 0;
|
|
2387
|
+
if (y) *y = 0;
|
|
2388
|
+
return 0;
|
|
2389
|
+
#endif
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
int Touchscreen::readCached(int *x, int *y)
|
|
2393
|
+
{
|
|
2394
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
2395
|
+
if (x) *x = gTouchX;
|
|
2396
|
+
if (y) *y = gTouchY;
|
|
2397
|
+
return gTouching ? 1 : 0;
|
|
2398
|
+
#else
|
|
2399
|
+
if (x) *x = 0;
|
|
2400
|
+
if (y) *y = 0;
|
|
2401
|
+
return 0;
|
|
2402
|
+
#endif
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
void Touchscreen::consumeLatestMove(int *x, int *y)
|
|
2406
|
+
{
|
|
2407
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
2408
|
+
if (x) *x = gTouchX;
|
|
2409
|
+
if (y) *y = gTouchY;
|
|
2410
|
+
#else
|
|
2411
|
+
if (x) *x = 0;
|
|
2412
|
+
if (y) *y = 0;
|
|
2413
|
+
#endif
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
void Touchscreen::injectEvent(Phase phase, bool touching, int x, int y)
|
|
2417
|
+
{
|
|
2418
|
+
#if GEA_RP2350_HAS_TOUCH
|
|
2419
|
+
gTouchX = x;
|
|
2420
|
+
gTouchY = y;
|
|
2421
|
+
gTouching = touching;
|
|
2422
|
+
if (gTouchObserver) gTouchObserver(phase, touching, x, y);
|
|
2423
|
+
#else
|
|
2424
|
+
(void)phase;
|
|
2425
|
+
(void)touching;
|
|
2426
|
+
(void)x;
|
|
2427
|
+
(void)y;
|
|
2428
|
+
#endif
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
} // namespace gea::platform::touch
|
|
2432
|
+
|
|
2433
|
+
namespace gea::framework::sensors {
|
|
2434
|
+
void AccelerometerBackend::init() {}
|
|
2435
|
+
void AccelerometerBackend::close() {}
|
|
2436
|
+
void AccelerometerBackend::calibrateBias() {}
|
|
2437
|
+
double AccelerometerBackend::tiltX() { return 0.0; }
|
|
2438
|
+
double AccelerometerBackend::tiltY() { return 0.0; }
|
|
2439
|
+
double AccelerometerBackend::accelerationX() { return 0.0; }
|
|
2440
|
+
double AccelerometerBackend::accelerationY() { return 0.0; }
|
|
2441
|
+
double AccelerometerBackend::accelerationZ() { return 9.8; }
|
|
2442
|
+
double AccelerometerBackend::gyroscopeX() { return 0.0; }
|
|
2443
|
+
double AccelerometerBackend::gyroscopeY() { return 0.0; }
|
|
2444
|
+
double AccelerometerBackend::gyroscopeZ() { return 0.0; }
|
|
2445
|
+
} // namespace gea::framework::sensors
|
|
2446
|
+
|
|
2447
|
+
namespace gea::framework::network {
|
|
2448
|
+
bool WifiBackend::enabled() { return false; }
|
|
2449
|
+
void WifiBackend::setEnabled(bool) {}
|
|
2450
|
+
bool WifiBackend::connected() { return false; }
|
|
2451
|
+
double WifiBackend::rssi() { return 0.0; }
|
|
2452
|
+
std::string WifiBackend::ssid() { return {}; }
|
|
2453
|
+
std::string WifiBackend::ip() { return {}; }
|
|
2454
|
+
std::string WifiBackend::mac() { return {}; }
|
|
2455
|
+
void WifiBackend::configure(const std::string &, const std::string &) {}
|
|
2456
|
+
bool WifiBackend::waitForConnection(double) { return false; }
|
|
2457
|
+
void WifiBackend::startScan() {}
|
|
2458
|
+
bool WifiBackend::scanning() { return false; }
|
|
2459
|
+
double WifiBackend::scanCount() { return 0.0; }
|
|
2460
|
+
std::string WifiBackend::scanSsidAt(double) { return {}; }
|
|
2461
|
+
double WifiBackend::scanRssiAt(double) { return 0.0; }
|
|
2462
|
+
bool WifiBackend::scanSecuredAt(double) { return false; }
|
|
2463
|
+
} // namespace gea::framework::network
|
|
2464
|
+
|
|
2465
|
+
namespace gea::framework::camera {
|
|
2466
|
+
bool CameraBackend::isAvailable() { return false; }
|
|
2467
|
+
bool CameraBackend::hasPermission() { return false; }
|
|
2468
|
+
bool CameraBackend::requestPermission() { return false; }
|
|
2469
|
+
bool CameraBackend::open(const std::string &, double, double) { return false; }
|
|
2470
|
+
void CameraBackend::close() {}
|
|
2471
|
+
bool CameraBackend::isOpen() { return false; }
|
|
2472
|
+
double CameraBackend::width() { return 0.0; }
|
|
2473
|
+
double CameraBackend::height() { return 0.0; }
|
|
2474
|
+
double CameraBackend::orientation() { return 0.0; }
|
|
2475
|
+
std::string CameraBackend::facing() { return {}; }
|
|
2476
|
+
double CameraBackend::deviceCount() { return 0.0; }
|
|
2477
|
+
std::string CameraBackend::deviceIdAt(double) { return {}; }
|
|
2478
|
+
std::string CameraBackend::deviceFacingAt(double) { return {}; }
|
|
2479
|
+
void CameraBackend::draw(double, double, double, double) {}
|
|
2480
|
+
double CameraBackend::capture() { return -1.0; }
|
|
2481
|
+
double CameraBackend::captureMirrored() { return -1.0; }
|
|
2482
|
+
bool CameraBackend::startRecording(const std::string &, double) { return false; }
|
|
2483
|
+
double CameraBackend::stopRecording() { return -1.0; }
|
|
2484
|
+
bool CameraBackend::isRecording() { return false; }
|
|
2485
|
+
void CameraBackend::setFlash(const std::string &) {}
|
|
2486
|
+
void CameraBackend::setZoom(double) {}
|
|
2487
|
+
void CameraBackend::setMirror(bool) {}
|
|
2488
|
+
void CameraBackend::setExposure(const std::string &, double, double, double) {}
|
|
2489
|
+
void CameraBackend::setWhiteBalance(const std::string &, double, double) {}
|
|
2490
|
+
void CameraBackend::setFocus(const std::string &, double, double) {}
|
|
2491
|
+
void CameraBackend::setTorch(const std::string &, double) {}
|
|
2492
|
+
void registerCameraSurface() {}
|
|
2493
|
+
} // namespace gea::framework::camera
|
|
2494
|
+
|
|
2495
|
+
namespace gea::framework::geolocation {
|
|
2496
|
+
bool GeolocationBackend::hasFix() { return false; }
|
|
2497
|
+
GeolocationPosition GeolocationBackend::currentPosition() { return {}; }
|
|
2498
|
+
double GeolocationBackend::latitude() { return 0.0; }
|
|
2499
|
+
double GeolocationBackend::longitude() { return 0.0; }
|
|
2500
|
+
double GeolocationBackend::accuracy() { return -1.0; }
|
|
2501
|
+
} // namespace gea::framework::geolocation
|
|
2502
|
+
|
|
2503
|
+
namespace gea::framework::bluetooth {
|
|
2504
|
+
void HidBackend::init(const std::string &, double, const std::string &) {}
|
|
2505
|
+
bool HidBackend::enabled() { return false; }
|
|
2506
|
+
void HidBackend::setEnabled(bool) {}
|
|
2507
|
+
void HidBackend::startAdvertising() {}
|
|
2508
|
+
void HidBackend::stopAdvertising() {}
|
|
2509
|
+
bool HidBackend::connected() { return false; }
|
|
2510
|
+
bool HidBackend::bound() { return false; }
|
|
2511
|
+
double HidBackend::batteryLevel() { return 0.0; }
|
|
2512
|
+
std::string HidBackend::mac() { return {}; }
|
|
2513
|
+
std::string HidBackend::deviceName() { return {}; }
|
|
2514
|
+
void HidBackend::keyTap(double) {}
|
|
2515
|
+
void HidBackend::keyDown(double, double) {}
|
|
2516
|
+
void HidBackend::keyUp() {}
|
|
2517
|
+
void HidBackend::mouseMove(double, double, double, double) {}
|
|
2518
|
+
void HidBackend::mouseClick(double) {}
|
|
2519
|
+
} // namespace gea::framework::bluetooth
|
|
2520
|
+
|
|
2521
|
+
namespace gea::framework::audio {
|
|
2522
|
+
double AudioBackend::volume() { return 0.0; }
|
|
2523
|
+
void AudioBackend::setVolume(double) {}
|
|
2524
|
+
} // namespace gea::framework::audio
|
|
2525
|
+
|
|
2526
|
+
namespace gea::framework::input {
|
|
2527
|
+
bool InputBackend::consumeBackButton() { return false; }
|
|
2528
|
+
} // namespace gea::framework::input
|
|
2529
|
+
|
|
2530
|
+
namespace gea::platform::audio {
|
|
2531
|
+
AudioParam::AudioParam(NativeAudioHandle oscillator) : oscillator_(oscillator) {}
|
|
2532
|
+
double AudioParam::value() const { return 0.0; }
|
|
2533
|
+
void AudioParam::setValue(double) {}
|
|
2534
|
+
void AudioParam::setValueAtTime(double, double) {}
|
|
2535
|
+
AudioNode::AudioNode(NativeAudioHandle native) : native_(native) {}
|
|
2536
|
+
NativeAudioHandle AudioNode::nativeId() const { return native_; }
|
|
2537
|
+
AudioDestinationNode::AudioDestinationNode(NativeAudioHandle native) : AudioNode(native) {}
|
|
2538
|
+
OscillatorNode::OscillatorNode(NativeAudioHandle native) : AudioNode(native), frequency(native) {}
|
|
2539
|
+
OscillatorType OscillatorNode::type() const { return OscillatorType::Sine; }
|
|
2540
|
+
void OscillatorNode::setType(OscillatorType) {}
|
|
2541
|
+
void OscillatorNode::connect(const AudioDestinationNode &) {}
|
|
2542
|
+
void OscillatorNode::start(double) {}
|
|
2543
|
+
void OscillatorNode::stop(double) {}
|
|
2544
|
+
double AudioContext::currentTime() const { return 0.0; }
|
|
2545
|
+
AudioDestinationNode AudioContext::destination() const { return AudioDestinationNode(); }
|
|
2546
|
+
OscillatorNode AudioContext::createOscillator() const { return OscillatorNode(); }
|
|
2547
|
+
AudioContext AudioSystem::sharedContext() { return AudioContext(); }
|
|
2548
|
+
int AudioSystem::volume() { return 0; }
|
|
2549
|
+
void AudioSystem::setVolume(int) {}
|
|
2550
|
+
bool AudioSystem::playFile(const std::string &) { return false; }
|
|
2551
|
+
bool AudioSystem::playPcm(const std::int16_t *, std::size_t, int, int) { return false; }
|
|
2552
|
+
void AudioSystem::stopPlayback() {}
|
|
2553
|
+
} // namespace gea::platform::audio
|