Skip to main content
Version: FILS English

Rogue Rust

A turn based rpg implemeting sensors for various functions on a pico 2w.

info

Author: Denis-Iulian Pavel
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-denis-iulian-pavel

Description​

My project will be a game coded completely in rust designed to run on a Pico 2W with 8 buttons (Left, Right, Up, Down, A, B, C and D), Temp Sensor, Accel Sensor.

Motivation​

I chose this project because I decided to implement a multiple features and utilize all aspects I've studied up until now in the lab, in rust on a microprocessor like the Pico 2W.

Architecture​

Raspberry Pi Pico 2W to:

  • RGB_TFT LCD Screen 128x160
  • A, B, C, D buttons
  • Left, Right and Up, Down buttons
  • Buzzer
  • Temperature Sensor
  • Acceleration Sensor

Log​

Week 5 - 11 May​

Established main board connections. Connected debugger, main board, a b c d buttons, screen and buzzer. Wrote code to initialize and test functionality for these. Wrote a script to display chroma keyed sprites on the screen so I can use background images and one to play sounds for the buzzer.

Week 12 - 18 May​

Purchased sensors. Scrapped joystick and replaced with buttons. Established connections between the rest of the components. Main Board with full hardware

Week 19 - 28 May​

Named the game RogueRust. LithTheFox from the boot screen is my alias. Chose new sensors, initialized accel sensor but it is unable to read properly Created main game loop, character sprites, creatures as well as gameplay base off this. Game Plan The final board being: Final Board

Hardware​

Raspberry Pi Pico 2W, Buttons, Screen (rgb_tft 128x160), Temperature Sensor, Acceleration Sensor.

Schematics​

Architecture diagram

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico 2WThe main controller39.66 RON
Electronic Components KitBasic Components15.63 RON (SALE)
1.8-inch SPI TFT Module LCD DisplayScreen15.45 RON (SALE)
Breadboard HQ (830 Puncte)Extra Breadboard9.98 RON (DELISTED)
ADXL345 Digital 3-Axis Accelerometer ModuleVarious Velocity Interactions12.99 RON
LM35D Analog Temperature SensorRandomization elements4.99 RON
Total CostFull price for the hardware98.70 RON

Software​

LibraryDescriptionUsage
tinybmpno_std BMP decoderDecode BMP sprite and background images
embedded-textText layout and rendering on embedded-graphicsRender aligned or wrapped text boxes
adxl345_driver2Driver for ADXL345 3-axis accelerometerRead acceleration data for motion or controls
itoaInteger-to-ASCII formatter without pulling in core::fmtFast, heapless number-to-string conversion
embassy-executorAsync/await task executor for Cortex-MDrive embedded async tasks with interrupts or threads
embassy-rpRP2040 HAL integration with async supportInterface Raspberry Pi Pico 2W peripherals asynchronously
embassy-timeTimekeeping, delays, and scheduling for embedded asyncSleep, timeouts, and uptime timestamps
embassy-usbAsync USB device stackImplement USB CDC, HID, or custom USB classes
embassy-syncAsync-aware synchronization primitivesShare data safely between concurrent async tasks
embassy-futuresno_std futures and combinatorsLightweight future utilities without heap allocation
embassy-embedded-halBridges embedded-hal traits into asyncUse HAL traits inside async contexts
embedded-graphics2D drawing primitives for embedded displaysDraw pixels, shapes, and fonts on TFT or OLED screens
display-interface-spiSPI abstraction for display driversSend commands/data to SPI-based screens
mipidsiGeneric MIPI-DSI display driverDrive TFT displays over SPI/MIPI-DSI
defmtEfficient embedded logging frameworkLog debug/info messages via RTT or semihosting
defmt-rttRTT transport layer for defmtTransfer log frames over SWO/JTAG via RTT
fixedFixed-point numeric typesPerform fractional math without floating-point support
fixed-macroMacros for defining fixed-point constantsWrite fixed-point literals conveniently
static-cellStatically allocated, runtime-initialized cellSafely init global data without dynamic allocation
heaplessFixed-capacity data structures (Vec, String, etc.)Store collections and buffers without alloc
embedded-hal-1Blocking HAL traits for embedded peripheralsDefine SPI, I²C, GPIO, and other blocking interfaces
embedded-hal-asyncAsync variants of embedded-hal traitsNon-blocking SPI, I²C, UART in async contexts
embedded-io-asyncAsync I/O traits for embedded read/writeStream/sink traits for sensors and comm interfaces
cortex-m-rtCortex-M runtime startup and interrupt supportSet up vector tables, entry point, and reset handlers
panic-probePanic handler that prints backtraces via defmtCatch and report panics on embedded targets
byte-slice-castSafe reinterpretation of byte slicesCast between &[u8] and &[T] without unsafe code

RogueRust Alpha Demo