@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,1114 @@
|
|
|
1
|
+
/******************************************************************************/
|
|
2
|
+
/*** include files ***/
|
|
3
|
+
/******************************************************************************/
|
|
4
|
+
|
|
5
|
+
#include "epd_driver.h"
|
|
6
|
+
#include "ed047tc1.h"
|
|
7
|
+
|
|
8
|
+
#include <freertos/FreeRTOS.h>
|
|
9
|
+
#include <freertos/queue.h>
|
|
10
|
+
#include <freertos/semphr.h>
|
|
11
|
+
#include <freertos/task.h>
|
|
12
|
+
|
|
13
|
+
#include <esp_assert.h>
|
|
14
|
+
#include <esp_heap_caps.h>
|
|
15
|
+
#include <esp_log.h>
|
|
16
|
+
#include <esp_types.h>
|
|
17
|
+
#include <xtensa/core-macros.h>
|
|
18
|
+
|
|
19
|
+
#include <string.h>
|
|
20
|
+
|
|
21
|
+
#if ESP_IDF_VERSION_MAJOR >= 5 // IDF 5+
|
|
22
|
+
#include <math.h>
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
/******************************************************************************/
|
|
26
|
+
/*** macro definitions ***/
|
|
27
|
+
/******************************************************************************/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @brief number of bytes needed for one line of EPD pixel data.
|
|
31
|
+
*/
|
|
32
|
+
#define EPD_LINE_BYTES EPD_WIDTH / 4
|
|
33
|
+
|
|
34
|
+
#define CLEAR_BYTE 0B10101010
|
|
35
|
+
#define DARK_BYTE 0B01010101
|
|
36
|
+
|
|
37
|
+
#ifndef _swap_int
|
|
38
|
+
#define _swap_int(a, b) \
|
|
39
|
+
{ \
|
|
40
|
+
int32_t t = a; \
|
|
41
|
+
a = b; \
|
|
42
|
+
b = t; \
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
/******************************************************************************/
|
|
47
|
+
/*** type definitions ***/
|
|
48
|
+
/******************************************************************************/
|
|
49
|
+
|
|
50
|
+
typedef struct
|
|
51
|
+
{
|
|
52
|
+
uint8_t *data_ptr;
|
|
53
|
+
SemaphoreHandle_t done_smphr;
|
|
54
|
+
Rect_t area;
|
|
55
|
+
int32_t frame;
|
|
56
|
+
DrawMode_t mode;
|
|
57
|
+
} OutputParams;
|
|
58
|
+
|
|
59
|
+
/******************************************************************************/
|
|
60
|
+
/*** local function prototypes ***/
|
|
61
|
+
/******************************************************************************/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @brief Reorder the output buffer to account for I2S FIFO order.
|
|
65
|
+
*/
|
|
66
|
+
static void reorder_line_buffer(uint32_t *line_data);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @brief output a row to the display.
|
|
70
|
+
*/
|
|
71
|
+
static void write_row(uint32_t output_time_dus);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @brief skip a display row
|
|
75
|
+
*/
|
|
76
|
+
static void skip_row(uint8_t pipeline_finish_time);
|
|
77
|
+
|
|
78
|
+
static void IRAM_ATTR reset_lut(uint8_t *lut_mem, DrawMode_t mode);
|
|
79
|
+
|
|
80
|
+
static void IRAM_ATTR update_LUT(uint8_t *lut_mem, uint8_t k, DrawMode_t mode);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @brief bit-shift a buffer `shift` <= 7 bits to the right.
|
|
84
|
+
*/
|
|
85
|
+
static void IRAM_ATTR bit_shift_buffer_right(uint8_t *buf, uint32_t len, int32_t shift);
|
|
86
|
+
|
|
87
|
+
static void IRAM_ATTR nibble_shift_buffer_right(uint8_t *buf, uint32_t len);
|
|
88
|
+
|
|
89
|
+
static void IRAM_ATTR provide_out(OutputParams *params);
|
|
90
|
+
|
|
91
|
+
static void IRAM_ATTR feed_display(OutputParams *params);
|
|
92
|
+
|
|
93
|
+
static void epd_fill_circle_helper(int32_t x0, int32_t y0, int32_t r, int32_t corners, int32_t delta,
|
|
94
|
+
uint8_t color, uint8_t *framebuffer);
|
|
95
|
+
|
|
96
|
+
/******************************************************************************/
|
|
97
|
+
/*** exported variables ***/
|
|
98
|
+
/******************************************************************************/
|
|
99
|
+
|
|
100
|
+
/******************************************************************************/
|
|
101
|
+
/*** local variables ***/
|
|
102
|
+
/******************************************************************************/
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @brief status tracker for row skipping
|
|
106
|
+
*/
|
|
107
|
+
static uint32_t skipping;
|
|
108
|
+
|
|
109
|
+
/* 4bpp Contrast cycles in order of contrast (Darkest first). */
|
|
110
|
+
static const int32_t contrast_cycles_4[15] = {30, 30, 20, 20, 30, 30, 30, 40, 40, 50, 50, 50, 100, 200, 300};
|
|
111
|
+
|
|
112
|
+
static const int32_t contrast_cycles_4_white[15] = {10, 10, 8, 8, 8, 8, 8, 10, 10, 15, 15, 20, 20, 100, 300};
|
|
113
|
+
|
|
114
|
+
// Heap space to use for the EPD output lookup table, which
|
|
115
|
+
// is calculated for each cycle.
|
|
116
|
+
static uint8_t *conversion_lut;
|
|
117
|
+
static QueueHandle_t output_queue;
|
|
118
|
+
|
|
119
|
+
static const DRAM_ATTR uint32_t lut_1bpp[256] = {
|
|
120
|
+
0x0000, 0x0001, 0x0004, 0x0005, 0x0010, 0x0011, 0x0014, 0x0015,
|
|
121
|
+
0x0040, 0x0041, 0x0044, 0x0045, 0x0050, 0x0051, 0x0054, 0x0055,
|
|
122
|
+
0x0100, 0x0101, 0x0104, 0x0105, 0x0110, 0x0111, 0x0114, 0x0115,
|
|
123
|
+
0x0140, 0x0141, 0x0144, 0x0145, 0x0150, 0x0151, 0x0154, 0x0155,
|
|
124
|
+
0x0400, 0x0401, 0x0404, 0x0405, 0x0410, 0x0411, 0x0414, 0x0415,
|
|
125
|
+
0x0440, 0x0441, 0x0444, 0x0445, 0x0450, 0x0451, 0x0454, 0x0455,
|
|
126
|
+
0x0500, 0x0501, 0x0504, 0x0505, 0x0510, 0x0511, 0x0514, 0x0515,
|
|
127
|
+
0x0540, 0x0541, 0x0544, 0x0545, 0x0550, 0x0551, 0x0554, 0x0555,
|
|
128
|
+
0x1000, 0x1001, 0x1004, 0x1005, 0x1010, 0x1011, 0x1014, 0x1015,
|
|
129
|
+
0x1040, 0x1041, 0x1044, 0x1045, 0x1050, 0x1051, 0x1054, 0x1055,
|
|
130
|
+
0x1100, 0x1101, 0x1104, 0x1105, 0x1110, 0x1111, 0x1114, 0x1115,
|
|
131
|
+
0x1140, 0x1141, 0x1144, 0x1145, 0x1150, 0x1151, 0x1154, 0x1155,
|
|
132
|
+
0x1400, 0x1401, 0x1404, 0x1405, 0x1410, 0x1411, 0x1414, 0x1415,
|
|
133
|
+
0x1440, 0x1441, 0x1444, 0x1445, 0x1450, 0x1451, 0x1454, 0x1455,
|
|
134
|
+
0x1500, 0x1501, 0x1504, 0x1505, 0x1510, 0x1511, 0x1514, 0x1515,
|
|
135
|
+
0x1540, 0x1541, 0x1544, 0x1545, 0x1550, 0x1551, 0x1554, 0x1555,
|
|
136
|
+
0x4000, 0x4001, 0x4004, 0x4005, 0x4010, 0x4011, 0x4014, 0x4015,
|
|
137
|
+
0x4040, 0x4041, 0x4044, 0x4045, 0x4050, 0x4051, 0x4054, 0x4055,
|
|
138
|
+
0x4100, 0x4101, 0x4104, 0x4105, 0x4110, 0x4111, 0x4114, 0x4115,
|
|
139
|
+
0x4140, 0x4141, 0x4144, 0x4145, 0x4150, 0x4151, 0x4154, 0x4155,
|
|
140
|
+
0x4400, 0x4401, 0x4404, 0x4405, 0x4410, 0x4411, 0x4414, 0x4415,
|
|
141
|
+
0x4440, 0x4441, 0x4444, 0x4445, 0x4450, 0x4451, 0x4454, 0x4455,
|
|
142
|
+
0x4500, 0x4501, 0x4504, 0x4505, 0x4510, 0x4511, 0x4514, 0x4515,
|
|
143
|
+
0x4540, 0x4541, 0x4544, 0x4545, 0x4550, 0x4551, 0x4554, 0x4555,
|
|
144
|
+
0x5000, 0x5001, 0x5004, 0x5005, 0x5010, 0x5011, 0x5014, 0x5015,
|
|
145
|
+
0x5040, 0x5041, 0x5044, 0x5045, 0x5050, 0x5051, 0x5054, 0x5055,
|
|
146
|
+
0x5100, 0x5101, 0x5104, 0x5105, 0x5110, 0x5111, 0x5114, 0x5115,
|
|
147
|
+
0x5140, 0x5141, 0x5144, 0x5145, 0x5150, 0x5151, 0x5154, 0x5155,
|
|
148
|
+
0x5400, 0x5401, 0x5404, 0x5405, 0x5410, 0x5411, 0x5414, 0x5415,
|
|
149
|
+
0x5440, 0x5441, 0x5444, 0x5445, 0x5450, 0x5451, 0x5454, 0x5455,
|
|
150
|
+
0x5500, 0x5501, 0x5504, 0x5505, 0x5510, 0x5511, 0x5514, 0x5515,
|
|
151
|
+
0x5540, 0x5541, 0x5544, 0x5545, 0x5550, 0x5551, 0x5554, 0x5555
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/******************************************************************************/
|
|
155
|
+
/*** exported functions ***/
|
|
156
|
+
/******************************************************************************/
|
|
157
|
+
|
|
158
|
+
void epd_init()
|
|
159
|
+
{
|
|
160
|
+
skipping = 0;
|
|
161
|
+
epd_base_init(EPD_WIDTH);
|
|
162
|
+
|
|
163
|
+
conversion_lut = (uint8_t *)heap_caps_malloc(1 << 16, MALLOC_CAP_8BIT);
|
|
164
|
+
assert(conversion_lut != NULL);
|
|
165
|
+
output_queue = xQueueCreate(64, EPD_WIDTH / 2);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
void epd_push_pixels(Rect_t area, int16_t time, int32_t color)
|
|
170
|
+
{
|
|
171
|
+
uint8_t row[EPD_LINE_BYTES] = { 0 };
|
|
172
|
+
|
|
173
|
+
for (uint32_t i = 0; i < area.width; i++)
|
|
174
|
+
{
|
|
175
|
+
uint32_t position = i + area.x % 4;
|
|
176
|
+
uint8_t mask = (color ? CLEAR_BYTE : DARK_BYTE) & (0b00000011 << (2 * (position % 4)));
|
|
177
|
+
row[area.x / 4 + position / 4] |= mask;
|
|
178
|
+
}
|
|
179
|
+
reorder_line_buffer((uint32_t *)row);
|
|
180
|
+
|
|
181
|
+
epd_start_frame();
|
|
182
|
+
|
|
183
|
+
for (int32_t i = 0; i < EPD_HEIGHT; i++)
|
|
184
|
+
{
|
|
185
|
+
// before are of interest: skip
|
|
186
|
+
if (i < area.y)
|
|
187
|
+
{
|
|
188
|
+
skip_row(time);
|
|
189
|
+
// start area of interest: set row data
|
|
190
|
+
}
|
|
191
|
+
else if (i == area.y)
|
|
192
|
+
{
|
|
193
|
+
epd_switch_buffer();
|
|
194
|
+
memcpy(epd_get_current_buffer(), row, EPD_LINE_BYTES);
|
|
195
|
+
epd_switch_buffer();
|
|
196
|
+
memcpy(epd_get_current_buffer(), row, EPD_LINE_BYTES);
|
|
197
|
+
|
|
198
|
+
write_row(time * 10);
|
|
199
|
+
// load nop row if done with area
|
|
200
|
+
}
|
|
201
|
+
else if (i >= area.y + area.height)
|
|
202
|
+
{
|
|
203
|
+
skip_row(time);
|
|
204
|
+
// output the same as before
|
|
205
|
+
}
|
|
206
|
+
else
|
|
207
|
+
{
|
|
208
|
+
write_row(time * 10);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Since we "pipeline" row output, we still have to latch out the last row.
|
|
212
|
+
write_row(time * 10);
|
|
213
|
+
|
|
214
|
+
epd_end_frame();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
void epd_clear_area(Rect_t area)
|
|
219
|
+
{
|
|
220
|
+
epd_clear_area_cycles(area, 4, 50);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
void epd_clear_area_cycles(Rect_t area, int32_t cycles, int32_t cycle_time)
|
|
225
|
+
{
|
|
226
|
+
const int16_t white_time = cycle_time;
|
|
227
|
+
const int16_t dark_time = cycle_time;
|
|
228
|
+
|
|
229
|
+
for (int32_t c = 0; c < cycles; c++)
|
|
230
|
+
{
|
|
231
|
+
for (int32_t i = 0; i < 4; i++)
|
|
232
|
+
{
|
|
233
|
+
epd_push_pixels(area, dark_time, 0);
|
|
234
|
+
}
|
|
235
|
+
for (int32_t i = 0; i < 4; i++)
|
|
236
|
+
{
|
|
237
|
+
epd_push_pixels(area, white_time, 1);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
Rect_t epd_full_screen()
|
|
244
|
+
{
|
|
245
|
+
Rect_t area = {.x = 0, .y = 0, .width = EPD_WIDTH, .height = EPD_HEIGHT};
|
|
246
|
+
return area;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
void epd_clear()
|
|
251
|
+
{
|
|
252
|
+
epd_clear_area(epd_full_screen());
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
void IRAM_ATTR calc_epd_input_4bpp(uint32_t *line_data, uint8_t *epd_input,
|
|
257
|
+
uint8_t k, uint8_t *conversion_lut)
|
|
258
|
+
{
|
|
259
|
+
uint32_t *wide_epd_input = (uint32_t *)epd_input;
|
|
260
|
+
uint16_t *line_data_16 = (uint16_t *)line_data;
|
|
261
|
+
|
|
262
|
+
// this is reversed for little-endian, but this is later compensated
|
|
263
|
+
// through the output peripheral.
|
|
264
|
+
for (uint32_t j = 0; j < EPD_WIDTH / 16; j++)
|
|
265
|
+
{
|
|
266
|
+
uint16_t v1 = *(line_data_16++);
|
|
267
|
+
uint16_t v2 = *(line_data_16++);
|
|
268
|
+
uint16_t v3 = *(line_data_16++);
|
|
269
|
+
uint16_t v4 = *(line_data_16++);
|
|
270
|
+
#if USER_I2S_REG
|
|
271
|
+
uint32_t pixel = conversion_lut[v1] << 16 |
|
|
272
|
+
conversion_lut[v2] << 24 |
|
|
273
|
+
conversion_lut[v3] |
|
|
274
|
+
conversion_lut[v4] << 8;
|
|
275
|
+
#else
|
|
276
|
+
uint32_t pixel = (conversion_lut[v1]) << 0 |
|
|
277
|
+
(conversion_lut[v2]) << 8 |
|
|
278
|
+
(conversion_lut[v3]) << 16 |
|
|
279
|
+
(conversion_lut[v4]) << 24;
|
|
280
|
+
#endif
|
|
281
|
+
wide_epd_input[j] = pixel;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
void IRAM_ATTR calc_epd_input_1bpp(uint8_t *line_data, uint8_t *epd_input,
|
|
287
|
+
DrawMode_t mode)
|
|
288
|
+
{
|
|
289
|
+
uint32_t *wide_epd_input = (uint32_t *)epd_input;
|
|
290
|
+
|
|
291
|
+
// this is reversed for little-endian, but this is later compensated
|
|
292
|
+
// through the output peripheral.
|
|
293
|
+
for (uint32_t j = 0; j < EPD_WIDTH / 16; j++)
|
|
294
|
+
{
|
|
295
|
+
uint8_t v1 = *(line_data++);
|
|
296
|
+
uint8_t v2 = *(line_data++);
|
|
297
|
+
wide_epd_input[j] = (lut_1bpp[v1] << 16) | lut_1bpp[v2];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
inline uint32_t min(uint32_t x, uint32_t y)
|
|
303
|
+
{
|
|
304
|
+
return x < y ? x : y;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
void epd_draw_hline(int32_t x, int32_t y, int32_t length, uint8_t color, uint8_t *framebuffer)
|
|
309
|
+
{
|
|
310
|
+
for (int32_t i = 0; i < length; i++)
|
|
311
|
+
{
|
|
312
|
+
int32_t xx = x + i;
|
|
313
|
+
epd_draw_pixel(xx, y, color, framebuffer);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
void epd_draw_vline(int32_t x, int32_t y, int32_t length, uint8_t color, uint8_t *framebuffer)
|
|
319
|
+
{
|
|
320
|
+
for (int32_t i = 0; i < length; i++)
|
|
321
|
+
{
|
|
322
|
+
int32_t yy = y + i;
|
|
323
|
+
epd_draw_pixel(x, yy, color, framebuffer);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
void epd_draw_pixel(int32_t x, int32_t y, uint8_t color, uint8_t *framebuffer)
|
|
329
|
+
{
|
|
330
|
+
if (x < 0 || x >= EPD_WIDTH)
|
|
331
|
+
{
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (y < 0 || y >= EPD_HEIGHT)
|
|
335
|
+
{
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
uint8_t *buf_ptr = &framebuffer[y * EPD_WIDTH / 2 + x / 2];
|
|
339
|
+
if (x % 2)
|
|
340
|
+
{
|
|
341
|
+
*buf_ptr = (*buf_ptr & 0x0F) | (color & 0xF0);
|
|
342
|
+
}
|
|
343
|
+
else
|
|
344
|
+
{
|
|
345
|
+
*buf_ptr = (*buf_ptr & 0xF0) | (color >> 4);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
void epd_draw_circle(int32_t x0, int32_t y0, int32_t r, uint8_t color, uint8_t *framebuffer)
|
|
351
|
+
{
|
|
352
|
+
int32_t f = 1 - r;
|
|
353
|
+
int32_t ddF_x = 1;
|
|
354
|
+
int32_t ddF_y = -2 * r;
|
|
355
|
+
int32_t x = 0;
|
|
356
|
+
int32_t y = r;
|
|
357
|
+
|
|
358
|
+
epd_draw_pixel(x0, y0 + r, color, framebuffer);
|
|
359
|
+
epd_draw_pixel(x0, y0 - r, color, framebuffer);
|
|
360
|
+
epd_draw_pixel(x0 + r, y0, color, framebuffer);
|
|
361
|
+
epd_draw_pixel(x0 - r, y0, color, framebuffer);
|
|
362
|
+
|
|
363
|
+
while (x < y)
|
|
364
|
+
{
|
|
365
|
+
if (f >= 0)
|
|
366
|
+
{
|
|
367
|
+
y--;
|
|
368
|
+
ddF_y += 2;
|
|
369
|
+
f += ddF_y;
|
|
370
|
+
}
|
|
371
|
+
x++;
|
|
372
|
+
ddF_x += 2;
|
|
373
|
+
f += ddF_x;
|
|
374
|
+
|
|
375
|
+
epd_draw_pixel(x0 + x, y0 + y, color, framebuffer);
|
|
376
|
+
epd_draw_pixel(x0 - x, y0 + y, color, framebuffer);
|
|
377
|
+
epd_draw_pixel(x0 + x, y0 - y, color, framebuffer);
|
|
378
|
+
epd_draw_pixel(x0 - x, y0 - y, color, framebuffer);
|
|
379
|
+
epd_draw_pixel(x0 + y, y0 + x, color, framebuffer);
|
|
380
|
+
epd_draw_pixel(x0 - y, y0 + x, color, framebuffer);
|
|
381
|
+
epd_draw_pixel(x0 + y, y0 - x, color, framebuffer);
|
|
382
|
+
epd_draw_pixel(x0 - y, y0 - x, color, framebuffer);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
void epd_fill_circle(int32_t x0, int32_t y0, int32_t r, uint8_t color, uint8_t *framebuffer)
|
|
388
|
+
{
|
|
389
|
+
epd_draw_vline(x0, y0 - r, 2 * r + 1, color, framebuffer);
|
|
390
|
+
epd_fill_circle_helper(x0, y0, r, 3, 0, color, framebuffer);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
static void epd_fill_circle_helper(int32_t x0, int32_t y0, int32_t r, int32_t corners, int32_t delta,
|
|
395
|
+
uint8_t color, uint8_t *framebuffer)
|
|
396
|
+
{
|
|
397
|
+
int32_t f = 1 - r;
|
|
398
|
+
int32_t ddF_x = 1;
|
|
399
|
+
int32_t ddF_y = -2 * r;
|
|
400
|
+
int32_t x = 0;
|
|
401
|
+
int32_t y = r;
|
|
402
|
+
int32_t px = x;
|
|
403
|
+
int32_t py = y;
|
|
404
|
+
|
|
405
|
+
delta++; // Avoid some +1's in the loop
|
|
406
|
+
|
|
407
|
+
while (x < y)
|
|
408
|
+
{
|
|
409
|
+
if (f >= 0)
|
|
410
|
+
{
|
|
411
|
+
y--;
|
|
412
|
+
ddF_y += 2;
|
|
413
|
+
f += ddF_y;
|
|
414
|
+
}
|
|
415
|
+
x++;
|
|
416
|
+
ddF_x += 2;
|
|
417
|
+
f += ddF_x;
|
|
418
|
+
// These checks avoid double-drawing certain lines, important
|
|
419
|
+
// for the SSD1306 library which has an INVERT drawing mode.
|
|
420
|
+
if (x < (y + 1))
|
|
421
|
+
{
|
|
422
|
+
if (corners & 1)
|
|
423
|
+
epd_draw_vline(x0 + x, y0 - y, 2 * y + delta, color, framebuffer);
|
|
424
|
+
if (corners & 2)
|
|
425
|
+
epd_draw_vline(x0 - x, y0 - y, 2 * y + delta, color, framebuffer);
|
|
426
|
+
}
|
|
427
|
+
if (y != py)
|
|
428
|
+
{
|
|
429
|
+
if (corners & 1)
|
|
430
|
+
epd_draw_vline(x0 + py, y0 - px, 2 * px + delta, color, framebuffer);
|
|
431
|
+
if (corners & 2)
|
|
432
|
+
epd_draw_vline(x0 - py, y0 - px, 2 * px + delta, color, framebuffer);
|
|
433
|
+
py = y;
|
|
434
|
+
}
|
|
435
|
+
px = x;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
void epd_draw_oval(int x0, int y0, int rx, int ry, uint8_t color, uint8_t *framebuffer) {
|
|
440
|
+
int x = 0;
|
|
441
|
+
int y = ry;
|
|
442
|
+
int64_t rxSq = (int64_t)rx * rx;
|
|
443
|
+
int64_t rySq = (int64_t)ry * ry;
|
|
444
|
+
int64_t twoRxSq = 2 * rxSq;
|
|
445
|
+
int64_t twoRySq = 2 * rySq;
|
|
446
|
+
int64_t px = 0;
|
|
447
|
+
int64_t py = twoRxSq * y;
|
|
448
|
+
|
|
449
|
+
// Region 1: Top and bottom edges
|
|
450
|
+
int64_t p = round(rySq - (rxSq * ry) + (0.25 * rxSq));
|
|
451
|
+
while (px < py) {
|
|
452
|
+
epd_draw_pixel(x0 + x, y0 + y, color, framebuffer);
|
|
453
|
+
epd_draw_pixel(x0 - x, y0 + y, color, framebuffer);
|
|
454
|
+
epd_draw_pixel(x0 + x, y0 - y, color, framebuffer);
|
|
455
|
+
epd_draw_pixel(x0 - x, y0 - y, color, framebuffer);
|
|
456
|
+
|
|
457
|
+
x++;
|
|
458
|
+
px += twoRySq;
|
|
459
|
+
if (p < 0) {
|
|
460
|
+
p += rySq + px;
|
|
461
|
+
} else {
|
|
462
|
+
y--;
|
|
463
|
+
py -= twoRxSq;
|
|
464
|
+
p += rySq + px - py;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Region 2: Left and right edges
|
|
469
|
+
p = round(rySq * (x + 0.5) * (x + 0.5) + rxSq * (y - 1) * (y - 1) - rxSq * rySq);
|
|
470
|
+
while (y >= 0) {
|
|
471
|
+
epd_draw_pixel(x0 + x, y0 + y, color, framebuffer);
|
|
472
|
+
epd_draw_pixel(x0 - x, y0 + y, color, framebuffer);
|
|
473
|
+
epd_draw_pixel(x0 + x, y0 - y, color, framebuffer);
|
|
474
|
+
epd_draw_pixel(x0 - x, y0 - y, color, framebuffer);
|
|
475
|
+
|
|
476
|
+
y--;
|
|
477
|
+
py -= twoRxSq;
|
|
478
|
+
if (p > 0) {
|
|
479
|
+
p += rxSq - py;
|
|
480
|
+
} else {
|
|
481
|
+
x++;
|
|
482
|
+
px += twoRySq;
|
|
483
|
+
p += rxSq - py + px;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
void epd_draw_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t color, uint8_t *framebuffer)
|
|
489
|
+
{
|
|
490
|
+
epd_draw_hline(x, y, w, color, framebuffer);
|
|
491
|
+
epd_draw_hline(x, y + h - 1, w, color, framebuffer);
|
|
492
|
+
epd_draw_vline(x, y, h, color, framebuffer);
|
|
493
|
+
epd_draw_vline(x + w - 1, y, h, color, framebuffer);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
void epd_fill_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint8_t color, uint8_t *framebuffer)
|
|
498
|
+
{
|
|
499
|
+
for (int32_t i = x; i < x + w; i++)
|
|
500
|
+
{
|
|
501
|
+
epd_draw_vline(i, y, h, color, framebuffer);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
void epd_write_line(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint8_t color, uint8_t *framebuffer)
|
|
507
|
+
{
|
|
508
|
+
int32_t steep = abs(y1 - y0) > abs(x1 - x0);
|
|
509
|
+
if (steep)
|
|
510
|
+
{
|
|
511
|
+
_swap_int(x0, y0);
|
|
512
|
+
_swap_int(x1, y1);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (x0 > x1)
|
|
516
|
+
{
|
|
517
|
+
_swap_int(x0, x1);
|
|
518
|
+
_swap_int(y0, y1);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
int32_t dx, dy;
|
|
522
|
+
dx = x1 - x0;
|
|
523
|
+
dy = abs(y1 - y0);
|
|
524
|
+
|
|
525
|
+
int32_t err = dx / 2;
|
|
526
|
+
int32_t ystep;
|
|
527
|
+
|
|
528
|
+
if (y0 < y1)
|
|
529
|
+
{
|
|
530
|
+
ystep = 1;
|
|
531
|
+
}
|
|
532
|
+
else
|
|
533
|
+
{
|
|
534
|
+
ystep = -1;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
for (; x0 <= x1; x0++)
|
|
538
|
+
{
|
|
539
|
+
if (steep)
|
|
540
|
+
{
|
|
541
|
+
epd_draw_pixel(y0, x0, color, framebuffer);
|
|
542
|
+
}
|
|
543
|
+
else
|
|
544
|
+
{
|
|
545
|
+
epd_draw_pixel(x0, y0, color, framebuffer);
|
|
546
|
+
}
|
|
547
|
+
err -= dy;
|
|
548
|
+
if (err < 0)
|
|
549
|
+
{
|
|
550
|
+
y0 += ystep;
|
|
551
|
+
err += dx;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
void epd_draw_line(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint8_t color, uint8_t *framebuffer)
|
|
558
|
+
{
|
|
559
|
+
// Update in subclasses if desired!
|
|
560
|
+
if (x0 == x1)
|
|
561
|
+
{
|
|
562
|
+
if (y0 > y1)
|
|
563
|
+
_swap_int(y0, y1);
|
|
564
|
+
epd_draw_vline(x0, y0, y1 - y0 + 1, color, framebuffer);
|
|
565
|
+
}
|
|
566
|
+
else if (y0 == y1)
|
|
567
|
+
{
|
|
568
|
+
if (x0 > x1)
|
|
569
|
+
_swap_int(x0, x1);
|
|
570
|
+
epd_draw_hline(x0, y0, x1 - x0 + 1, color, framebuffer);
|
|
571
|
+
}
|
|
572
|
+
else
|
|
573
|
+
{
|
|
574
|
+
epd_write_line(x0, y0, x1, y1, color, framebuffer);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
void epd_draw_triangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
|
580
|
+
uint8_t color, uint8_t *framebuffer)
|
|
581
|
+
{
|
|
582
|
+
epd_draw_line(x0, y0, x1, y1, color, framebuffer);
|
|
583
|
+
epd_draw_line(x1, y1, x2, y2, color, framebuffer);
|
|
584
|
+
epd_draw_line(x2, y2, x0, y0, color, framebuffer);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
void epd_fill_triangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
|
589
|
+
uint8_t color, uint8_t *framebuffer)
|
|
590
|
+
{
|
|
591
|
+
int32_t a, b, y, last;
|
|
592
|
+
|
|
593
|
+
// Sort coordinates by Y order (y2 >= y1 >= y0)
|
|
594
|
+
if (y0 > y1)
|
|
595
|
+
{
|
|
596
|
+
_swap_int(y0, y1);
|
|
597
|
+
_swap_int(x0, x1);
|
|
598
|
+
}
|
|
599
|
+
if (y1 > y2)
|
|
600
|
+
{
|
|
601
|
+
_swap_int(y2, y1);
|
|
602
|
+
_swap_int(x2, x1);
|
|
603
|
+
}
|
|
604
|
+
if (y0 > y1)
|
|
605
|
+
{
|
|
606
|
+
_swap_int(y0, y1);
|
|
607
|
+
_swap_int(x0, x1);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (y0 == y2)
|
|
611
|
+
{ // Handle awkward all-on-same-line case as its own thing
|
|
612
|
+
a = b = x0;
|
|
613
|
+
if (x1 < a)
|
|
614
|
+
a = x1;
|
|
615
|
+
else if (x1 > b)
|
|
616
|
+
b = x1;
|
|
617
|
+
if (x2 < a)
|
|
618
|
+
a = x2;
|
|
619
|
+
else if (x2 > b)
|
|
620
|
+
b = x2;
|
|
621
|
+
epd_draw_hline(a, y0, b - a + 1, color, framebuffer);
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
int32_t dx01 = x1 - x0;
|
|
626
|
+
int32_t dy01 = y1 - y0;
|
|
627
|
+
int32_t dx02 = x2 - x0;
|
|
628
|
+
int32_t dy02 = y2 - y0;
|
|
629
|
+
int32_t dx12 = x2 - x1;
|
|
630
|
+
int32_t dy12 = y2 - y1;
|
|
631
|
+
int32_t sa = 0;
|
|
632
|
+
int32_t sb = 0;
|
|
633
|
+
|
|
634
|
+
// For upper part of triangle, find scanline crossings for segments
|
|
635
|
+
// 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1
|
|
636
|
+
// is included here (and second loop will be skipped, avoiding a /0
|
|
637
|
+
// error there), otherwise scanline y1 is skipped here and handled
|
|
638
|
+
// in the second loop...which also avoids a /0 error here if y0=y1
|
|
639
|
+
// (flat-topped triangle).
|
|
640
|
+
if (y1 == y2)
|
|
641
|
+
last = y1; // Include y1 scanline
|
|
642
|
+
else
|
|
643
|
+
last = y1 - 1; // Skip it
|
|
644
|
+
|
|
645
|
+
for (y = y0; y <= last; y++)
|
|
646
|
+
{
|
|
647
|
+
a = x0 + sa / dy01;
|
|
648
|
+
b = x0 + sb / dy02;
|
|
649
|
+
sa += dx01;
|
|
650
|
+
sb += dx02;
|
|
651
|
+
/* longhand:
|
|
652
|
+
a = x0 + (x1 - x0) * (y - y0) / (y1 - y0);
|
|
653
|
+
b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
|
|
654
|
+
*/
|
|
655
|
+
if (a > b)
|
|
656
|
+
_swap_int(a, b);
|
|
657
|
+
epd_draw_hline(a, y, b - a + 1, color, framebuffer);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// For lower part of triangle, find scanline crossings for segments
|
|
661
|
+
// 0-2 and 1-2. This loop is skipped if y1=y2.
|
|
662
|
+
sa = (int32_t)dx12 * (y - y1);
|
|
663
|
+
sb = (int32_t)dx02 * (y - y0);
|
|
664
|
+
for (; y <= y2; y++)
|
|
665
|
+
{
|
|
666
|
+
a = x1 + sa / dy12;
|
|
667
|
+
b = x0 + sb / dy02;
|
|
668
|
+
sa += dx12;
|
|
669
|
+
sb += dx02;
|
|
670
|
+
/* longhand:
|
|
671
|
+
a = x1 + (x2 - x1) * (y - y1) / (y2 - y1);
|
|
672
|
+
b = x0 + (x2 - x0) * (y - y0) / (y2 - y0);
|
|
673
|
+
*/
|
|
674
|
+
if (a > b)
|
|
675
|
+
_swap_int(a, b);
|
|
676
|
+
epd_draw_hline(a, y, b - a + 1, color, framebuffer);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
void epd_copy_to_framebuffer(Rect_t image_area, uint8_t *image_data,
|
|
682
|
+
uint8_t *framebuffer)
|
|
683
|
+
{
|
|
684
|
+
assert(image_data != NULL || framebuffer != NULL);
|
|
685
|
+
|
|
686
|
+
for (uint32_t i = 0; i < image_area.width * image_area.height; i++)
|
|
687
|
+
{
|
|
688
|
+
uint32_t value_index = i;
|
|
689
|
+
// for images of uneven width,
|
|
690
|
+
// consume an additional nibble per row.
|
|
691
|
+
if (image_area.width % 2)
|
|
692
|
+
{
|
|
693
|
+
value_index += i / image_area.width;
|
|
694
|
+
}
|
|
695
|
+
uint8_t val = (value_index % 2) ? (image_data[value_index / 2] & 0xF0) >> 4
|
|
696
|
+
: image_data[value_index / 2] & 0x0F;
|
|
697
|
+
|
|
698
|
+
int32_t xx = image_area.x + i % image_area.width;
|
|
699
|
+
if (xx < 0 || xx >= EPD_WIDTH)
|
|
700
|
+
{
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
int32_t yy = image_area.y + i / image_area.width;
|
|
704
|
+
if (yy < 0 || yy >= EPD_HEIGHT)
|
|
705
|
+
{
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
uint8_t *buf_ptr = &framebuffer[yy * EPD_WIDTH / 2 + xx / 2];
|
|
709
|
+
if (xx % 2)
|
|
710
|
+
{
|
|
711
|
+
*buf_ptr = (*buf_ptr & 0x0F) | (val << 4);
|
|
712
|
+
}
|
|
713
|
+
else
|
|
714
|
+
{
|
|
715
|
+
*buf_ptr = (*buf_ptr & 0xF0) | val;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
void IRAM_ATTR epd_draw_grayscale_image(Rect_t area, uint8_t *data)
|
|
722
|
+
{
|
|
723
|
+
epd_draw_image(area, data, BLACK_ON_WHITE);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
void IRAM_ATTR epd_draw_frame_1bit(Rect_t area, uint8_t *ptr,
|
|
728
|
+
DrawMode_t mode, int32_t time)
|
|
729
|
+
{
|
|
730
|
+
epd_start_frame();
|
|
731
|
+
uint8_t line[EPD_WIDTH / 8];
|
|
732
|
+
memset(line, 0, sizeof(line));
|
|
733
|
+
|
|
734
|
+
if (area.x < 0)
|
|
735
|
+
{
|
|
736
|
+
ptr += -area.x / 8;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
int32_t ceil_byte_width = (area.width / 8 + (area.width % 8 > 0));
|
|
740
|
+
if (area.y < 0)
|
|
741
|
+
{
|
|
742
|
+
ptr += ceil_byte_width * -area.y;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
for (int32_t i = 0; i < EPD_HEIGHT; i++)
|
|
746
|
+
{
|
|
747
|
+
if (i < area.y || i >= area.y + area.height)
|
|
748
|
+
{
|
|
749
|
+
skip_row(time);
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
uint8_t *lp;
|
|
754
|
+
bool shifted = 0;
|
|
755
|
+
if (area.width == EPD_WIDTH && area.x == 0)
|
|
756
|
+
{
|
|
757
|
+
lp = ptr;
|
|
758
|
+
ptr += EPD_WIDTH / 8;
|
|
759
|
+
}
|
|
760
|
+
else
|
|
761
|
+
{
|
|
762
|
+
uint8_t *buf_start = (uint8_t *)line;
|
|
763
|
+
uint32_t line_bytes = ceil_byte_width;
|
|
764
|
+
if (area.x >= 0)
|
|
765
|
+
{
|
|
766
|
+
buf_start += area.x / 8;
|
|
767
|
+
}
|
|
768
|
+
else
|
|
769
|
+
{
|
|
770
|
+
// reduce line_bytes to actually used bytes
|
|
771
|
+
line_bytes += area.x / 8;
|
|
772
|
+
}
|
|
773
|
+
line_bytes =
|
|
774
|
+
min(line_bytes, EPD_WIDTH / 8 - (uint32_t)(buf_start - line));
|
|
775
|
+
memcpy(buf_start, ptr, line_bytes);
|
|
776
|
+
ptr += ceil_byte_width;
|
|
777
|
+
|
|
778
|
+
// mask last n bits if width is not divisible by 8
|
|
779
|
+
if (area.width % 8 != 0 && ceil_byte_width + 1 < EPD_WIDTH)
|
|
780
|
+
{
|
|
781
|
+
uint8_t mask = 0;
|
|
782
|
+
for (int32_t s = 0; s < area.width % 8; s++)
|
|
783
|
+
{
|
|
784
|
+
mask = (mask << 1) | 1;
|
|
785
|
+
}
|
|
786
|
+
*(buf_start + line_bytes - 1) &= mask;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (area.x % 8 != 0 && area.x < EPD_WIDTH)
|
|
790
|
+
{
|
|
791
|
+
// shift to right
|
|
792
|
+
shifted = true;
|
|
793
|
+
bit_shift_buffer_right(
|
|
794
|
+
buf_start,
|
|
795
|
+
min(line_bytes + 1,
|
|
796
|
+
(uint32_t)line + EPD_WIDTH / 8 - (uint32_t)buf_start),
|
|
797
|
+
area.x % 8);
|
|
798
|
+
}
|
|
799
|
+
lp = line;
|
|
800
|
+
}
|
|
801
|
+
calc_epd_input_1bpp(lp, epd_get_current_buffer(), mode);
|
|
802
|
+
epd_output_row(time);
|
|
803
|
+
if (shifted)
|
|
804
|
+
{
|
|
805
|
+
memset(line, 0, sizeof(line));
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
if (!skipping)
|
|
809
|
+
{
|
|
810
|
+
epd_output_row(time);
|
|
811
|
+
}
|
|
812
|
+
epd_end_frame();
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
void IRAM_ATTR epd_draw_image(Rect_t area, uint8_t *data, DrawMode_t mode)
|
|
817
|
+
{
|
|
818
|
+
uint8_t frame_count = 15;
|
|
819
|
+
|
|
820
|
+
SemaphoreHandle_t fetch_sem = xSemaphoreCreateBinary();
|
|
821
|
+
SemaphoreHandle_t feed_sem = xSemaphoreCreateBinary();
|
|
822
|
+
vTaskDelay(10);
|
|
823
|
+
for (uint8_t k = 0; k < frame_count; k++)
|
|
824
|
+
{
|
|
825
|
+
OutputParams p1 = {
|
|
826
|
+
.area = area,
|
|
827
|
+
.data_ptr = data,
|
|
828
|
+
.frame = k,
|
|
829
|
+
.mode = mode,
|
|
830
|
+
.done_smphr = fetch_sem,
|
|
831
|
+
};
|
|
832
|
+
OutputParams p2 = {
|
|
833
|
+
.area = area,
|
|
834
|
+
.data_ptr = data,
|
|
835
|
+
.frame = k,
|
|
836
|
+
.mode = mode,
|
|
837
|
+
.done_smphr = feed_sem,
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
TaskHandle_t t1, t2;
|
|
841
|
+
xTaskCreatePinnedToCore((void (*)(void *))provide_out, "privide_out", 8192,
|
|
842
|
+
&p1, 10, &t1, 0);
|
|
843
|
+
xTaskCreatePinnedToCore((void (*)(void *))feed_display, "render", 8192, &p2,
|
|
844
|
+
10, &t2, 1);
|
|
845
|
+
|
|
846
|
+
xSemaphoreTake(fetch_sem, portMAX_DELAY);
|
|
847
|
+
xSemaphoreTake(feed_sem, portMAX_DELAY);
|
|
848
|
+
|
|
849
|
+
vTaskDelete(t1);
|
|
850
|
+
vTaskDelete(t2);
|
|
851
|
+
vTaskDelay(5);
|
|
852
|
+
}
|
|
853
|
+
vSemaphoreDelete(fetch_sem);
|
|
854
|
+
vSemaphoreDelete(feed_sem);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/******************************************************************************/
|
|
858
|
+
/*** local functions ***/
|
|
859
|
+
/******************************************************************************/
|
|
860
|
+
|
|
861
|
+
static void write_row(uint32_t output_time_dus)
|
|
862
|
+
{
|
|
863
|
+
// avoid too light output after skipping on some displays
|
|
864
|
+
if (skipping)
|
|
865
|
+
{
|
|
866
|
+
// vTaskDelay(20);
|
|
867
|
+
}
|
|
868
|
+
skipping = 0;
|
|
869
|
+
epd_output_row(output_time_dus);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
static void skip_row(uint8_t pipeline_finish_time)
|
|
874
|
+
{
|
|
875
|
+
// output previously loaded row, fill buffer with no-ops.
|
|
876
|
+
if (skipping == 0)
|
|
877
|
+
{
|
|
878
|
+
epd_switch_buffer();
|
|
879
|
+
memset(epd_get_current_buffer(), 0, EPD_LINE_BYTES);
|
|
880
|
+
epd_switch_buffer();
|
|
881
|
+
memset(epd_get_current_buffer(), 0, EPD_LINE_BYTES);
|
|
882
|
+
epd_output_row(pipeline_finish_time);
|
|
883
|
+
// avoid tainting of following rows by
|
|
884
|
+
// allowing residual charge to dissipate
|
|
885
|
+
// vTaskDelay(10);
|
|
886
|
+
/*
|
|
887
|
+
unsigned counts = XTHAL_GET_CCOUNT() + 50 * 240;
|
|
888
|
+
while (XTHAL_GET_CCOUNT() < counts) {
|
|
889
|
+
};
|
|
890
|
+
*/
|
|
891
|
+
}
|
|
892
|
+
else if (skipping < 2)
|
|
893
|
+
{
|
|
894
|
+
epd_output_row(10);
|
|
895
|
+
}
|
|
896
|
+
else
|
|
897
|
+
{
|
|
898
|
+
// epd_output_row(5);
|
|
899
|
+
epd_skip();
|
|
900
|
+
}
|
|
901
|
+
skipping++;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
static void reorder_line_buffer(uint32_t *line_data)
|
|
906
|
+
{
|
|
907
|
+
for (uint32_t i = 0; i < EPD_LINE_BYTES / 4; i++)
|
|
908
|
+
{
|
|
909
|
+
uint32_t val = *line_data;
|
|
910
|
+
*(line_data++) = val >> 16 | ((val & 0x0000FFFF) << 16);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
static void IRAM_ATTR reset_lut(uint8_t *lut_mem, DrawMode_t mode)
|
|
916
|
+
{
|
|
917
|
+
switch (mode)
|
|
918
|
+
{
|
|
919
|
+
case BLACK_ON_WHITE:
|
|
920
|
+
memset(lut_mem, 0x55, (1 << 16));
|
|
921
|
+
break;
|
|
922
|
+
case WHITE_ON_BLACK:
|
|
923
|
+
case WHITE_ON_WHITE:
|
|
924
|
+
memset(lut_mem, 0xAA, (1 << 16));
|
|
925
|
+
break;
|
|
926
|
+
default:
|
|
927
|
+
ESP_LOGW("epd_driver", "unknown draw mode %d!", mode);
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
static void IRAM_ATTR update_LUT(uint8_t *lut_mem, uint8_t k, DrawMode_t mode)
|
|
934
|
+
{
|
|
935
|
+
if (mode == BLACK_ON_WHITE || mode == WHITE_ON_WHITE)
|
|
936
|
+
{
|
|
937
|
+
k = 15 - k;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// reset the pixels which are not to be lightened / darkened
|
|
941
|
+
// any longer in the current frame
|
|
942
|
+
for (uint32_t l = k; l < (1 << 16); l += 16)
|
|
943
|
+
{
|
|
944
|
+
lut_mem[l] &= 0xFC;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
for (uint32_t l = (k << 4); l < (1 << 16); l += (1 << 8))
|
|
948
|
+
{
|
|
949
|
+
for (uint32_t p = 0; p < 16; p++)
|
|
950
|
+
{
|
|
951
|
+
lut_mem[l + p] &= 0xF3;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
for (uint32_t l = (k << 8); l < (1 << 16); l += (1 << 12))
|
|
955
|
+
{
|
|
956
|
+
for (uint32_t p = 0; p < (1 << 8); p++)
|
|
957
|
+
{
|
|
958
|
+
lut_mem[l + p] &= 0xCF;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
for (uint32_t p = (k << 12); p < ((k + 1) << 12); p++)
|
|
962
|
+
{
|
|
963
|
+
lut_mem[p] &= 0x3F;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
static void IRAM_ATTR bit_shift_buffer_right(uint8_t *buf, uint32_t len, int32_t shift)
|
|
969
|
+
{
|
|
970
|
+
uint8_t carry = 0x00;
|
|
971
|
+
for (uint32_t i = 0; i < len; i++)
|
|
972
|
+
{
|
|
973
|
+
uint8_t val = buf[i];
|
|
974
|
+
buf[i] = (val << shift) | carry;
|
|
975
|
+
carry = val >> (8 - shift);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
static void IRAM_ATTR nibble_shift_buffer_right(uint8_t *buf, uint32_t len)
|
|
980
|
+
{
|
|
981
|
+
uint8_t carry = 0xF;
|
|
982
|
+
for (uint32_t i = 0; i < len; i++)
|
|
983
|
+
{
|
|
984
|
+
uint8_t val = buf[i];
|
|
985
|
+
buf[i] = (val << 4) | carry;
|
|
986
|
+
carry = (val & 0xF0) >> 4;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
static void IRAM_ATTR provide_out(OutputParams *params)
|
|
991
|
+
{
|
|
992
|
+
uint8_t line[EPD_WIDTH / 2];
|
|
993
|
+
memset(line, 255, EPD_WIDTH / 2);
|
|
994
|
+
Rect_t area = params->area;
|
|
995
|
+
uint8_t *ptr = params->data_ptr;
|
|
996
|
+
|
|
997
|
+
if (params->frame == 0)
|
|
998
|
+
{
|
|
999
|
+
reset_lut(conversion_lut, params->mode);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
update_LUT(conversion_lut, params->frame, params->mode);
|
|
1003
|
+
|
|
1004
|
+
if (area.x < 0)
|
|
1005
|
+
{
|
|
1006
|
+
ptr += -area.x / 2;
|
|
1007
|
+
}
|
|
1008
|
+
if (area.y < 0)
|
|
1009
|
+
{
|
|
1010
|
+
ptr += (area.width / 2 + area.width % 2) * -area.y;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
for (int32_t i = 0; i < EPD_HEIGHT; i++)
|
|
1014
|
+
{
|
|
1015
|
+
if (i < area.y || i >= area.y + area.height)
|
|
1016
|
+
{
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
uint32_t *lp;
|
|
1021
|
+
bool shifted = false;
|
|
1022
|
+
if (area.width == EPD_WIDTH && area.x == 0)
|
|
1023
|
+
{
|
|
1024
|
+
lp = (uint32_t *)ptr;
|
|
1025
|
+
ptr += EPD_WIDTH / 2;
|
|
1026
|
+
}
|
|
1027
|
+
else
|
|
1028
|
+
{
|
|
1029
|
+
uint8_t *buf_start = (uint8_t *)line;
|
|
1030
|
+
uint32_t line_bytes = area.width / 2 + area.width % 2;
|
|
1031
|
+
if (area.x >= 0)
|
|
1032
|
+
{
|
|
1033
|
+
buf_start += area.x / 2;
|
|
1034
|
+
}
|
|
1035
|
+
else
|
|
1036
|
+
{
|
|
1037
|
+
// reduce line_bytes to actually used bytes
|
|
1038
|
+
line_bytes += area.x / 2;
|
|
1039
|
+
}
|
|
1040
|
+
line_bytes =
|
|
1041
|
+
min(line_bytes, EPD_WIDTH / 2 - (uint32_t)(buf_start - line));
|
|
1042
|
+
memcpy(buf_start, ptr, line_bytes);
|
|
1043
|
+
ptr += area.width / 2 + area.width % 2;
|
|
1044
|
+
|
|
1045
|
+
// mask last nibble for uneven width
|
|
1046
|
+
if (area.width % 2 == 1 && area.x / 2 + area.width / 2 + 1 < EPD_WIDTH)
|
|
1047
|
+
{
|
|
1048
|
+
*(buf_start + line_bytes - 1) |= 0xF0;
|
|
1049
|
+
}
|
|
1050
|
+
if (area.x % 2 == 1 && area.x < EPD_WIDTH)
|
|
1051
|
+
{
|
|
1052
|
+
shifted = true;
|
|
1053
|
+
// shift one nibble to right
|
|
1054
|
+
nibble_shift_buffer_right(
|
|
1055
|
+
buf_start, min(line_bytes + 1, (uint32_t)line + EPD_WIDTH / 2 -
|
|
1056
|
+
(uint32_t)buf_start));
|
|
1057
|
+
}
|
|
1058
|
+
lp = (uint32_t *)line;
|
|
1059
|
+
}
|
|
1060
|
+
xQueueSendToBack(output_queue, lp, portMAX_DELAY);
|
|
1061
|
+
if (shifted)
|
|
1062
|
+
{
|
|
1063
|
+
memset(line, 255, EPD_WIDTH / 2);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
vTaskDelay((const TickType_t )5);
|
|
1067
|
+
xSemaphoreGive(params->done_smphr);
|
|
1068
|
+
vTaskDelay(portMAX_DELAY);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
static void IRAM_ATTR feed_display(OutputParams *params)
|
|
1073
|
+
{
|
|
1074
|
+
Rect_t area = params->area;
|
|
1075
|
+
const int32_t *contrast_lut = contrast_cycles_4;
|
|
1076
|
+
switch (params->mode)
|
|
1077
|
+
{
|
|
1078
|
+
case WHITE_ON_WHITE:
|
|
1079
|
+
case BLACK_ON_WHITE:
|
|
1080
|
+
contrast_lut = contrast_cycles_4;
|
|
1081
|
+
break;
|
|
1082
|
+
case WHITE_ON_BLACK:
|
|
1083
|
+
contrast_lut = contrast_cycles_4_white;
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
epd_start_frame();
|
|
1088
|
+
for (int32_t i = 0; i < EPD_HEIGHT; i++)
|
|
1089
|
+
{
|
|
1090
|
+
if (i < area.y || i >= area.y + area.height)
|
|
1091
|
+
{
|
|
1092
|
+
skip_row(contrast_lut[params->frame]);
|
|
1093
|
+
continue;
|
|
1094
|
+
}
|
|
1095
|
+
uint8_t output[EPD_WIDTH / 2];
|
|
1096
|
+
xQueueReceive(output_queue, output, portMAX_DELAY);
|
|
1097
|
+
calc_epd_input_4bpp((uint32_t *)output, epd_get_current_buffer(),
|
|
1098
|
+
params->frame, conversion_lut);
|
|
1099
|
+
write_row(contrast_lut[params->frame]);
|
|
1100
|
+
}
|
|
1101
|
+
if (!skipping)
|
|
1102
|
+
{
|
|
1103
|
+
// Since we "pipeline" row output, we still have to latch out the last row.
|
|
1104
|
+
write_row(contrast_lut[params->frame]);
|
|
1105
|
+
}
|
|
1106
|
+
epd_end_frame();
|
|
1107
|
+
|
|
1108
|
+
xSemaphoreGive(params->done_smphr);
|
|
1109
|
+
vTaskDelay(portMAX_DELAY);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/******************************************************************************/
|
|
1113
|
+
/*** END OF FILE ***/
|
|
1114
|
+
/******************************************************************************/
|