@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.
Files changed (348) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +83 -0
  3. package/package.json +50 -0
  4. package/targets/cmake/geatsc-generated-archive-build.mjs +614 -0
  5. package/targets/cmake/geatsc_generated_archive.cmake +116 -0
  6. package/targets/cmake/geatsc_generated_archive_build.cmake +50 -0
  7. package/targets/esp32/app_project.cmake +33 -0
  8. package/targets/esp32/apps/app_manager.cpp +188 -0
  9. package/targets/esp32/apps/app_manager.h +10 -0
  10. package/targets/esp32/chip_bindings/README.md +58 -0
  11. package/targets/esp32/chip_bindings/audio/es8311.cpp +556 -0
  12. package/targets/esp32/chip_bindings/displays/co5300.cpp +510 -0
  13. package/targets/esp32/chip_bindings/displays/co5300.h +47 -0
  14. package/targets/esp32/chip_bindings/displays/co5300_async_stream.inc +79 -0
  15. package/targets/esp32/chip_bindings/displays/qspi_panel.h +65 -0
  16. package/targets/esp32/chip_bindings/displays/sh8601.cpp +583 -0
  17. package/targets/esp32/chip_bindings/displays/sh8601.h +36 -0
  18. package/targets/esp32/chip_bindings/gps/lc76g.cpp +296 -0
  19. package/targets/esp32/chip_bindings/gps/lc76g.h +7 -0
  20. package/targets/esp32/chip_bindings/imu/bmi270.cpp +299 -0
  21. package/targets/esp32/chip_bindings/imu/bmi270_config.inl +439 -0
  22. package/targets/esp32/chip_bindings/imu/qmi8658.cpp +213 -0
  23. package/targets/esp32/chip_bindings/power/axp2101.cpp +185 -0
  24. package/targets/esp32/chip_bindings/touch/cst9217.cpp +229 -0
  25. package/targets/esp32/chip_bindings/touch/cst9217_controller.h +78 -0
  26. package/targets/esp32/chip_bindings/touch/ft3168.cpp +340 -0
  27. package/targets/esp32/chip_bindings/touch/ft3168_controller.h +103 -0
  28. package/targets/esp32/chip_bindings/touch/ft6336.cpp +310 -0
  29. package/targets/esp32/chip_bindings/touch/ft6336_controller.h +90 -0
  30. package/targets/esp32/components/gea_framework/CMakeLists.txt +62 -0
  31. package/targets/esp32/connectivity/ble_hid.cpp +2916 -0
  32. package/targets/esp32/connectivity/ble_hid.h +8 -0
  33. package/targets/esp32/connectivity/diagnostics_transport.cpp +523 -0
  34. package/targets/esp32/connectivity/diagnostics_transport_offline.cpp +108 -0
  35. package/targets/esp32/connectivity/wifi.cpp +615 -0
  36. package/targets/esp32/connectivity/wifi_debug_offline.cpp +37 -0
  37. package/targets/esp32/connectivity/wifi_task_stack.h +119 -0
  38. package/targets/esp32/display.cpp +6010 -0
  39. package/targets/esp32/display_headless.cpp +468 -0
  40. package/targets/esp32/gea/platform_random.h +11 -0
  41. package/targets/esp32/gea_framework.cmake +382 -0
  42. package/targets/esp32/gpio.cpp +229 -0
  43. package/targets/esp32/host_sources.cmake +35 -0
  44. package/targets/esp32/imu_absent.cpp +36 -0
  45. package/targets/esp32/ldfragments/gea_ui_state_external.lf +35 -0
  46. package/targets/esp32/memory_config.h +64 -0
  47. package/targets/esp32/power_absent.cpp +22 -0
  48. package/targets/esp32/sdk-patches/0001-esp_ptr_dma_capable-accept-PSRAM.patch +70 -0
  49. package/targets/esp32/sdk-patches/0002-gdma-access_ext_mem-spi_master.patch +59 -0
  50. package/targets/esp32/sdk-patches/README.md +127 -0
  51. package/targets/esp32/services/app_runner.cpp +248 -0
  52. package/targets/esp32/services/app_state.cpp +56 -0
  53. package/targets/esp32/services/audio_runtime_stub.cpp +86 -0
  54. package/targets/esp32/services/battery_service.cpp +31 -0
  55. package/targets/esp32/services/device_control.cpp +1896 -0
  56. package/targets/esp32/services/device_control.h +31 -0
  57. package/targets/esp32/services/frame_scheduler.cpp +1571 -0
  58. package/targets/esp32/services/heap.cpp +129 -0
  59. package/targets/esp32/services/memory.cpp +103 -0
  60. package/targets/esp32/services/ota.cpp +840 -0
  61. package/targets/esp32/services/ota_image.cpp +162 -0
  62. package/targets/esp32/services/ota_image.h +16 -0
  63. package/targets/esp32/services/storage_service.cpp +159 -0
  64. package/targets/esp32/touch_absent.cpp +44 -0
  65. package/targets/esp32-m5stack-m5paper/CMakeLists.txt +10 -0
  66. package/targets/esp32-m5stack-m5paper/README.md +55 -0
  67. package/targets/esp32-m5stack-m5paper/dependencies.lock +76 -0
  68. package/targets/esp32-m5stack-m5paper/main/CMakeLists.txt +46 -0
  69. package/targets/esp32-m5stack-m5paper/main/Kconfig.projbuild +10 -0
  70. package/targets/esp32-m5stack-m5paper/main/app_main.cpp +114 -0
  71. package/targets/esp32-m5stack-m5paper/main/audio_stub.cpp +27 -0
  72. package/targets/esp32-m5stack-m5paper/main/buttons.cpp +111 -0
  73. package/targets/esp32-m5stack-m5paper/main/display.cpp +1074 -0
  74. package/targets/esp32-m5stack-m5paper/main/i2c.cpp +36 -0
  75. package/targets/esp32-m5stack-m5paper/main/idf_component.yml +7 -0
  76. package/targets/esp32-m5stack-m5paper/main/imu_stub.cpp +20 -0
  77. package/targets/esp32-m5stack-m5paper/main/include/board.h +100 -0
  78. package/targets/esp32-m5stack-m5paper/main/include/buttons.h +8 -0
  79. package/targets/esp32-m5stack-m5paper/main/launcher_button.cpp +82 -0
  80. package/targets/esp32-m5stack-m5paper/main/m5paper_psram.lf +20 -0
  81. package/targets/esp32-m5stack-m5paper/main/power.cpp +73 -0
  82. package/targets/esp32-m5stack-m5paper/main/sdcard_mount.cpp +82 -0
  83. package/targets/esp32-m5stack-m5paper/main/touch.cpp +279 -0
  84. package/targets/esp32-m5stack-m5paper/partitions.csv +9 -0
  85. package/targets/esp32-m5stack-m5paper/sdkconfig.defaults +84 -0
  86. package/targets/esp32-p4-m5stack-tab5/CMakeLists.txt +10 -0
  87. package/targets/esp32-p4-m5stack-tab5/dependencies.lock +276 -0
  88. package/targets/esp32-p4-m5stack-tab5/main/CMakeLists.txt +586 -0
  89. package/targets/esp32-p4-m5stack-tab5/main/Kconfig.projbuild +12 -0
  90. package/targets/esp32-p4-m5stack-tab5/main/app_main.cpp +177 -0
  91. package/targets/esp32-p4-m5stack-tab5/main/camera.cpp +2025 -0
  92. package/targets/esp32-p4-m5stack-tab5/main/display.cpp +4033 -0
  93. package/targets/esp32-p4-m5stack-tab5/main/fatfs_ffconf.h +383 -0
  94. package/targets/esp32-p4-m5stack-tab5/main/i2c.cpp +39 -0
  95. package/targets/esp32-p4-m5stack-tab5/main/idf_component.yml +21 -0
  96. package/targets/esp32-p4-m5stack-tab5/main/include/board.h +130 -0
  97. package/targets/esp32-p4-m5stack-tab5/main/include/tab5_drivers.h +68 -0
  98. package/targets/esp32-p4-m5stack-tab5/main/include/wifi_config.h.example +5 -0
  99. package/targets/esp32-p4-m5stack-tab5/main/launcher_button.cpp +188 -0
  100. package/targets/esp32-p4-m5stack-tab5/main/power.cpp +22 -0
  101. package/targets/esp32-p4-m5stack-tab5/main/sdcard_mount.cpp +125 -0
  102. package/targets/esp32-p4-m5stack-tab5/main/tab5_audio.cpp +345 -0
  103. package/targets/esp32-p4-m5stack-tab5/main/tab5_drivers.cpp +871 -0
  104. package/targets/esp32-p4-m5stack-tab5/main/tab5_imu.cpp +246 -0
  105. package/targets/esp32-p4-m5stack-tab5/main/touch.cpp +206 -0
  106. package/targets/esp32-p4-m5stack-tab5/partitions.csv +12 -0
  107. package/targets/esp32-p4-m5stack-tab5/sdkconfig.defaults +128 -0
  108. package/targets/esp32-p4-waveshare-touch-lcd-3.5/CMakeLists.txt +19 -0
  109. package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/0001-esp_video-csi-raw-passthrough-p4-rev-lt-v3.patch +28 -0
  110. package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/README.md +45 -0
  111. package/targets/esp32-p4-waveshare-touch-lcd-3.5/component-patches/apply.sh +37 -0
  112. package/targets/esp32-p4-waveshare-touch-lcd-3.5/dependencies.lock +196 -0
  113. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/CMakeLists.txt +562 -0
  114. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/Kconfig.projbuild +12 -0
  115. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/app_main.cpp +166 -0
  116. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/camera.cpp +2105 -0
  117. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/display.cpp +1730 -0
  118. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/fatfs_ffconf.h +383 -0
  119. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/i2c.cpp +39 -0
  120. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/idf_component.yml +11 -0
  121. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/board.h +87 -0
  122. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/panel_native.h +59 -0
  123. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/include/wifi_config.h.example +5 -0
  124. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/launcher_button.cpp +191 -0
  125. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/power.cpp +15 -0
  126. package/targets/esp32-p4-waveshare-touch-lcd-3.5/main/touch.cpp +306 -0
  127. package/targets/esp32-p4-waveshare-touch-lcd-3.5/partitions.csv +13 -0
  128. package/targets/esp32-p4-waveshare-touch-lcd-3.5/patches/README.md +22 -0
  129. package/targets/esp32-p4-waveshare-touch-lcd-3.5/patches/espressif__esp_video-csi-bypass.patch +28 -0
  130. package/targets/esp32-p4-waveshare-touch-lcd-3.5/sdkconfig.defaults +109 -0
  131. package/targets/esp32-p4-waveshare-touch-lcd-3.5/tools/README-camera-capture.md +84 -0
  132. package/targets/esp32-p4-waveshare-touch-lcd-3.5/tools/capture-camera.py +369 -0
  133. package/targets/esp32-p4-waveshare-touch-lcd-7/CMakeLists.txt +10 -0
  134. package/targets/esp32-p4-waveshare-touch-lcd-7/dependencies.lock +258 -0
  135. package/targets/esp32-p4-waveshare-touch-lcd-7/main/CMakeLists.txt +577 -0
  136. package/targets/esp32-p4-waveshare-touch-lcd-7/main/Kconfig.projbuild +12 -0
  137. package/targets/esp32-p4-waveshare-touch-lcd-7/main/app_main.cpp +177 -0
  138. package/targets/esp32-p4-waveshare-touch-lcd-7/main/camera.cpp +1935 -0
  139. package/targets/esp32-p4-waveshare-touch-lcd-7/main/display.cpp +2832 -0
  140. package/targets/esp32-p4-waveshare-touch-lcd-7/main/fatfs_ffconf.h +383 -0
  141. package/targets/esp32-p4-waveshare-touch-lcd-7/main/i2c.cpp +39 -0
  142. package/targets/esp32-p4-waveshare-touch-lcd-7/main/idf_component.yml +23 -0
  143. package/targets/esp32-p4-waveshare-touch-lcd-7/main/include/board.h +68 -0
  144. package/targets/esp32-p4-waveshare-touch-lcd-7/main/include/wifi_config.h.example +5 -0
  145. package/targets/esp32-p4-waveshare-touch-lcd-7/main/launcher_button.cpp +191 -0
  146. package/targets/esp32-p4-waveshare-touch-lcd-7/main/power.cpp +15 -0
  147. package/targets/esp32-p4-waveshare-touch-lcd-7/main/sdcard_mount.cpp +125 -0
  148. package/targets/esp32-p4-waveshare-touch-lcd-7/main/touch.cpp +332 -0
  149. package/targets/esp32-p4-waveshare-touch-lcd-7/partitions.csv +12 -0
  150. package/targets/esp32-p4-waveshare-touch-lcd-7/sdkconfig.defaults +122 -0
  151. package/targets/esp32-p4-waveshare-touch-lcd-7/tools/README-camera-capture.md +84 -0
  152. package/targets/esp32-p4-waveshare-touch-lcd-7/tools/capture-camera.py +369 -0
  153. package/targets/esp32-s3-devkit-n16r8.json +31 -0
  154. package/targets/esp32-s3-elecrow-rotary-2.1/CMakeLists.txt +10 -0
  155. package/targets/esp32-s3-elecrow-rotary-2.1/dependencies.lock +40 -0
  156. package/targets/esp32-s3-elecrow-rotary-2.1/main/CMakeLists.txt +549 -0
  157. package/targets/esp32-s3-elecrow-rotary-2.1/main/Kconfig.projbuild +12 -0
  158. package/targets/esp32-s3-elecrow-rotary-2.1/main/app_main.cpp +187 -0
  159. package/targets/esp32-s3-elecrow-rotary-2.1/main/display_rgb.cpp +1338 -0
  160. package/targets/esp32-s3-elecrow-rotary-2.1/main/i2c.cpp +39 -0
  161. package/targets/esp32-s3-elecrow-rotary-2.1/main/idf_component.yml +5 -0
  162. package/targets/esp32-s3-elecrow-rotary-2.1/main/include/board.h +142 -0
  163. package/targets/esp32-s3-elecrow-rotary-2.1/main/include/pcf8574.h +16 -0
  164. package/targets/esp32-s3-elecrow-rotary-2.1/main/include/rotary_encoder.h +7 -0
  165. package/targets/esp32-s3-elecrow-rotary-2.1/main/launcher_button.cpp +191 -0
  166. package/targets/esp32-s3-elecrow-rotary-2.1/main/pcf8574.cpp +86 -0
  167. package/targets/esp32-s3-elecrow-rotary-2.1/main/platform_stubs.cpp +47 -0
  168. package/targets/esp32-s3-elecrow-rotary-2.1/main/rotary_encoder.cpp +135 -0
  169. package/targets/esp32-s3-elecrow-rotary-2.1/main/touch.cpp +250 -0
  170. package/targets/esp32-s3-elecrow-rotary-2.1/partitions.csv +8 -0
  171. package/targets/esp32-s3-elecrow-rotary-2.1/sdkconfig.defaults +116 -0
  172. package/targets/esp32-s3-epaper-1.54/CMakeLists.txt +10 -0
  173. package/targets/esp32-s3-epaper-1.54/dependencies.lock +76 -0
  174. package/targets/esp32-s3-epaper-1.54/main/CMakeLists.txt +691 -0
  175. package/targets/esp32-s3-epaper-1.54/main/Kconfig.projbuild +12 -0
  176. package/targets/esp32-s3-epaper-1.54/main/app_main.cpp +181 -0
  177. package/targets/esp32-s3-epaper-1.54/main/buttons.cpp +144 -0
  178. package/targets/esp32-s3-epaper-1.54/main/display.cpp +1281 -0
  179. package/targets/esp32-s3-epaper-1.54/main/fatfs_ffconf.h +377 -0
  180. package/targets/esp32-s3-epaper-1.54/main/i2c.cpp +39 -0
  181. package/targets/esp32-s3-epaper-1.54/main/idf_component.yml +7 -0
  182. package/targets/esp32-s3-epaper-1.54/main/imu_stub.cpp +21 -0
  183. package/targets/esp32-s3-epaper-1.54/main/include/board.h +119 -0
  184. package/targets/esp32-s3-epaper-1.54/main/include/buttons.h +9 -0
  185. package/targets/esp32-s3-epaper-1.54/main/include/wifi_config.h.example +5 -0
  186. package/targets/esp32-s3-epaper-1.54/main/launcher_button.cpp +191 -0
  187. package/targets/esp32-s3-epaper-1.54/main/power.cpp +15 -0
  188. package/targets/esp32-s3-epaper-1.54/main/sdcard_mount.cpp +89 -0
  189. package/targets/esp32-s3-epaper-1.54/main/touch.cpp +299 -0
  190. package/targets/esp32-s3-epaper-1.54/partitions.csv +8 -0
  191. package/targets/esp32-s3-epaper-1.54/sdkconfig.defaults +217 -0
  192. package/targets/esp32-s3-lilygo-t-display-s3-long/CMakeLists.txt +10 -0
  193. package/targets/esp32-s3-lilygo-t-display-s3-long/README.md +29 -0
  194. package/targets/esp32-s3-lilygo-t-display-s3-long/dependencies.lock +116 -0
  195. package/targets/esp32-s3-lilygo-t-display-s3-long/main/CMakeLists.txt +90 -0
  196. package/targets/esp32-s3-lilygo-t-display-s3-long/main/idf_component.yml +7 -0
  197. package/targets/esp32-s3-lilygo-t-display-s3-long/main/include/board.h +61 -0
  198. package/targets/esp32-s3-lilygo-t-display-s3-long/main/touch.cpp +299 -0
  199. package/targets/esp32-s3-lilygo-t-display-s3-long/partitions.csv +7 -0
  200. package/targets/esp32-s3-lilygo-t-display-s3-long/sdkconfig.defaults +50 -0
  201. package/targets/esp32-s3-lilygo-t5-epaper-4.7/CMakeLists.txt +12 -0
  202. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/CMakeLists.txt +17 -0
  203. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/ed047tc1.c +269 -0
  204. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/ed047tc1.h +142 -0
  205. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/epd_driver.c +1114 -0
  206. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/epd_driver.h +410 -0
  207. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/gea_epd.c +989 -0
  208. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/i2s_data_bus.c +489 -0
  209. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/i2s_data_bus.h +104 -0
  210. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/rmt_pulse.c +136 -0
  211. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/rmt_pulse.h +78 -0
  212. package/targets/esp32-s3-lilygo-t5-epaper-4.7/components/epd_driver/utilities.h +49 -0
  213. package/targets/esp32-s3-lilygo-t5-epaper-4.7/dependencies.lock +35 -0
  214. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/CMakeLists.txt +30 -0
  215. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/Kconfig.projbuild +10 -0
  216. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/app_main.cpp +95 -0
  217. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/audio_stub.cpp +27 -0
  218. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/buttons.cpp +40 -0
  219. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/display.cpp +627 -0
  220. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/i2c.cpp +36 -0
  221. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/idf_component.yml +4 -0
  222. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/imu_stub.cpp +20 -0
  223. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/include/board.h +85 -0
  224. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/include/buttons.h +8 -0
  225. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/launcher_button.cpp +82 -0
  226. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/power.cpp +36 -0
  227. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/sdcard_mount.cpp +90 -0
  228. package/targets/esp32-s3-lilygo-t5-epaper-4.7/main/touch.cpp +293 -0
  229. package/targets/esp32-s3-lilygo-t5-epaper-4.7/partitions.csv +9 -0
  230. package/targets/esp32-s3-lilygo-t5-epaper-4.7/sdkconfig.defaults +217 -0
  231. package/targets/esp32-s3-m5stack-papers3/CMakeLists.txt +13 -0
  232. package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/CMakeLists.txt +5 -0
  233. package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/include/papers3_epd.h +74 -0
  234. package/targets/esp32-s3-m5stack-papers3/components/papers3_epd/papers3_epd.c +671 -0
  235. package/targets/esp32-s3-m5stack-papers3/dependencies.lock +76 -0
  236. package/targets/esp32-s3-m5stack-papers3/main/CMakeLists.txt +64 -0
  237. package/targets/esp32-s3-m5stack-papers3/main/Kconfig.projbuild +10 -0
  238. package/targets/esp32-s3-m5stack-papers3/main/app_main.cpp +96 -0
  239. package/targets/esp32-s3-m5stack-papers3/main/audio_stub.cpp +27 -0
  240. package/targets/esp32-s3-m5stack-papers3/main/buttons.cpp +49 -0
  241. package/targets/esp32-s3-m5stack-papers3/main/display.cpp +706 -0
  242. package/targets/esp32-s3-m5stack-papers3/main/i2c.cpp +36 -0
  243. package/targets/esp32-s3-m5stack-papers3/main/idf_component.yml +14 -0
  244. package/targets/esp32-s3-m5stack-papers3/main/imu.cpp +351 -0
  245. package/targets/esp32-s3-m5stack-papers3/main/include/board.h +101 -0
  246. package/targets/esp32-s3-m5stack-papers3/main/include/buttons.h +8 -0
  247. package/targets/esp32-s3-m5stack-papers3/main/launcher_button.cpp +96 -0
  248. package/targets/esp32-s3-m5stack-papers3/main/power.cpp +102 -0
  249. package/targets/esp32-s3-m5stack-papers3/main/sdcard_mount.cpp +88 -0
  250. package/targets/esp32-s3-m5stack-papers3/main/touch.cpp +287 -0
  251. package/targets/esp32-s3-m5stack-papers3/partitions.csv +9 -0
  252. package/targets/esp32-s3-m5stack-papers3/sdkconfig.defaults +232 -0
  253. package/targets/esp32-s3-m5stack-sticks3/CMakeLists.txt +10 -0
  254. package/targets/esp32-s3-m5stack-sticks3/dependencies.lock +51 -0
  255. package/targets/esp32-s3-m5stack-sticks3/main/CMakeLists.txt +51 -0
  256. package/targets/esp32-s3-m5stack-sticks3/main/Kconfig.projbuild +12 -0
  257. package/targets/esp32-s3-m5stack-sticks3/main/app_main.cpp +130 -0
  258. package/targets/esp32-s3-m5stack-sticks3/main/buttons.cpp +101 -0
  259. package/targets/esp32-s3-m5stack-sticks3/main/display.cpp +1391 -0
  260. package/targets/esp32-s3-m5stack-sticks3/main/i2c.cpp +39 -0
  261. package/targets/esp32-s3-m5stack-sticks3/main/idf_component.yml +8 -0
  262. package/targets/esp32-s3-m5stack-sticks3/main/imu_stub.cpp +9 -0
  263. package/targets/esp32-s3-m5stack-sticks3/main/include/board.h +89 -0
  264. package/targets/esp32-s3-m5stack-sticks3/main/include/buttons.h +9 -0
  265. package/targets/esp32-s3-m5stack-sticks3/main/launcher_button.cpp +191 -0
  266. package/targets/esp32-s3-m5stack-sticks3/main/power.cpp +15 -0
  267. package/targets/esp32-s3-m5stack-sticks3/main/sdcard_mount.cpp +8 -0
  268. package/targets/esp32-s3-m5stack-sticks3/main/touch.cpp +65 -0
  269. package/targets/esp32-s3-m5stack-sticks3/partitions.csv +8 -0
  270. package/targets/esp32-s3-m5stack-sticks3/sdkconfig.defaults +130 -0
  271. package/targets/esp32-s3-touch-amoled-1.75/CMakeLists.txt +10 -0
  272. package/targets/esp32-s3-touch-amoled-1.75/dependencies.lock +130 -0
  273. package/targets/esp32-s3-touch-amoled-1.75/main/CMakeLists.txt +589 -0
  274. package/targets/esp32-s3-touch-amoled-1.75/main/Kconfig.projbuild +12 -0
  275. package/targets/esp32-s3-touch-amoled-1.75/main/app_main.cpp +153 -0
  276. package/targets/esp32-s3-touch-amoled-1.75/main/i2c.cpp +39 -0
  277. package/targets/esp32-s3-touch-amoled-1.75/main/idf_component.yml +9 -0
  278. package/targets/esp32-s3-touch-amoled-1.75/main/include/board.h +110 -0
  279. package/targets/esp32-s3-touch-amoled-1.75/main/include/wifi_config.h.example +5 -0
  280. package/targets/esp32-s3-touch-amoled-1.75/main/launcher_button.cpp +191 -0
  281. package/targets/esp32-s3-touch-amoled-1.75/main/touch.cpp +45 -0
  282. package/targets/esp32-s3-touch-amoled-1.75/partitions.csv +8 -0
  283. package/targets/esp32-s3-touch-amoled-1.75/sdkconfig.defaults +179 -0
  284. package/targets/esp32-s3-touch-amoled-1.8/CMakeLists.txt +10 -0
  285. package/targets/esp32-s3-touch-amoled-1.8/dependencies.lock +105 -0
  286. package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +768 -0
  287. package/targets/esp32-s3-touch-amoled-1.8/main/Kconfig.projbuild +12 -0
  288. package/targets/esp32-s3-touch-amoled-1.8/main/app_main.cpp +172 -0
  289. package/targets/esp32-s3-touch-amoled-1.8/main/i2c.cpp +39 -0
  290. package/targets/esp32-s3-touch-amoled-1.8/main/idf_component.yml +8 -0
  291. package/targets/esp32-s3-touch-amoled-1.8/main/include/board.h +83 -0
  292. package/targets/esp32-s3-touch-amoled-1.8/main/include/wifi_config.h.example +5 -0
  293. package/targets/esp32-s3-touch-amoled-1.8/main/launcher_button.cpp +191 -0
  294. package/targets/esp32-s3-touch-amoled-1.8/main/touch.cpp +41 -0
  295. package/targets/esp32-s3-touch-amoled-1.8/partitions.csv +8 -0
  296. package/targets/esp32-s3-touch-amoled-1.8/sdkconfig.defaults +179 -0
  297. package/targets/esp32-s3-touch-amoled-2.06/CMakeLists.txt +10 -0
  298. package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +64 -0
  299. package/targets/esp32-s3-touch-amoled-2.06/main/CMakeLists.txt +1121 -0
  300. package/targets/esp32-s3-touch-amoled-2.06/main/Kconfig.projbuild +12 -0
  301. package/targets/esp32-s3-touch-amoled-2.06/main/app_main.cpp +333 -0
  302. package/targets/esp32-s3-touch-amoled-2.06/main/i2c.cpp +39 -0
  303. package/targets/esp32-s3-touch-amoled-2.06/main/idf_component.yml +27 -0
  304. package/targets/esp32-s3-touch-amoled-2.06/main/include/board.h +114 -0
  305. package/targets/esp32-s3-touch-amoled-2.06/main/include/wifi_config.h.example +5 -0
  306. package/targets/esp32-s3-touch-amoled-2.06/main/launcher_button.cpp +199 -0
  307. package/targets/esp32-s3-touch-amoled-2.06/main/sdcard_mount.cpp +105 -0
  308. package/targets/esp32-s3-touch-amoled-2.06/main/touch.cpp +49 -0
  309. package/targets/esp32-s3-touch-amoled-2.06/partitions.csv +14 -0
  310. package/targets/esp32-s3-touch-amoled-2.06/sdkconfig.defaults +273 -0
  311. package/targets/esp32-s3-touch-amoled-2.41/CMakeLists.txt +10 -0
  312. package/targets/esp32-s3-touch-amoled-2.41/main/CMakeLists.txt +71 -0
  313. package/targets/esp32-s3-touch-amoled-2.41/main/Kconfig.projbuild +12 -0
  314. package/targets/esp32-s3-touch-amoled-2.41/main/idf_component.yml +27 -0
  315. package/targets/esp32-s3-touch-amoled-2.41/main/include/board.h +108 -0
  316. package/targets/esp32-s3-touch-amoled-2.41/main/include/wifi_config.h.example +5 -0
  317. package/targets/esp32-s3-touch-amoled-2.41/main/panel_reset.cpp +82 -0
  318. package/targets/esp32-s3-touch-amoled-2.41/main/touch.cpp +49 -0
  319. package/targets/esp32-s3-touch-amoled-2.41/partitions.csv +8 -0
  320. package/targets/esp32-s3-touch-amoled-2.41/sdkconfig.defaults +273 -0
  321. package/targets/rp2350-tufty-2350/CMakeLists.txt +348 -0
  322. package/targets/rp2350-tufty-2350/README.md +53 -0
  323. package/targets/rp2350-tufty-2350/boards/pimoroni_tufty2350.h +87 -0
  324. package/targets/rp2350-tufty-2350/main/bringup.cpp +187 -0
  325. package/targets/rp2350-tufty-2350/main/include/board.h +124 -0
  326. package/targets/rp2350-tufty-2350/main/rp2350_panel.cpp +428 -0
  327. package/targets/rp2350-tufty-2350/main/rp2350_panel.h +46 -0
  328. package/targets/rp2350-tufty-2350/main/st7789_parallel.pio +7 -0
  329. package/targets/rp2350-waveshare-touch-amoled-2.41/CMakeLists.txt +345 -0
  330. package/targets/rp2350-waveshare-touch-amoled-2.41/README.md +153 -0
  331. package/targets/rp2350-waveshare-touch-amoled-2.41/boards/waveshare_rp2350_touch_amoled_2_41.h +59 -0
  332. package/targets/rp2350-waveshare-touch-amoled-2.41/main/app.cpp +984 -0
  333. package/targets/rp2350-waveshare-touch-amoled-2.41/main/bringup.cpp +222 -0
  334. package/targets/rp2350-waveshare-touch-amoled-2.41/main/include/board.h +138 -0
  335. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.cpp +2553 -0
  336. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_gea_platform.h +18 -0
  337. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_host_fetch_stub.cpp +64 -0
  338. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.cpp +677 -0
  339. package/targets/rp2350-waveshare-touch-amoled-2.41/main/rp2350_panel.h +48 -0
  340. package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/rp_pico_alloc.c +354 -0
  341. package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/rp_pico_alloc.h +56 -0
  342. package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf.c +1284 -0
  343. package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf.h +95 -0
  344. package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf_block_functions.h +123 -0
  345. package/targets/rp2350-waveshare-touch-amoled-2.41/main/vendor/waveshare_psram/tlsf/tlsf_common.h +127 -0
  346. package/targets/rp2350-waveshare-touch-amoled-2.41/tools/rp2350-scroll-bench.py +162 -0
  347. package/targets/rp2350-waveshare-touch-amoled-2.41/tools/rp2350-scroll-parity.py +198 -0
  348. package/targets.json +154 -0
@@ -0,0 +1,36 @@
1
+ #include "i2c.h"
2
+
3
+ #include "board.h"
4
+
5
+ #include "driver/i2c_master.h"
6
+ #include "esp_err.h"
7
+ #include "esp_log.h"
8
+
9
+ namespace {
10
+
11
+ constexpr char kTag[] = "papers3_i2c";
12
+ i2c_master_bus_handle_t primaryBus = nullptr;
13
+
14
+ } // namespace
15
+
16
+ gea::platform::i2c::Bus gea::platform::i2c::Bus::primary()
17
+ {
18
+ if (primaryBus) return Bus(primaryBus);
19
+
20
+ i2c_master_bus_config_t config = {};
21
+ config.i2c_port = -1;
22
+ config.sda_io_num = gea::platform::board::i2c.sda;
23
+ config.scl_io_num = gea::platform::board::i2c.scl;
24
+ config.clk_source = I2C_CLK_SRC_DEFAULT;
25
+ config.glitch_ignore_cnt = 7;
26
+ config.flags.enable_internal_pullup = true;
27
+
28
+ const esp_err_t err = i2c_new_master_bus(&config, &primaryBus);
29
+ if (err != ESP_OK) {
30
+ ESP_LOGE(kTag, "I2C init failed: %s", esp_err_to_name(err));
31
+ primaryBus = nullptr;
32
+ return Bus(nullptr);
33
+ }
34
+ ESP_LOGI(kTag, "I2C ready SDA=%d SCL=%d", static_cast<int>(config.sda_io_num), static_cast<int>(config.scl_io_num));
35
+ return Bus(primaryBus);
36
+ }
@@ -0,0 +1,14 @@
1
+ dependencies:
2
+ espressif/esp_websocket_client: '^1.4'
3
+ # 1.5.0 requires LWIP IPv6 (sockaddr_in6); this target disables IPv6.
4
+ espressif/esp_peer: '~1.4.0'
5
+ espressif/esp_lcd_touch_gt911: '^1'
6
+ # Required even though this board has no speaker: the shared e-paper recipe
7
+ # appends esp_codec_dev to the audio REQUIRES whenever the APP declares an
8
+ # audio capability (button-tetris does). Without it the build fails at CMake
9
+ # with "Failed to resolve component 'esp_codec_dev'". The M5Paper target
10
+ # declares it for the same reason; audio itself stays stubbed out via
11
+ # GEA_EMBEDDED_AUDIO_DISABLED / audio_stub.cpp.
12
+ espressif/esp_codec_dev: '^1.4.0'
13
+ idf:
14
+ version: '>=5.3'
@@ -0,0 +1,351 @@
1
+ // M5PaperS3 IMU — Bosch BMI270 accelerometer + gyroscope on the shared I2C bus.
2
+ //
3
+ // The register sequence, scaling and configuration payload are the ones proven
4
+ // on the M5Stack Tab5 target (targets/esp32-p4-m5stack-tab5/main/tab5_drivers.cpp),
5
+ // which carries the same part. The BMI270 will not produce valid data until the
6
+ // configuration file below has been uploaded once after reset.
7
+
8
+ #include "imu.h"
9
+
10
+ #include "board.h"
11
+ #include "i2c.h"
12
+
13
+ #include <atomic>
14
+ #include <cmath>
15
+ #include <cstring>
16
+ #include <mutex>
17
+
18
+ #include "driver/i2c_master.h"
19
+ #include "esp_log.h"
20
+ #include "freertos/FreeRTOS.h"
21
+ #include "freertos/task.h"
22
+
23
+ namespace {
24
+
25
+ constexpr char kTag[] = "papers3_imu";
26
+
27
+ constexpr double kStandardGravity = 9.80665;
28
+ constexpr double kRadiansToDegrees = 57.29577951308232;
29
+ constexpr int kSampleIntervalMs = 16;
30
+ // Bring-up telemetry: one reading per second on the serial log. Axis mapping and
31
+ // the tiltX sign are confirmed on hardware, so this is off; flip it on to
32
+ // re-verify orientation (e.g. when fixing tiltY for a pitch-using app).
33
+ constexpr bool kLogSamples = false;
34
+
35
+ // The part answers at 0x68 with SDO low and 0x69 with SDO high. M5 does not
36
+ // document which strap this board uses, so probe both and log the winner
37
+ // rather than hardcoding a guess.
38
+ constexpr std::uint8_t kAddressPrimary = 0x68;
39
+ constexpr std::uint8_t kAddressSecondary = 0x69;
40
+
41
+ constexpr std::uint8_t kRegChipId = 0x00;
42
+ constexpr std::uint8_t kRegInternalStatus = 0x21;
43
+ constexpr std::uint8_t kRegAccX = 0x0c;
44
+ constexpr std::uint8_t kRegAccConf = 0x40;
45
+ constexpr std::uint8_t kRegAccRange = 0x41;
46
+ constexpr std::uint8_t kRegGyrConf = 0x42;
47
+ constexpr std::uint8_t kRegGyrRange = 0x43;
48
+ constexpr std::uint8_t kRegInitCtrl = 0x59;
49
+ constexpr std::uint8_t kRegInitAddr0 = 0x5b;
50
+ constexpr std::uint8_t kRegInitData = 0x5e;
51
+ constexpr std::uint8_t kRegPwrConf = 0x7c;
52
+ constexpr std::uint8_t kRegPwrCtrl = 0x7d;
53
+ constexpr std::uint8_t kRegCmd = 0x7e;
54
+
55
+ constexpr std::uint8_t kChipId = 0x24;
56
+ constexpr std::uint8_t kSoftReset = 0xb6;
57
+ constexpr std::uint8_t kInternalStatusInitOk = 0x01;
58
+ constexpr std::uint8_t kAccConf100HzNormal = 0xa8;
59
+ constexpr std::uint8_t kAccRange4g = 0x01;
60
+ constexpr std::uint8_t kGyrConf100HzNormal = 0xe8;
61
+ constexpr std::uint8_t kGyrRange2000Dps = 0x00;
62
+ constexpr std::uint8_t kPowerAccelGyroTemp = 0x0e;
63
+ constexpr std::size_t kConfigChunkSize = 32;
64
+ constexpr int kTimeoutMs = 250;
65
+
66
+ // Accelerometer at +/-4 g -> 8192 LSB/g; gyroscope at +/-2000 dps -> 16.4 LSB/dps.
67
+ constexpr double kAccelLsbPerG = 8192.0;
68
+ constexpr double kGyroLsbPerDps = 16.4;
69
+
70
+ // Bosch Sensortec BMI270 SensorAPI v2.86.1 maximum-FIFO configuration file.
71
+ constexpr std::uint8_t kConfigFile[] = {
72
+ 0xc8, 0x2e, 0x00, 0x2e, 0x80, 0x2e, 0x1a, 0x00, 0xc8, 0x2e, 0x00, 0x2e, 0xc8, 0x2e, 0x00, 0x2e,
73
+ 0xc8, 0x2e, 0x00, 0x2e, 0xc8, 0x2e, 0x00, 0x2e, 0xc8, 0x2e, 0x00, 0x2e, 0xc8, 0x2e, 0x00, 0x2e,
74
+ 0x90, 0x32, 0x21, 0x2e, 0x59, 0xf5, 0x10, 0x30, 0x21, 0x2e, 0x6a, 0xf5, 0x1a, 0x24, 0x22, 0x00,
75
+ 0x80, 0x2e, 0x3b, 0x00, 0xc8, 0x2e, 0x44, 0x47, 0x22, 0x00, 0x37, 0x00, 0xa4, 0x00, 0xff, 0x0f,
76
+ 0xd1, 0x00, 0x07, 0xad, 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1,
77
+ 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1,
78
+ 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1, 0x80, 0x2e, 0x00, 0xc1,
79
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x24, 0xfc, 0xf5, 0x80, 0x30, 0x40, 0x42, 0x50, 0x50,
80
+ 0x00, 0x30, 0x12, 0x24, 0xeb, 0x00, 0x03, 0x30, 0x00, 0x2e, 0xc1, 0x86, 0x5a, 0x0e, 0xfb, 0x2f,
81
+ 0x21, 0x2e, 0xfc, 0xf5, 0x13, 0x24, 0x63, 0xf5, 0xe0, 0x3c, 0x48, 0x00, 0x22, 0x30, 0xf7, 0x80,
82
+ 0xc2, 0x42, 0xe1, 0x7f, 0x3a, 0x25, 0xfc, 0x86, 0xf0, 0x7f, 0x41, 0x33, 0x98, 0x2e, 0xc2, 0xc4,
83
+ 0xd6, 0x6f, 0xf1, 0x30, 0xf1, 0x08, 0xc4, 0x6f, 0x11, 0x24, 0xff, 0x03, 0x12, 0x24, 0x00, 0xfc,
84
+ 0x61, 0x09, 0xa2, 0x08, 0x36, 0xbe, 0x2a, 0xb9, 0x13, 0x24, 0x38, 0x00, 0x64, 0xbb, 0xd1, 0xbe,
85
+ 0x94, 0x0a, 0x71, 0x08, 0xd5, 0x42, 0x21, 0xbd, 0x91, 0xbc, 0xd2, 0x42, 0xc1, 0x42, 0x00, 0xb2,
86
+ 0xfe, 0x82, 0x05, 0x2f, 0x50, 0x30, 0x21, 0x2e, 0x21, 0xf2, 0x00, 0x2e, 0x00, 0x2e, 0xd0, 0x2e,
87
+ 0xf0, 0x6f, 0x02, 0x30, 0x02, 0x42, 0x20, 0x26, 0xe0, 0x6f, 0x02, 0x31, 0x03, 0x40, 0x9a, 0x0a,
88
+ 0x02, 0x42, 0xf0, 0x37, 0x05, 0x2e, 0x5e, 0xf7, 0x10, 0x08, 0x12, 0x24, 0x1e, 0xf2, 0x80, 0x42,
89
+ 0x83, 0x84, 0xf1, 0x7f, 0x0a, 0x25, 0x13, 0x30, 0x83, 0x42, 0x3b, 0x82, 0xf0, 0x6f, 0x00, 0x2e,
90
+ 0x00, 0x2e, 0xd0, 0x2e, 0x12, 0x40, 0x52, 0x42, 0x00, 0x2e, 0x12, 0x40, 0x52, 0x42, 0x3e, 0x84,
91
+ 0x00, 0x40, 0x40, 0x42, 0x7e, 0x82, 0xe1, 0x7f, 0xf2, 0x7f, 0x98, 0x2e, 0x6a, 0xd6, 0x21, 0x30,
92
+ 0x23, 0x2e, 0x61, 0xf5, 0xeb, 0x2c, 0xe1, 0x6f,
93
+ };
94
+ static_assert(sizeof(kConfigFile) == 328);
95
+
96
+ struct Vector3 {
97
+ double x = 0.0;
98
+ double y = 0.0;
99
+ double z = 0.0;
100
+ };
101
+
102
+ std::int16_t le16s(const std::uint8_t *p)
103
+ {
104
+ return static_cast<std::int16_t>(static_cast<std::uint16_t>(p[0]) | (static_cast<std::uint16_t>(p[1]) << 8));
105
+ }
106
+
107
+ class Bmi270 {
108
+ public:
109
+ static Bmi270 &instance()
110
+ {
111
+ static Bmi270 imu;
112
+ return imu;
113
+ }
114
+
115
+ void init()
116
+ {
117
+ std::lock_guard<std::mutex> lock(mutex_);
118
+ if (!ensureReadyLocked()) return;
119
+ startSamplerLocked();
120
+ }
121
+
122
+ void close()
123
+ {
124
+ sampling_.store(false, std::memory_order_release);
125
+ std::lock_guard<std::mutex> lock(mutex_);
126
+ ready_ = false;
127
+ }
128
+
129
+ void calibrateBias()
130
+ {
131
+ // Treat the current orientation as level.
132
+ const Vector3 a = acceleration();
133
+ biasTiltX_.store(tiltXFrom(a), std::memory_order_relaxed);
134
+ biasTiltY_.store(tiltYFrom(a), std::memory_order_relaxed);
135
+ }
136
+
137
+ int tiltX() { return tiltXFrom(acceleration()) - biasTiltX_.load(std::memory_order_relaxed); }
138
+ int tiltY() { return tiltYFrom(acceleration()) - biasTiltY_.load(std::memory_order_relaxed); }
139
+
140
+ Vector3 acceleration()
141
+ {
142
+ std::lock_guard<std::mutex> lock(sampleMutex_);
143
+ return acceleration_;
144
+ }
145
+
146
+ Vector3 gyroscope()
147
+ {
148
+ std::lock_guard<std::mutex> lock(sampleMutex_);
149
+ return gyroscope_;
150
+ }
151
+
152
+ private:
153
+ // The panel is physically landscape (960x540) but apps run portrait (rotated
154
+ // 90°), so the BMI270's chip X/Y are swapped relative to the SCREEN X/Y.
155
+ // Screen X (the paddle axis) is therefore the chip's Y axis, and screen Y is
156
+ // the chip's X axis. Both signs are verified on hardware: with `-a.y` the
157
+ // paddle tracked the wrong way, so screen X uses `+a.y`.
158
+ static int tiltXFrom(const Vector3 &a)
159
+ {
160
+ return static_cast<int>(std::lround(std::atan2(a.y, std::sqrt(a.x * a.x + a.z * a.z)) * kRadiansToDegrees));
161
+ }
162
+
163
+ // NOTE: this game only uses tiltX (the paddle). tiltY's sign/offset is NOT
164
+ // yet hardware-verified — flat currently reads ~±180° because the chip is
165
+ // mounted z-down. Fix it against a real pitch-using app before relying on it.
166
+ static int tiltYFrom(const Vector3 &a)
167
+ {
168
+ return static_cast<int>(std::lround(std::atan2(a.x, a.z) * kRadiansToDegrees));
169
+ }
170
+
171
+ bool attach(std::uint8_t address)
172
+ {
173
+ auto bus = gea::platform::i2c::Bus::primary();
174
+ if (!bus.available()) return false;
175
+ i2c_device_config_t config = {};
176
+ config.dev_addr_length = I2C_ADDR_BIT_LEN_7;
177
+ config.device_address = address;
178
+ config.scl_speed_hz = 400000;
179
+ if (i2c_master_bus_add_device(static_cast<i2c_master_bus_handle_t>(bus.nativeHandle()), &config, &device_) != ESP_OK) {
180
+ device_ = nullptr;
181
+ return false;
182
+ }
183
+ std::uint8_t id = 0;
184
+ if (!readReg(kRegChipId, &id, 1) || id != kChipId) {
185
+ i2c_master_bus_rm_device(device_);
186
+ device_ = nullptr;
187
+ return false;
188
+ }
189
+ address_ = address;
190
+ return true;
191
+ }
192
+
193
+ bool ensureReadyLocked()
194
+ {
195
+ if (ready_) return true;
196
+ if (!device_ && !attach(kAddressPrimary) && !attach(kAddressSecondary)) {
197
+ ESP_LOGW(kTag, "BMI270 not found at 0x%02x or 0x%02x; tilt reports zero",
198
+ kAddressPrimary, kAddressSecondary);
199
+ return false;
200
+ }
201
+
202
+ if (!writeReg(kRegCmd, kSoftReset)) return false;
203
+ vTaskDelay(pdMS_TO_TICKS(3));
204
+ if (!writeReg(kRegPwrConf, 0x00)) return false;
205
+ vTaskDelay(pdMS_TO_TICKS(1));
206
+ if (!uploadConfig()) {
207
+ std::uint8_t status = 0;
208
+ (void)readReg(kRegInternalStatus, &status, 1);
209
+ ESP_LOGW(kTag, "BMI270 config upload failed: internal_status=0x%02x", status);
210
+ return false;
211
+ }
212
+ if (!writeReg(kRegPwrCtrl, kPowerAccelGyroTemp)) return false;
213
+ vTaskDelay(pdMS_TO_TICKS(50));
214
+ if (!writeReg(kRegAccConf, kAccConf100HzNormal)) return false;
215
+ if (!writeReg(kRegAccRange, kAccRange4g)) return false;
216
+ if (!writeReg(kRegGyrConf, kGyrConf100HzNormal)) return false;
217
+ if (!writeReg(kRegGyrRange, kGyrRange2000Dps)) return false;
218
+
219
+ ready_ = true;
220
+ ESP_LOGI(kTag, "BMI270 ready at 0x%02x (SDA=%d SCL=%d)", address_,
221
+ static_cast<int>(gea::platform::board::i2c.sda), static_cast<int>(gea::platform::board::i2c.scl));
222
+ sampleOnce();
223
+ return true;
224
+ }
225
+
226
+ bool uploadConfig()
227
+ {
228
+ if (!writeReg(kRegInitCtrl, 0x00)) return false;
229
+ for (std::size_t offset = 0; offset < sizeof(kConfigFile); offset += kConfigChunkSize) {
230
+ const std::size_t chunk = std::min<std::size_t>(sizeof(kConfigFile) - offset, kConfigChunkSize);
231
+ const std::uint16_t wordOffset = static_cast<std::uint16_t>(offset / 2);
232
+ const std::uint8_t addressBytes[] = {
233
+ kRegInitAddr0,
234
+ static_cast<std::uint8_t>(wordOffset & 0x0f),
235
+ static_cast<std::uint8_t>(wordOffset >> 4),
236
+ };
237
+ if (!write(addressBytes, sizeof(addressBytes))) return false;
238
+ std::uint8_t payload[kConfigChunkSize + 1] = {kRegInitData};
239
+ std::memcpy(payload + 1, kConfigFile + offset, chunk);
240
+ if (!write(payload, chunk + 1)) return false;
241
+ }
242
+ if (!writeReg(kRegInitCtrl, 0x01)) return false;
243
+ for (int i = 0; i < 20; ++i) {
244
+ vTaskDelay(pdMS_TO_TICKS(10));
245
+ std::uint8_t status = 0;
246
+ if (!readReg(kRegInternalStatus, &status, 1)) return false;
247
+ if ((status & 0x0f) == kInternalStatusInitOk) return true;
248
+ }
249
+ return false;
250
+ }
251
+
252
+ void startSamplerLocked()
253
+ {
254
+ sampling_.store(true, std::memory_order_release);
255
+ if (task_) return;
256
+ if (xTaskCreate(&Bmi270::taskMain, "papers3_imu", 4096, this, 3, &task_) != pdPASS) {
257
+ task_ = nullptr;
258
+ sampling_.store(false, std::memory_order_release);
259
+ ESP_LOGW(kTag, "IMU sampler task start failed");
260
+ }
261
+ }
262
+
263
+ static void taskMain(void *arg) { static_cast<Bmi270 *>(arg)->sampleLoop(); }
264
+
265
+ void sampleLoop()
266
+ {
267
+ while (sampling_.load(std::memory_order_acquire)) {
268
+ sampleOnce();
269
+ vTaskDelay(pdMS_TO_TICKS(kSampleIntervalMs));
270
+ }
271
+ task_ = nullptr;
272
+ vTaskDelete(nullptr);
273
+ }
274
+
275
+ void sampleOnce()
276
+ {
277
+ // Accel and gyro registers are contiguous, so one burst gets both.
278
+ std::uint8_t data[12] = {};
279
+ if (!readReg(kRegAccX, data, sizeof(data))) {
280
+ if (++readFailures_ == 1 || (readFailures_ % 256) == 0)
281
+ ESP_LOGW(kTag, "BMI270 read failed (%u)", static_cast<unsigned>(readFailures_));
282
+ return;
283
+ }
284
+ if (kLogSamples && (++sampleCount_ % 64) == 0) {
285
+ // One line per ~1s. Tilt the board while watching this: if the
286
+ // numbers do not move, the sampler or the bus is the problem; if
287
+ // they move but the paddle does not, the axis mapping is.
288
+ ESP_LOGI(kTag, "accel g x=%.2f y=%.2f z=%.2f tilt x=%d y=%d",
289
+ acceleration_.x, acceleration_.y, acceleration_.z,
290
+ tiltXFrom(acceleration_), tiltYFrom(acceleration_));
291
+ }
292
+ std::lock_guard<std::mutex> lock(sampleMutex_);
293
+ acceleration_.x = static_cast<double>(le16s(&data[0])) / kAccelLsbPerG;
294
+ acceleration_.y = static_cast<double>(le16s(&data[2])) / kAccelLsbPerG;
295
+ acceleration_.z = static_cast<double>(le16s(&data[4])) / kAccelLsbPerG;
296
+ gyroscope_.x = static_cast<double>(le16s(&data[6])) / kGyroLsbPerDps;
297
+ gyroscope_.y = static_cast<double>(le16s(&data[8])) / kGyroLsbPerDps;
298
+ gyroscope_.z = static_cast<double>(le16s(&data[10])) / kGyroLsbPerDps;
299
+ }
300
+
301
+ bool write(const std::uint8_t *data, std::size_t size)
302
+ {
303
+ if (!device_) return false;
304
+ return i2c_master_transmit(device_, data, size, kTimeoutMs) == ESP_OK;
305
+ }
306
+
307
+ bool writeReg(std::uint8_t reg, std::uint8_t value)
308
+ {
309
+ const std::uint8_t payload[] = {reg, value};
310
+ return write(payload, sizeof(payload));
311
+ }
312
+
313
+ bool readReg(std::uint8_t reg, std::uint8_t *out, std::size_t size)
314
+ {
315
+ if (!device_) return false;
316
+ return i2c_master_transmit_receive(device_, &reg, 1, out, size, kTimeoutMs) == ESP_OK;
317
+ }
318
+
319
+ i2c_master_dev_handle_t device_ = nullptr;
320
+ std::uint8_t address_ = 0;
321
+ bool ready_ = false;
322
+ TaskHandle_t task_ = nullptr;
323
+ std::atomic<bool> sampling_{false};
324
+ std::atomic<int> biasTiltX_{0};
325
+ std::atomic<int> biasTiltY_{0};
326
+ std::uint32_t sampleCount_ = 0;
327
+ std::uint32_t readFailures_ = 0;
328
+ std::mutex mutex_;
329
+ std::mutex sampleMutex_;
330
+ Vector3 acceleration_{};
331
+ Vector3 gyroscope_{};
332
+ };
333
+
334
+ } // namespace
335
+
336
+ namespace gea::platform::sensors {
337
+
338
+ void Accelerometer::init() { Bmi270::instance().init(); }
339
+ void Accelerometer::close() { Bmi270::instance().close(); }
340
+ void Accelerometer::calibrateBias() { Bmi270::instance().calibrateBias(); }
341
+ int Accelerometer::tiltX() { return Bmi270::instance().tiltX(); }
342
+ int Accelerometer::tiltY() { return Bmi270::instance().tiltY(); }
343
+ double Accelerometer::accelerationX() { return Bmi270::instance().acceleration().x * kStandardGravity; }
344
+ double Accelerometer::accelerationY() { return Bmi270::instance().acceleration().y * kStandardGravity; }
345
+ double Accelerometer::accelerationZ() { return Bmi270::instance().acceleration().z * kStandardGravity; }
346
+ double Accelerometer::gyroscopeX() { return Bmi270::instance().gyroscope().x; }
347
+ double Accelerometer::gyroscopeY() { return Bmi270::instance().gyroscope().y; }
348
+ double Accelerometer::gyroscopeZ() { return Bmi270::instance().gyroscope().z; }
349
+ void Accelerometer::setWebTilt(int, int) {}
350
+
351
+ } // namespace gea::platform::sensors
@@ -0,0 +1,101 @@
1
+ #pragma once
2
+
3
+ #include "driver/gpio.h"
4
+ #include "driver/spi_master.h"
5
+
6
+ // M5Stack PaperS3 (M5PaperS3) — ESP32-S3R8, 16 MB flash / 8 MB octal PSRAM,
7
+ // 4.7" 960x540 grayscale e-paper (ED047TC1 class) wired DIRECTLY to the SoC.
8
+ //
9
+ // Unlike the original M5Paper there is no IT8951 controller: the panel is
10
+ // driven by our components/papers3_epd (i80 parallel bus + gate/source driver
11
+ // timing). Those panel pins live in that component, not here. This header
12
+ // carries only the peripherals the shared gea target sources consume.
13
+ //
14
+ // Every pin below is taken from upstream PaperBoy (gitlab.com/zephray/paperboy)
15
+ // running on this exact board — main/msg/msg.h, main/main.c, main/touch.c and
16
+ // main/battery.c — so they are hardware-verified rather than inferred from docs.
17
+
18
+ namespace gea::platform::board {
19
+
20
+ struct I2cBusConfig {
21
+ gpio_num_t sda;
22
+ gpio_num_t scl;
23
+ };
24
+
25
+ struct Gt911TouchConfig {
26
+ gpio_num_t reset;
27
+ gpio_num_t interrupt;
28
+ };
29
+
30
+ struct ButtonConfig {
31
+ gpio_num_t power; // launcher/back button
32
+ };
33
+
34
+ struct PowerRailConfig {
35
+ gpio_num_t batteryAdc;
36
+ };
37
+
38
+ struct SdSpiStorageConfig {
39
+ spi_host_device_t spiHost;
40
+ gpio_num_t cs;
41
+ gpio_num_t sclk;
42
+ gpio_num_t mosi;
43
+ gpio_num_t miso;
44
+ };
45
+
46
+ class M5PaperS3 {
47
+ public:
48
+ // GT911 touch bus (PaperBoy touch.c: SDA 41, SCL 42, responds at 0x5D).
49
+ static constexpr I2cBusConfig i2c{
50
+ .sda = GPIO_NUM_41,
51
+ .scl = GPIO_NUM_42,
52
+ };
53
+
54
+ // No reset line is driven; the controller is released by the panel rails.
55
+ static constexpr Gt911TouchConfig touch{
56
+ .reset = GPIO_NUM_NC,
57
+ .interrupt = GPIO_NUM_48,
58
+ };
59
+
60
+ // This board has NO user GPIO button: power/reset/download are owned by a
61
+ // PMS150G companion MCU, not by the ESP32. Launcher and back are reached
62
+ // through touch.
63
+ //
64
+ // ⛔ Do NOT "borrow" GPIO0 here. It is the boot strapping pin AND an RTC
65
+ // pad, so its pad configuration survives a core reset — binding it as a
66
+ // button (the inherited launcher_button.cpp disables the pull-up) leaves it
67
+ // floating low at the next reset and the ROM comes up in DOWNLOAD mode
68
+ // instead of running the app. That wedged this board once already; only a
69
+ // full power cycle clears the RTC pad state.
70
+ //
71
+ // GPIO_NUM_NC means "absent" — buttons.cpp and launcher_button.cpp skip all
72
+ // GPIO configuration when they see it.
73
+ static constexpr ButtonConfig buttons{
74
+ .power = GPIO_NUM_NC,
75
+ };
76
+
77
+ // Battery divider on GPIO3 = ADC1_CH2 (PaperBoy battery.c). ADC1, so unlike
78
+ // the LilyGo T5's ADC2 divider it stays readable while Wi-Fi is up.
79
+ static constexpr PowerRailConfig power{
80
+ .batteryAdc = GPIO_NUM_3,
81
+ };
82
+
83
+ // microSD on its own SPI bus — the panel is parallel, not SPI.
84
+ static constexpr SdSpiStorageConfig storage{
85
+ .spiHost = SPI2_HOST,
86
+ .cs = GPIO_NUM_47,
87
+ .sclk = GPIO_NUM_39,
88
+ .mosi = GPIO_NUM_38,
89
+ .miso = GPIO_NUM_40,
90
+ };
91
+ };
92
+
93
+ using Board = M5PaperS3;
94
+
95
+ inline constexpr auto i2c = Board::i2c;
96
+ inline constexpr auto touch = Board::touch;
97
+ inline constexpr auto buttons = Board::buttons;
98
+ inline constexpr auto power = Board::power;
99
+ inline constexpr auto storage = Board::storage;
100
+
101
+ } // namespace gea::platform::board
@@ -0,0 +1,8 @@
1
+ #pragma once
2
+
3
+ namespace gea::platform::papers3::buttons {
4
+
5
+ void init();
6
+ void poll(int nowMs);
7
+
8
+ } // namespace gea::platform::papers3::buttons
@@ -0,0 +1,96 @@
1
+ #include "apps/app_manager.h"
2
+ #include "board.h"
3
+ #include "input.h"
4
+
5
+ #include "driver/gpio.h"
6
+ #include "esp_log.h"
7
+ #include "freertos/FreeRTOS.h"
8
+ #include "freertos/task.h"
9
+
10
+ namespace gea::platform::esp32::apps {
11
+
12
+ namespace {
13
+
14
+ constexpr char kTag[] = "launcher_button";
15
+ constexpr gpio_num_t kButton = gea::platform::board::buttons.power;
16
+ constexpr unsigned long long kButtonMask =
17
+ static_cast<int>(kButton) >= 0 ? (1ULL << (static_cast<int>(kButton) & 63)) : 0ULL;
18
+ constexpr int kDebounceMs = 50;
19
+ constexpr int kPollMs = 25;
20
+ constexpr int kLongPressMs = 800;
21
+
22
+ class LauncherButton {
23
+ public:
24
+ static LauncherButton &instance()
25
+ {
26
+ static LauncherButton button;
27
+ return button;
28
+ }
29
+
30
+ void start()
31
+ {
32
+ if (task_ || !gea::framework::apps::AppManager::shouldEnableLauncherButton()) return;
33
+ // This board has no launcher button (board.h). Bail out before any GPIO
34
+ // work: `1ULL << GPIO_NUM_NC` is an undefined shift, and the only free
35
+ // pin to "borrow" would be the GPIO0 strapping pin, which this function
36
+ // would then leave pull-up-disabled and floating — booting the board
37
+ // into ROM download mode on the next reset.
38
+ if (kButton == GPIO_NUM_NC) return;
39
+ gpio_config_t config = {};
40
+ // The `& 63` keeps the shift count in range for the compiler even in the
41
+ // GPIO_NUM_NC (-1) case, which is unreachable at run time but still
42
+ // type-checked: a bare `1ULL << -1` is a hard -Werror=shift-count-negative.
43
+ config.pin_bit_mask = kButtonMask;
44
+ config.mode = GPIO_MODE_INPUT;
45
+ config.pull_up_en = GPIO_PULLUP_DISABLE; // board supplies the pull-up.
46
+ config.pull_down_en = GPIO_PULLDOWN_DISABLE;
47
+ config.intr_type = GPIO_INTR_DISABLE;
48
+ if (gpio_config(&config) != ESP_OK) return;
49
+ if (xTaskCreate(taskMain, "launcher_button", 4096, this, 10, &task_) != pdPASS) task_ = nullptr;
50
+ }
51
+
52
+ private:
53
+ void run()
54
+ {
55
+ for (;;) {
56
+ if (gpio_get_level(kButton) == 0) {
57
+ vTaskDelay(pdMS_TO_TICKS(kDebounceMs));
58
+ if (gpio_get_level(kButton) == 0) {
59
+ const TickType_t pressedAt = xTaskGetTickCount();
60
+ bool longHandled = false;
61
+ while (gpio_get_level(kButton) == 0) {
62
+ if (!longHandled && xTaskGetTickCount() - pressedAt >= pdMS_TO_TICKS(kLongPressMs)) {
63
+ const bool returned = gea::framework::apps::AppManager::returnRunningAppToLauncher(
64
+ "M5PaperS3 power button long press");
65
+ if (!returned) gea::framework::apps::AppManager::queueSettingsToggle();
66
+ longHandled = true;
67
+ }
68
+ vTaskDelay(pdMS_TO_TICKS(kPollMs));
69
+ }
70
+ if (!longHandled) {
71
+ const bool returned = gea::framework::apps::AppManager::returnRunningAppToLauncher(
72
+ "M5PaperS3 power button press");
73
+ if (!returned) gea::framework::input::pressBackButton();
74
+ }
75
+ }
76
+ }
77
+ vTaskDelay(pdMS_TO_TICKS(kPollMs));
78
+ }
79
+ }
80
+
81
+ static void taskMain(void *arg) { static_cast<LauncherButton *>(arg)->run(); }
82
+ TaskHandle_t task_ = nullptr;
83
+ };
84
+
85
+ } // namespace
86
+
87
+ void startLauncherButtonTask()
88
+ {
89
+ LauncherButton::instance().start();
90
+ if (kButton == GPIO_NUM_NC)
91
+ ESP_LOGI(kTag, "no launcher button on this board; use touch");
92
+ else
93
+ ESP_LOGI(kTag, "launcher button configured on GPIO%d", static_cast<int>(kButton));
94
+ }
95
+
96
+ } // namespace gea::platform::esp32::apps