Commit Graph

21 Commits

Author SHA1 Message Date
Adolfo Reyna
8cbb95b181 Add auto-sleep/wake functionality with timer-based dimming
- Added PWM brightness control to ST7796 driver (0-100%)
- Implemented hardware sleep mode for ST7796 (saves ~150mA)
- Added sleep/wake functions preserving framebuffer and settings
- Implemented timer-based inactivity detection (checks every 10s)
- Auto-sleep after 5 minutes of no user input
- Touch controller remains active during TFT sleep for instant wake
- E-ink display also sleeps after timeout, requires re-init on wake
- Added hardware_pwm library dependency to CMakeLists.txt
- Brightness and sleep/wake methods exposed through display abstraction layer
2026-02-10 20:29:10 -05:00
Adolfo Reyna
b16211f148 Fix SD card integration and Lua game loading
- Fix SD card MISO pin (was using display MISO instead of SD MISO)
- Add FatFS mounting after SD card initialization
- Restore SPI baudrate on all SD init failure paths
- Add case-insensitive .lua file extension check
- Filter out hidden 8.3 filename entries
- Add SPI speed management functions for shared SPI bus
- Wrap all FatFS operations with SPI speed switching
- Restore display SPI speed (32 MHz) after SD operations
- Add debug output to Lua game loader

This fixes slow display refresh when SD card is present and enables
reliable Lua game loading from SD card /games directory.
2026-02-07 19:31:38 -05:00
Adolfo Reyna
2a472fc29f Add frame tick system for continuous animation
- Added INPUT_FRAME_TICK event type to input_event.h
- Added wants_frame_updates() virtual method to Game base class
- Implemented frame tick logic in main loop (basic1.cpp and emulator/main.cpp)
- Added Lua bindings: game.set_frame_updates(bool) and INPUT.FRAME_TICK
- Updated LuaGame to support frame updates via registry flag
- Updated ball.lua to use continuous frame updates for smooth animation
- Both hardware and emulator now support continuous animation for physics/games
2026-02-07 13:20:10 -05:00
Adolfo Reyna
e6e4eca188 Add Lua 5.4 scripting integration for dynamic game loading
- Integrated Lua 5.4 engine (32-bit mode for embedded ARM)
- Created LuaGame wrapper class implementing Game interface
- Added C++ bindings exposing renderer, game state, and input to Lua
- Implemented SD card loader for automatic .lua game discovery
- Updated GameLauncher to support std::function for lambda captures
- Made Game class members public for Lua bindings access
- Added example Lua games: counter, snake, bouncing ball
- Included comprehensive API documentation

Games can now be written as .lua text files on SD card and loaded
without recompilation. Build size: 747KB UF2, Lua VM uses ~50-80KB RAM.
2026-02-07 11:56:03 -05:00
Adolfo Reyna
64f61759d7 Fix emulator compilation and crash, and implement Monopoly payment modal 2026-02-06 23:13:32 -05:00
Adolfo Reyna
561f7c5951 interpreting monopoly as multi scree game 2026-01-31 19:05:58 -05:00
Adolfo Reyna
cad1aad2c8 initial monopoly test 2026-01-31 09:45:40 -05:00
Adolfo Reyna
45cbcc8384 fix touch 2026-01-30 22:52:25 -05:00
Adolfo Reyna
30c3c2a066 full refresh between game changes 2026-01-30 22:11:12 -05:00
Adolfo Reyna
f860d4f5e6 input manager provides ground of truth on device input choise 2026-01-30 22:07:31 -05:00
Adolfo Reyna
436245a7a2 Fix render issues with fonts 2026-01-30 22:02:15 -05:00
Adolfo Reyna
e3445b545d Initial game launcher 2026-01-30 21:39:09 -05:00
Adolfo Reyna
2a6861fdf5 refactored to multiple games implementation 2026-01-30 21:33:42 -05:00
Adolfo Reyna
435a5caa56 tic tac toe works on touch and eink 2026-01-29 17:16:59 -05:00
Adolfo Reyna
372895fa08 initial game template 2026-01-29 15:58:58 -05:00
Adolfo Reyna
95e3f3f32d simple clean 2026-01-29 15:32:45 -05:00
Adolfo Reyna
8d0bca691a hardware button support 2026-01-29 15:23:03 -05:00
Adolfo Reyna
3a08cb5119 improve touch with pooling 2026-01-29 14:16:19 -05:00
Adolfo Reyna
d19a2ca639 touch with abtraction working, SD is not working 2026-01-28 23:23:49 -05:00
Adolfo Reyna
adfbef7228 abstracting display, touch and sd 2026-01-28 20:12:41 -05:00
Adolfo Reyna
57426c6e7d touch & sd working 2026-01-28 17:22:15 -05:00