@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,671 @@
|
|
|
1
|
+
// M5PaperS3 e-paper driver. See include/papers3_epd.h for the protocol summary.
|
|
2
|
+
//
|
|
3
|
+
// Scan/timing layer derived from Wenting Zhang's "Modos Smooth Graphics"
|
|
4
|
+
// PaperBoy (MIT) — the gate-start dance, the per-row latch sequence and the i80
|
|
5
|
+
// bus setup are its proven-on-this-board recipe. The calibrated four-state
|
|
6
|
+
// transition waveforms come from EPD_Painter's PaperS3 preset.
|
|
7
|
+
//
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// WHY THIS WAVEFORM IS SHAPED THE WAY IT IS
|
|
10
|
+
//
|
|
11
|
+
// A previous e-paper bring-up in this repo destroyed a panel by re-driving
|
|
12
|
+
// every pixel toward its target on every frame: pixels already AT their target
|
|
13
|
+
// kept receiving one-way pulses for hours, which is sustained saturation DC and
|
|
14
|
+
// the cardinal E-Ink sin. The structural fix is that a pixel must stop being
|
|
15
|
+
// driven the moment it reaches its target.
|
|
16
|
+
//
|
|
17
|
+
// Here that is not a check bolted onto the renderer — it falls out of the
|
|
18
|
+
// transition selector. Unchanged pixels emit NOP for every phase. Changed
|
|
19
|
+
// pixels run one bounded calibrated waveform toward white or toward one of the
|
|
20
|
+
// three ink levels, then stop.
|
|
21
|
+
//
|
|
22
|
+
// Deliberately NOT ported from the LilyGo driver: its `swept16` current-limiting
|
|
23
|
+
// (splitting a solid field into 16 interleaved passes). That mitigated a damaged
|
|
24
|
+
// VCOM plane on that specific unit. This board's power design drives full-screen
|
|
25
|
+
// solid fields safely — upstream PaperBoy's own image mode does exactly that on
|
|
26
|
+
// this hardware — so sweeping here would cost 16x scan time for no benefit.
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
#include "papers3_epd.h"
|
|
30
|
+
|
|
31
|
+
#include <string.h>
|
|
32
|
+
|
|
33
|
+
#include "driver/gpio.h"
|
|
34
|
+
#include "esp_heap_caps.h"
|
|
35
|
+
#include "esp_lcd_panel_io.h"
|
|
36
|
+
#include "esp_log.h"
|
|
37
|
+
#include "esp_timer.h"
|
|
38
|
+
#include "freertos/FreeRTOS.h"
|
|
39
|
+
#include "freertos/task.h"
|
|
40
|
+
#include "rom/ets_sys.h"
|
|
41
|
+
#include "soc/gpio_reg.h"
|
|
42
|
+
|
|
43
|
+
static const char *TAG = "papers3_epd";
|
|
44
|
+
|
|
45
|
+
// ---- Pin map -------------------------------------------------------------
|
|
46
|
+
// Verified against upstream PaperBoy running on this board (main/msg/msg.h).
|
|
47
|
+
#define EPD_PWR_EN_PIN 45
|
|
48
|
+
#define EPD_BST_EN_PIN 46
|
|
49
|
+
#define EPD_SDCE_PIN 13 /* source driver chip enable (i80 CS) */
|
|
50
|
+
#define EPD_SDLE_PIN 15 /* source driver latch enable */
|
|
51
|
+
#define EPD_SDCK_PIN 16 /* source driver clock (i80 WR) */
|
|
52
|
+
#define EPD_GDSP_PIN 17 /* gate driver start pulse */
|
|
53
|
+
#define EPD_GDCK_PIN 18 /* gate driver clock */
|
|
54
|
+
|
|
55
|
+
#define EPD_D0_PIN 6
|
|
56
|
+
#define EPD_D1_PIN 14
|
|
57
|
+
#define EPD_D2_PIN 7
|
|
58
|
+
#define EPD_D3_PIN 12
|
|
59
|
+
#define EPD_D4_PIN 9
|
|
60
|
+
#define EPD_D5_PIN 11
|
|
61
|
+
#define EPD_D6_PIN 8
|
|
62
|
+
#define EPD_D7_PIN 10
|
|
63
|
+
|
|
64
|
+
#define EPD_XCK 24000000
|
|
65
|
+
#define EPD_BUSW 8
|
|
66
|
+
#define EPD_LINE_PAD 16
|
|
67
|
+
|
|
68
|
+
// ---- Command encoding ----------------------------------------------------
|
|
69
|
+
#define CMD_NOP 0x0
|
|
70
|
+
#define CMD_DARK 0x1
|
|
71
|
+
#define CMD_LIGHT 0x2
|
|
72
|
+
#define CMD_BOTH 0x3
|
|
73
|
+
|
|
74
|
+
#define ROW_CMD_BYTES (PAPERS3_EPD_WIDTH / 4) /* 240 */
|
|
75
|
+
#define ROW_TOTAL (ROW_CMD_BYTES + EPD_LINE_PAD) /* 256 */
|
|
76
|
+
#define DRIVE_BYTES (ROW_CMD_BYTES * PAPERS3_EPD_HEIGHT)
|
|
77
|
+
|
|
78
|
+
#define ROW_ALL_DARK 0x55 /* four CMD_DARK */
|
|
79
|
+
#define ROW_ALL_LIGHT 0xaa /* four CMD_LIGHT */
|
|
80
|
+
|
|
81
|
+
// ---- Calibrated PaperS3 waveforms ---------------------------------------
|
|
82
|
+
// Ported from the PaperS3 preset used by CrossPoint's EPD_Painter driver. The
|
|
83
|
+
// crucial behavior is not merely these values: a non-white -> non-white change
|
|
84
|
+
// is first erased toward white, then painted from white on a second cycle.
|
|
85
|
+
// Treating the four panel states as a linear numeric distance made our software
|
|
86
|
+
// shadow diverge from the physical particles on every page turn.
|
|
87
|
+
//
|
|
88
|
+
// EPD_Painter is Apache-2.0: https://github.com/tonywestonuk/EPD_Painter
|
|
89
|
+
// CrossPoint PaperS3 port: https://github.com/juicecultus/crosspoint-reader-papers3
|
|
90
|
+
#define kHighWaveformFields 13
|
|
91
|
+
#define kFastWaveformFields 7
|
|
92
|
+
|
|
93
|
+
// Rows are light gray, dark gray, black. Commands are NOP/DARK/LIGHT/BOTH.
|
|
94
|
+
static const uint8_t kHighLighter[3][kHighWaveformFields] = {
|
|
95
|
+
{1, 3, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2},
|
|
96
|
+
{1, 3, 3, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2},
|
|
97
|
+
{2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
|
|
98
|
+
};
|
|
99
|
+
static const uint8_t kHighDarker[3][kHighWaveformFields] = {
|
|
100
|
+
// The stock PaperS3 preset makes both intermediate states too dark on our
|
|
101
|
+
// panel. Keep its bounded staged shape, but reduce the net dark drive:
|
|
102
|
+
// light gray gets 4 DARK / 8 LIGHT fields and dark gray inherits the old
|
|
103
|
+
// light-gray waveform (7 DARK / 5 LIGHT). Black remains unchanged below.
|
|
104
|
+
// This preserves two visible AA shades without weakening glyph stems.
|
|
105
|
+
{1, 3, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1},
|
|
106
|
+
{1, 3, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 1},
|
|
107
|
+
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
|
108
|
+
};
|
|
109
|
+
static const uint8_t kFastLighter[3][kFastWaveformFields] = {
|
|
110
|
+
{1, 2, 2, 2, 2, 2, 3},
|
|
111
|
+
{3, 2, 2, 2, 2, 2, 3},
|
|
112
|
+
{2, 2, 2, 2, 2, 2, 2},
|
|
113
|
+
};
|
|
114
|
+
static const uint8_t kFastDarker[3][kFastWaveformFields] = {
|
|
115
|
+
// Seven-field compression of the tuned HIGH gray states: the new ink
|
|
116
|
+
// reaches a useful density in roughly half the wall time while retaining
|
|
117
|
+
// two distinct AA shades. Solid black still receives all seven DARK fields.
|
|
118
|
+
{1, 3, 1, 2, 2, 2, 2},
|
|
119
|
+
{1, 3, 1, 1, 2, 2, 1},
|
|
120
|
+
{1, 1, 1, 1, 1, 1, 1},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// ---- Drive-duty safety ---------------------------------------------------
|
|
124
|
+
// A runaway caller (a render loop that refreshes every frame) is the failure
|
|
125
|
+
// mode that killed the previous panel. Cap sustained drive: past the budget we
|
|
126
|
+
// drop the rails and rest, which makes a runaway self-limiting instead of
|
|
127
|
+
// silently cooking the film.
|
|
128
|
+
#define kMaxFieldsPerMinute 1800
|
|
129
|
+
#define kRestMs 2000
|
|
130
|
+
|
|
131
|
+
static volatile bool dma_done = false;
|
|
132
|
+
static esp_lcd_i80_bus_handle_t i80_bus = NULL;
|
|
133
|
+
static esp_lcd_panel_io_handle_t panel_io = NULL;
|
|
134
|
+
|
|
135
|
+
// Ping-pong buffers for the per-row computed (grayscale) path.
|
|
136
|
+
static uint8_t *dma_buf[2];
|
|
137
|
+
static int dma_cur;
|
|
138
|
+
// Immutable pre-built rows for the constant-command paths. These are never
|
|
139
|
+
// written after init, so re-sending one while the previous transfer of the SAME
|
|
140
|
+
// buffer is still in flight is harmless — which a memset-per-row would not be.
|
|
141
|
+
static uint8_t *row_nop;
|
|
142
|
+
static uint8_t *row_dark;
|
|
143
|
+
static uint8_t *row_light;
|
|
144
|
+
// EPD_Painter-style packed drive planes, four 2-bit physical states per byte.
|
|
145
|
+
// Preparing these once per image keeps the timed row scan to two byte lookups
|
|
146
|
+
// instead of re-quantizing and branching on all four pixels in every pass.
|
|
147
|
+
static uint8_t *drive_stage0_darker;
|
|
148
|
+
static uint8_t *drive_stage0_lighter;
|
|
149
|
+
static uint8_t *drive_stage1_darker;
|
|
150
|
+
// What is currently ON THE GLASS, GRAY4 packed exactly like the source
|
|
151
|
+
// framebuffer. Every drive is a delta against this, which is what lets a
|
|
152
|
+
// partial update erase instead of only adding ink. Lives in PSRAM (253 KB).
|
|
153
|
+
static uint8_t *shadow;
|
|
154
|
+
// Is `shadow` actually known to match the glass? FALSE after boot: e-paper
|
|
155
|
+
// RETAINS its last image across power loss and reflashing, so at startup the
|
|
156
|
+
// panel is showing whatever the previous firmware left there while `shadow`
|
|
157
|
+
// says "white". Drawing a delta against that lie leaves the old image on screen
|
|
158
|
+
// forever — every pixel where old and new agree computes zero delta and NOPs,
|
|
159
|
+
// so only the differing pixels get painted, on top of stale content.
|
|
160
|
+
//
|
|
161
|
+
// The shadow only becomes trustworthy after a real flash to white has actually
|
|
162
|
+
// been driven onto the glass.
|
|
163
|
+
static bool shadow_valid;
|
|
164
|
+
static bool powered;
|
|
165
|
+
|
|
166
|
+
static uint32_t total_fields;
|
|
167
|
+
static uint32_t window_fields;
|
|
168
|
+
static int64_t window_start_us;
|
|
169
|
+
static int64_t field_start_us;
|
|
170
|
+
static int64_t field_us_accum;
|
|
171
|
+
static int field_us_count;
|
|
172
|
+
|
|
173
|
+
static bool dma_done_cb(esp_lcd_panel_io_handle_t io, esp_lcd_panel_io_event_data_t *ev, void *ctx)
|
|
174
|
+
{
|
|
175
|
+
(void)io;
|
|
176
|
+
(void)ev;
|
|
177
|
+
(void)ctx;
|
|
178
|
+
dma_done = true;
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ---- Low-level scan ------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
// Kept as gpio_set_level() to match upstream PaperBoy exactly.
|
|
185
|
+
//
|
|
186
|
+
// These were briefly swapped for direct GPIO_OUT_W1TS/W1TC register stores on
|
|
187
|
+
// the theory that SDLE (the source-driver latch) needs a wide pulse and that the
|
|
188
|
+
// HAL call's ~1us cost was providing it. MEASURED: field time was 20.4us/field
|
|
189
|
+
// with raw stores and 20.9us/field with gpio_set_level — no meaningful
|
|
190
|
+
// difference, so the HAL call is not the pulse width and the register write was
|
|
191
|
+
// not a speedup either. Reverted for fidelity to the reference implementation,
|
|
192
|
+
// not because it was proven harmful. If you optimise the row loop, measure the
|
|
193
|
+
// field time before AND after; do not infer it from present totals.
|
|
194
|
+
static void IRAM_ATTR send_row(const uint8_t *data)
|
|
195
|
+
{
|
|
196
|
+
while (!dma_done)
|
|
197
|
+
; // Spin: the gate is open, yielding here would stretch the row.
|
|
198
|
+
|
|
199
|
+
gpio_set_level(EPD_GDCK_PIN, 0);
|
|
200
|
+
gpio_set_level(EPD_SDLE_PIN, 1);
|
|
201
|
+
gpio_set_level(EPD_SDLE_PIN, 0);
|
|
202
|
+
gpio_set_level(EPD_GDCK_PIN, 1);
|
|
203
|
+
|
|
204
|
+
dma_done = false;
|
|
205
|
+
esp_lcd_panel_io_tx_color(panel_io, -1, data, ROW_TOTAL);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Gate-driver start-of-frame sequence. Timings are upstream's; they are not
|
|
209
|
+
// arbitrary — the panel's shift register needs these exact pulse widths.
|
|
210
|
+
static void IRAM_ATTR frame_start(void)
|
|
211
|
+
{
|
|
212
|
+
field_start_us = esp_timer_get_time();
|
|
213
|
+
gpio_set_level(EPD_GDCK_PIN, 1);
|
|
214
|
+
ets_delay_us(7);
|
|
215
|
+
gpio_set_level(EPD_GDSP_PIN, 0);
|
|
216
|
+
ets_delay_us(10);
|
|
217
|
+
gpio_set_level(EPD_GDCK_PIN, 0);
|
|
218
|
+
gpio_set_level(EPD_GDCK_PIN, 1);
|
|
219
|
+
ets_delay_us(8);
|
|
220
|
+
gpio_set_level(EPD_GDSP_PIN, 1);
|
|
221
|
+
ets_delay_us(10);
|
|
222
|
+
gpio_set_level(EPD_GDCK_PIN, 0);
|
|
223
|
+
for (int i = 0; i < 2; i++) {
|
|
224
|
+
gpio_set_level(EPD_GDCK_PIN, 1);
|
|
225
|
+
gpio_set_level(EPD_GDCK_PIN, 0);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Flush the scan pipeline: the last real row has only been latched once.
|
|
230
|
+
static void IRAM_ATTR frame_end(void)
|
|
231
|
+
{
|
|
232
|
+
send_row(row_nop);
|
|
233
|
+
while (!dma_done)
|
|
234
|
+
;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Charge the duty budget for one field, resting the panel if it is exhausted.
|
|
238
|
+
static void account_field(void)
|
|
239
|
+
{
|
|
240
|
+
const int64_t now = esp_timer_get_time();
|
|
241
|
+
|
|
242
|
+
// Field-time telemetry. The scan floor (a field of constant rows, no
|
|
243
|
+
// per-pixel CPU) is the hard ceiling on any animation rate, so measure it
|
|
244
|
+
// rather than inferring it from present totals.
|
|
245
|
+
if (field_start_us) {
|
|
246
|
+
field_us_accum += now - field_start_us;
|
|
247
|
+
if (++field_us_count >= 60) {
|
|
248
|
+
ESP_LOGI(TAG, "field time avg %lldus over %d fields",
|
|
249
|
+
(long long)(field_us_accum / field_us_count), field_us_count);
|
|
250
|
+
field_us_accum = 0;
|
|
251
|
+
field_us_count = 0;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (now - window_start_us >= 60 * 1000 * 1000) {
|
|
255
|
+
window_start_us = now;
|
|
256
|
+
window_fields = 0;
|
|
257
|
+
}
|
|
258
|
+
total_fields++;
|
|
259
|
+
if (++window_fields > kMaxFieldsPerMinute) {
|
|
260
|
+
ESP_LOGW(TAG, "drive duty budget exhausted (%u fields/min) — resting rails off", (unsigned)window_fields);
|
|
261
|
+
papers3_epd_power_off();
|
|
262
|
+
vTaskDelay(pdMS_TO_TICKS(kRestMs));
|
|
263
|
+
papers3_epd_power_on();
|
|
264
|
+
window_start_us = esp_timer_get_time();
|
|
265
|
+
window_fields = 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// One field driving a single constant command, restricted to rows [y0, y1].
|
|
270
|
+
// Rows outside the band get NOP so the gate driver still advances.
|
|
271
|
+
static void field_solid_band(const uint8_t *solid_row, int y0, int y1)
|
|
272
|
+
{
|
|
273
|
+
frame_start();
|
|
274
|
+
for (int y = 0; y < PAPERS3_EPD_HEIGHT; y++)
|
|
275
|
+
send_row((y >= y0 && y <= y1) ? solid_row : row_nop);
|
|
276
|
+
frame_end();
|
|
277
|
+
account_field();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// CrossPoint/EPD_Painter's calibrated full clear: 6 dark, 2 light, 4 dark,
|
|
281
|
+
// 8 light. It is DC-balanced (10 fields in each direction) and ends white.
|
|
282
|
+
static void flash_band(int y0, int y1)
|
|
283
|
+
{
|
|
284
|
+
for (int f = 0; f < 6; f++) field_solid_band(row_dark, y0, y1);
|
|
285
|
+
for (int f = 0; f < 2; f++) field_solid_band(row_light, y0, y1);
|
|
286
|
+
for (int f = 0; f < 4; f++) field_solid_band(row_dark, y0, y1);
|
|
287
|
+
for (int f = 0; f < 8; f++) field_solid_band(row_light, y0, y1);
|
|
288
|
+
if (shadow)
|
|
289
|
+
memset(shadow + (size_t)y0 * PAPERS3_EPD_GRAY4_STRIDE, 0xff,
|
|
290
|
+
(size_t)(y1 - y0 + 1) * PAPERS3_EPD_GRAY4_STRIDE);
|
|
291
|
+
// The glass has now genuinely been driven white, so the shadow is true.
|
|
292
|
+
if (y0 == 0 && y1 == PAPERS3_EPD_HEIGHT - 1) shadow_valid = true;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Guarantee the shadow matches the glass before any delta drive. On the first
|
|
296
|
+
// draw after boot this costs one full white flash; afterwards it is free.
|
|
297
|
+
static void ensure_shadow_valid(void)
|
|
298
|
+
{
|
|
299
|
+
if (shadow_valid) return;
|
|
300
|
+
ESP_LOGI(TAG, "shadow unknown (panel retains a previous image) — flashing to a known white first");
|
|
301
|
+
flash_band(0, PAPERS3_EPD_HEIGHT - 1);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// The band now shows `fb`.
|
|
305
|
+
static void shadow_commit(const uint8_t *fb, int y0, int y1)
|
|
306
|
+
{
|
|
307
|
+
if (!shadow) return;
|
|
308
|
+
const size_t off = (size_t)y0 * PAPERS3_EPD_GRAY4_STRIDE;
|
|
309
|
+
memcpy(shadow + off, fb + off, (size_t)(y1 - y0 + 1) * PAPERS3_EPD_GRAY4_STRIDE);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Quantize the 16-level canvas into EPD_Painter's four stable physical states:
|
|
313
|
+
// 0=white, 1=light gray, 2=dark gray, 3=black. The deliberate boundary between
|
|
314
|
+
// GRAY4 7 and 6 preserves the e-reader's baked AA edge pair (7=light, 5=dark).
|
|
315
|
+
static inline uint8_t panel_level(uint8_t gray4)
|
|
316
|
+
{
|
|
317
|
+
gray4 &= 0x0f;
|
|
318
|
+
if (gray4 >= 14) return 0;
|
|
319
|
+
if (gray4 >= 7) return 1;
|
|
320
|
+
if (gray4 >= 2) return 2;
|
|
321
|
+
return 3;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// stage 0 merges two pixel-disjoint directions into one row transmission:
|
|
325
|
+
// new ink on white uses the darker waveform, while changed existing ink uses
|
|
326
|
+
// the lighter waveform and lands at white. stage 1 paints the final level for
|
|
327
|
+
// non-white -> different-non-white transitions. This is EPD_Painter's two-cycle
|
|
328
|
+
// transition model expressed directly over our immutable GRAY4 snapshot.
|
|
329
|
+
static inline void prepare_pixel_transition(
|
|
330
|
+
uint8_t target, uint8_t current, int shift,
|
|
331
|
+
uint8_t *stage0Darker, uint8_t *stage0Lighter, uint8_t *stage1Darker)
|
|
332
|
+
{
|
|
333
|
+
target = panel_level(target);
|
|
334
|
+
current = panel_level(current);
|
|
335
|
+
if (target == current) return;
|
|
336
|
+
if (current == 0)
|
|
337
|
+
*stage0Darker |= (uint8_t)(target << shift);
|
|
338
|
+
else
|
|
339
|
+
*stage0Lighter |= (uint8_t)(current << shift);
|
|
340
|
+
if (current != 0 && target != 0)
|
|
341
|
+
*stage1Darker |= (uint8_t)(target << shift);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
static void prepare_transition_planes(const uint8_t *fb, int y0, int y1, bool *stage0Work, bool *stage1Work)
|
|
345
|
+
{
|
|
346
|
+
*stage0Work = false;
|
|
347
|
+
*stage1Work = false;
|
|
348
|
+
memset(drive_stage0_darker, 0, DRIVE_BYTES);
|
|
349
|
+
memset(drive_stage0_lighter, 0, DRIVE_BYTES);
|
|
350
|
+
memset(drive_stage1_darker, 0, DRIVE_BYTES);
|
|
351
|
+
for (int y = y0; y <= y1; ++y) {
|
|
352
|
+
const size_t srcOff = (size_t)y * PAPERS3_EPD_GRAY4_STRIDE;
|
|
353
|
+
const size_t driveOff = (size_t)y * ROW_CMD_BYTES;
|
|
354
|
+
for (int b = 0; b < ROW_CMD_BYTES; ++b) {
|
|
355
|
+
const uint8_t t0 = fb[srcOff + 2 * b], t1 = fb[srcOff + 2 * b + 1];
|
|
356
|
+
const uint8_t c0 = shadow[srcOff + 2 * b], c1 = shadow[srcOff + 2 * b + 1];
|
|
357
|
+
uint8_t d0 = 0, l0 = 0, d1 = 0;
|
|
358
|
+
prepare_pixel_transition(t0 >> 4, c0 >> 4, 6, &d0, &l0, &d1);
|
|
359
|
+
prepare_pixel_transition(t0, c0, 4, &d0, &l0, &d1);
|
|
360
|
+
prepare_pixel_transition(t1 >> 4, c1 >> 4, 2, &d0, &l0, &d1);
|
|
361
|
+
prepare_pixel_transition(t1, c1, 0, &d0, &l0, &d1);
|
|
362
|
+
drive_stage0_darker[driveOff + b] = d0;
|
|
363
|
+
drive_stage0_lighter[driveOff + b] = l0;
|
|
364
|
+
drive_stage1_darker[driveOff + b] = d1;
|
|
365
|
+
*stage0Work |= (d0 | l0) != 0;
|
|
366
|
+
*stage1Work |= d1 != 0;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
static void build_waveform_map(uint8_t map[256], const uint8_t *waveform, int waveformFields, int pass)
|
|
372
|
+
{
|
|
373
|
+
for (int packed = 0; packed < 256; ++packed) {
|
|
374
|
+
uint8_t out = 0;
|
|
375
|
+
for (int shift = 6; shift >= 0; shift -= 2) {
|
|
376
|
+
const uint8_t state = (uint8_t)((packed >> shift) & 3);
|
|
377
|
+
if (state != 0)
|
|
378
|
+
out |= (uint8_t)(waveform[(state - 1) * waveformFields + pass] << shift);
|
|
379
|
+
}
|
|
380
|
+
map[packed] = out;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
static void field_transition(
|
|
385
|
+
int y0, int y1, int stage, int pass,
|
|
386
|
+
const uint8_t *lighter, const uint8_t *darker, int waveformFields)
|
|
387
|
+
{
|
|
388
|
+
uint8_t lighterMap[256], darkerMap[256];
|
|
389
|
+
build_waveform_map(lighterMap, lighter, waveformFields, pass);
|
|
390
|
+
build_waveform_map(darkerMap, darker, waveformFields, pass);
|
|
391
|
+
frame_start();
|
|
392
|
+
for (int y = 0; y < PAPERS3_EPD_HEIGHT; ++y) {
|
|
393
|
+
if (y < y0 || y > y1) {
|
|
394
|
+
send_row(row_nop);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
uint8_t *out = dma_buf[dma_cur];
|
|
398
|
+
const size_t rowOff = (size_t)y * ROW_CMD_BYTES;
|
|
399
|
+
const uint8_t *darkPlane = (stage == 0 ? drive_stage0_darker : drive_stage1_darker) + rowOff;
|
|
400
|
+
const uint8_t *lightPlane = drive_stage0_lighter + rowOff;
|
|
401
|
+
for (int b = 0; b < ROW_CMD_BYTES; ++b) {
|
|
402
|
+
out[b] = darkerMap[darkPlane[b]] |
|
|
403
|
+
(stage == 0 ? lighterMap[lightPlane[b]] : 0);
|
|
404
|
+
}
|
|
405
|
+
send_row(out);
|
|
406
|
+
dma_cur = !dma_cur;
|
|
407
|
+
}
|
|
408
|
+
frame_end();
|
|
409
|
+
account_field();
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
static void draw_calibrated(
|
|
413
|
+
const uint8_t *fb, int y0, int y1,
|
|
414
|
+
const uint8_t *lighter, const uint8_t *darker, int waveformFields, int holdMs)
|
|
415
|
+
{
|
|
416
|
+
if (!shadow || !drive_stage0_darker || !drive_stage0_lighter || !drive_stage1_darker) return;
|
|
417
|
+
bool stage0Work = false, stage1Work = false;
|
|
418
|
+
// Wall-time breakdown for one draw. The rolling telemetry in account_field()
|
|
419
|
+
// gives the average field time; this gives the OTHER half — how much of a draw
|
|
420
|
+
// is CPU transition-plane prep (PSRAM reads + quantize) versus the i80 field
|
|
421
|
+
// scan, and how many fields the draw actually drove. That split is what tells
|
|
422
|
+
// us whether the scan-loop rewrite (RMT gate clock / RGB-mode continuous scan)
|
|
423
|
+
// would move the needle, or whether the cost is already CPU-side prep.
|
|
424
|
+
const int64_t prep_start_us = esp_timer_get_time();
|
|
425
|
+
prepare_transition_planes(fb, y0, y1, &stage0Work, &stage1Work);
|
|
426
|
+
const int64_t scan_start_us = esp_timer_get_time();
|
|
427
|
+
const uint32_t fields_before = total_fields;
|
|
428
|
+
for (int stage = 0; stage < 2; ++stage) {
|
|
429
|
+
if ((stage == 0 && !stage0Work) || (stage == 1 && !stage1Work)) continue;
|
|
430
|
+
for (int pass = 0; pass < waveformFields; ++pass) {
|
|
431
|
+
field_transition(y0, y1, stage, pass, lighter, darker, waveformFields);
|
|
432
|
+
if (holdMs > 0) vTaskDelay(pdMS_TO_TICKS(holdMs));
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const int64_t scan_end_us = esp_timer_get_time();
|
|
436
|
+
ESP_LOGI(TAG, "draw %d rows: prep %lldms, scan %lldms over %u fields",
|
|
437
|
+
y1 - y0 + 1,
|
|
438
|
+
(long long)((scan_start_us - prep_start_us) / 1000),
|
|
439
|
+
(long long)((scan_end_us - scan_start_us) / 1000),
|
|
440
|
+
(unsigned)(total_fields - fields_before));
|
|
441
|
+
shadow_commit(fb, y0, y1);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// ---- Public API ----------------------------------------------------------
|
|
445
|
+
|
|
446
|
+
void papers3_epd_init(void)
|
|
447
|
+
{
|
|
448
|
+
if (panel_io) return;
|
|
449
|
+
|
|
450
|
+
gpio_config_t cfg = {
|
|
451
|
+
.mode = GPIO_MODE_OUTPUT,
|
|
452
|
+
.pull_up_en = GPIO_PULLUP_DISABLE,
|
|
453
|
+
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
|
454
|
+
.intr_type = GPIO_INTR_DISABLE,
|
|
455
|
+
};
|
|
456
|
+
cfg.pin_bit_mask = (1ull << EPD_PWR_EN_PIN) | (1ull << EPD_BST_EN_PIN) | (1ull << EPD_SDCE_PIN) |
|
|
457
|
+
(1ull << EPD_SDLE_PIN) | (1ull << EPD_SDCK_PIN) | (1ull << EPD_GDSP_PIN) |
|
|
458
|
+
(1ull << EPD_GDCK_PIN);
|
|
459
|
+
ESP_ERROR_CHECK(gpio_config(&cfg));
|
|
460
|
+
|
|
461
|
+
esp_lcd_i80_bus_config_t bus_cfg = {
|
|
462
|
+
// The panel has no data/command line, but esp_lcd_new_i80_bus REQUIRES a
|
|
463
|
+
// DC pin: passing -1 makes it fail with "configure GPIO failed" and the
|
|
464
|
+
// board boot-loops. Upstream PaperBoy's trick is an out-of-range GPIO
|
|
465
|
+
// (49 > the S3's max of 48) — the bus accepts the config and no real pin
|
|
466
|
+
// is ever driven. The cost is one harmless "gpio_func_sel: GPIO number
|
|
467
|
+
// error" line at boot. Do not "clean this up" to -1; it was tried.
|
|
468
|
+
.dc_gpio_num = (gpio_num_t)49,
|
|
469
|
+
.wr_gpio_num = (gpio_num_t)EPD_SDCK_PIN,
|
|
470
|
+
.clk_src = LCD_CLK_SRC_PLL160M,
|
|
471
|
+
.data_gpio_nums = {
|
|
472
|
+
(gpio_num_t)EPD_D0_PIN, (gpio_num_t)EPD_D1_PIN,
|
|
473
|
+
(gpio_num_t)EPD_D2_PIN, (gpio_num_t)EPD_D3_PIN,
|
|
474
|
+
(gpio_num_t)EPD_D4_PIN, (gpio_num_t)EPD_D5_PIN,
|
|
475
|
+
(gpio_num_t)EPD_D6_PIN, (gpio_num_t)EPD_D7_PIN,
|
|
476
|
+
},
|
|
477
|
+
.bus_width = EPD_BUSW,
|
|
478
|
+
.max_transfer_bytes = ROW_TOTAL + 16,
|
|
479
|
+
.dma_burst_size = 32,
|
|
480
|
+
};
|
|
481
|
+
ESP_ERROR_CHECK(esp_lcd_new_i80_bus(&bus_cfg, &i80_bus));
|
|
482
|
+
|
|
483
|
+
esp_lcd_panel_io_i80_config_t io_cfg = {
|
|
484
|
+
.cs_gpio_num = (gpio_num_t)EPD_SDCE_PIN,
|
|
485
|
+
.pclk_hz = EPD_XCK,
|
|
486
|
+
.trans_queue_depth = 4,
|
|
487
|
+
.on_color_trans_done = dma_done_cb,
|
|
488
|
+
.user_ctx = NULL,
|
|
489
|
+
.lcd_cmd_bits = 8,
|
|
490
|
+
.lcd_param_bits = 8,
|
|
491
|
+
.dc_levels = {
|
|
492
|
+
.dc_idle_level = 0,
|
|
493
|
+
.dc_cmd_level = 0,
|
|
494
|
+
.dc_dummy_level = 0,
|
|
495
|
+
.dc_data_level = 1,
|
|
496
|
+
},
|
|
497
|
+
};
|
|
498
|
+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i80(i80_bus, &io_cfg, &panel_io));
|
|
499
|
+
|
|
500
|
+
uint8_t **rows[5] = {&dma_buf[0], &dma_buf[1], &row_nop, &row_dark, &row_light};
|
|
501
|
+
for (int i = 0; i < 5; i++) {
|
|
502
|
+
*rows[i] = (uint8_t *)heap_caps_aligned_alloc(16, ROW_TOTAL + 16, MALLOC_CAP_DMA);
|
|
503
|
+
if (!*rows[i]) {
|
|
504
|
+
ESP_LOGE(TAG, "DMA row buffer allocation failed");
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
// Pad bytes past the panel's 960 pixels stay NOP for every row, always.
|
|
508
|
+
memset(*rows[i], 0, ROW_TOTAL + 16);
|
|
509
|
+
}
|
|
510
|
+
memset(row_dark, ROW_ALL_DARK, ROW_CMD_BYTES);
|
|
511
|
+
memset(row_light, ROW_ALL_LIGHT, ROW_CMD_BYTES);
|
|
512
|
+
|
|
513
|
+
// Shadow of the glass. Nothing has been drawn yet and the first thing every
|
|
514
|
+
// caller does is clear to white, so start it white (GRAY4 15 = 0xff).
|
|
515
|
+
shadow = (uint8_t *)heap_caps_malloc(PAPERS3_EPD_GRAY4_BYTES, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
516
|
+
if (!shadow) {
|
|
517
|
+
ESP_LOGE(TAG, "shadow buffer allocation failed (PSRAM required)");
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
memset(shadow, 0xff, PAPERS3_EPD_GRAY4_BYTES);
|
|
521
|
+
|
|
522
|
+
drive_stage0_darker = (uint8_t *)heap_caps_malloc(DRIVE_BYTES, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
523
|
+
drive_stage0_lighter = (uint8_t *)heap_caps_malloc(DRIVE_BYTES, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
524
|
+
drive_stage1_darker = (uint8_t *)heap_caps_malloc(DRIVE_BYTES, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
|
|
525
|
+
if (!drive_stage0_darker || !drive_stage0_lighter || !drive_stage1_darker) {
|
|
526
|
+
ESP_LOGE(TAG, "transition plane allocation failed (PSRAM required)");
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
dma_done = true;
|
|
531
|
+
dma_cur = 0;
|
|
532
|
+
window_start_us = esp_timer_get_time();
|
|
533
|
+
ESP_LOGI(TAG, "init ok: %dx%d, %d bytes/row, %d Hz", PAPERS3_EPD_WIDTH, PAPERS3_EPD_HEIGHT,
|
|
534
|
+
ROW_TOTAL, EPD_XCK);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
void papers3_epd_power_on(void)
|
|
538
|
+
{
|
|
539
|
+
if (powered) return;
|
|
540
|
+
gpio_set_level(EPD_PWR_EN_PIN, 1);
|
|
541
|
+
ets_delay_us(100);
|
|
542
|
+
gpio_set_level(EPD_BST_EN_PIN, 1);
|
|
543
|
+
ets_delay_us(100);
|
|
544
|
+
gpio_set_level(EPD_GDCK_PIN, 1);
|
|
545
|
+
gpio_set_level(EPD_GDSP_PIN, 1);
|
|
546
|
+
powered = true;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
void papers3_epd_power_off(void)
|
|
550
|
+
{
|
|
551
|
+
if (!powered) return;
|
|
552
|
+
gpio_set_level(EPD_GDCK_PIN, 0);
|
|
553
|
+
gpio_set_level(EPD_GDSP_PIN, 0);
|
|
554
|
+
gpio_set_level(EPD_BST_EN_PIN, 0);
|
|
555
|
+
ets_delay_us(100);
|
|
556
|
+
gpio_set_level(EPD_PWR_EN_PIN, 0);
|
|
557
|
+
ets_delay_us(100);
|
|
558
|
+
powered = false;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
void papers3_epd_clear(void)
|
|
562
|
+
{
|
|
563
|
+
if (!panel_io) return;
|
|
564
|
+
const bool was_powered = powered;
|
|
565
|
+
papers3_epd_power_on();
|
|
566
|
+
|
|
567
|
+
flash_band(0, PAPERS3_EPD_HEIGHT - 1);
|
|
568
|
+
|
|
569
|
+
if (!was_powered) papers3_epd_power_off();
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Deghosting/recovery treatment, ported from the LilyGo T5 panel post-mortem
|
|
573
|
+
// (same ED047TC1 film chemistry; see that target's safety notes). Alternates
|
|
574
|
+
// balanced deep drive with rails-off zero-bias rest — trapped charge drains
|
|
575
|
+
// on the minutes timescale under zero bias, so the rest phases matter as much
|
|
576
|
+
// as the drive. Hard session cap: parks with rails off after 30 minutes;
|
|
577
|
+
// reboot/power-cycle for another session. The driver's own duty budget
|
|
578
|
+
// (account_field) inserts additional micro-rests throughout. Never returns.
|
|
579
|
+
void papers3_epd_treatment_forever(void)
|
|
580
|
+
{
|
|
581
|
+
if (!panel_io) return;
|
|
582
|
+
const int64_t session_start = esp_timer_get_time();
|
|
583
|
+
int round = 0;
|
|
584
|
+
for (;;) {
|
|
585
|
+
if (esp_timer_get_time() - session_start > 30LL * 60 * 1000 * 1000) {
|
|
586
|
+
papers3_epd_power_off();
|
|
587
|
+
ESP_LOGW(TAG, "treatment: 30-minute session cap — parked (rails off); reboot for another session");
|
|
588
|
+
for (;;) vTaskDelay(pdMS_TO_TICKS(60000));
|
|
589
|
+
}
|
|
590
|
+
round++;
|
|
591
|
+
ESP_LOGI(TAG, "treatment round %d: ~4 min drive, then 3 min rails-off rest", round);
|
|
592
|
+
papers3_epd_power_on();
|
|
593
|
+
for (int c = 0; c < 10; c++) {
|
|
594
|
+
// Deep balanced cycle: saturating pushes both directions plus the
|
|
595
|
+
// panel's own calibrated flash (6d/2l/4d/8l, DC-balanced).
|
|
596
|
+
for (int f = 0; f < 10; f++) field_solid_band(row_dark, 0, PAPERS3_EPD_HEIGHT - 1);
|
|
597
|
+
vTaskDelay(pdMS_TO_TICKS(100));
|
|
598
|
+
for (int f = 0; f < 10; f++) field_solid_band(row_light, 0, PAPERS3_EPD_HEIGHT - 1);
|
|
599
|
+
vTaskDelay(pdMS_TO_TICKS(100));
|
|
600
|
+
flash_band(0, PAPERS3_EPD_HEIGHT - 1);
|
|
601
|
+
}
|
|
602
|
+
papers3_epd_power_off();
|
|
603
|
+
ESP_LOGI(TAG, "treatment round %d: resting (zero bias, 3 min)...", round);
|
|
604
|
+
vTaskDelay(pdMS_TO_TICKS(180 * 1000));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
void papers3_epd_draw_gray4(const uint8_t *fb)
|
|
609
|
+
{
|
|
610
|
+
if (!panel_io || !fb) return;
|
|
611
|
+
const bool was_powered = powered;
|
|
612
|
+
papers3_epd_power_on();
|
|
613
|
+
ensure_shadow_valid();
|
|
614
|
+
|
|
615
|
+
// Our measured i80 field is ~21 ms. That already matches EPD_Painter's
|
|
616
|
+
// faster field scan plus its 8 ms QUALITY_HIGH hold, so adding another
|
|
617
|
+
// delay here would over-dose every pulse.
|
|
618
|
+
draw_calibrated(fb, 0, PAPERS3_EPD_HEIGHT - 1,
|
|
619
|
+
&kHighLighter[0][0], &kHighDarker[0][0],
|
|
620
|
+
kHighWaveformFields, 0);
|
|
621
|
+
|
|
622
|
+
if (!was_powered) papers3_epd_power_off();
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
void papers3_epd_draw_fast_gray4(const uint8_t *fb)
|
|
626
|
+
{
|
|
627
|
+
if (!panel_io || !fb) return;
|
|
628
|
+
const bool was_powered = powered;
|
|
629
|
+
papers3_epd_power_on();
|
|
630
|
+
ensure_shadow_valid();
|
|
631
|
+
|
|
632
|
+
draw_calibrated(fb, 0, PAPERS3_EPD_HEIGHT - 1,
|
|
633
|
+
&kFastLighter[0][0], &kFastDarker[0][0],
|
|
634
|
+
kFastWaveformFields, 0);
|
|
635
|
+
|
|
636
|
+
if (!was_powered) papers3_epd_power_off();
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
void papers3_epd_refresh(const uint8_t *fb)
|
|
640
|
+
{
|
|
641
|
+
papers3_epd_refresh_region(fb, 0, PAPERS3_EPD_HEIGHT - 1);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
void papers3_epd_refresh_region(const uint8_t *fb, int y0, int y1)
|
|
645
|
+
{
|
|
646
|
+
if (!panel_io || !fb) return;
|
|
647
|
+
if (y0 < 0) y0 = 0;
|
|
648
|
+
if (y1 > PAPERS3_EPD_HEIGHT - 1) y1 = PAPERS3_EPD_HEIGHT - 1;
|
|
649
|
+
if (y0 > y1) return;
|
|
650
|
+
|
|
651
|
+
const bool was_powered = powered;
|
|
652
|
+
papers3_epd_power_on();
|
|
653
|
+
// A band flash only makes the band trustworthy. If the whole panel is still
|
|
654
|
+
// unknown (first draw after boot), clear all of it first — otherwise the
|
|
655
|
+
// rows outside the band keep whatever the previous firmware left there.
|
|
656
|
+
ensure_shadow_valid();
|
|
657
|
+
|
|
658
|
+
// Flash the band back to a known white, then paint it. Both phases scan the
|
|
659
|
+
// whole panel; only the band receives non-NOP commands.
|
|
660
|
+
flash_band(y0, y1);
|
|
661
|
+
draw_calibrated(fb, y0, y1,
|
|
662
|
+
&kHighLighter[0][0], &kHighDarker[0][0],
|
|
663
|
+
kHighWaveformFields, 0);
|
|
664
|
+
|
|
665
|
+
if (!was_powered) papers3_epd_power_off();
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
uint32_t papers3_epd_field_count(void)
|
|
669
|
+
{
|
|
670
|
+
return total_fields;
|
|
671
|
+
}
|