No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-31 11:30:48 +01:00
.cargo clean up for publication 2026-10-31 11:30:48 +01:00
src clean up for publication 2026-10-31 11:30:48 +01:00
.gitignore clean up for publication 2026-10-31 11:30:48 +01:00
Cargo.lock clean up for publication 2026-10-31 11:30:48 +01:00
Cargo.toml clean up for publication 2026-10-31 11:30:48 +01:00
LICENSE clean up for publication 2026-10-31 11:30:48 +01:00
README.md clean up for publication 2026-10-31 11:30:48 +01:00

pong-rtic

Two-player touchscreen Pong for the STM32F723E-DISCO, written in Rust on RTIC v2.

This uses the stm32f723e-disc board support crate, which handles the FMC-attached display, framebuffers in external PSRAM and the touch controller.

This was mainly created to evaluate and learn about RTIC in order to help make an informed choice about which Rust RTOS base to choose in the future, for potentially more complicated projects.

How it works

RTIC doesn't have its own scheduler: every task is an interrupt handler and NVIC does the scheduling. Software tasks are dispatched from interrupt vectors the application does not otherwise use, here these are UART4 and UART5.

Task Priority Period Job
input_loop 2 20 ms poll the touch controller, push touch points into the queue
game_loop 1 16 ms drain the queue, advance the game, draw the frame, flush it to the LCD

The only shared resource is the queue, a heapless::spsc::Queue<Point, 16>. Access to it is wrapped in lock, which RTIC implements by raising the running priority to the resource ceiling for the duration of the closure, so that the input task can never preempt the game task in the middle of a dequeue.

Rendering uses embedded-graphics abstractions. The game state implements Drawable, the display implements DrawTarget on a back buffer in PSRAM. The buffer is then flushed to DMA2, which streams it into the LCD while the next frame is already being drawn.

Building and flashing

Requirements: Rust 1.85 or newer (edition 2024), the thumbv7em-none-eabihf target and probe-rs for flashing using ST-LINK.

rustup target add thumbv7em-none-eabihf
cargo install probe-rs-tools --locked
# build, flash and attach
cargo run --release