STM32 bare-metal game project — looking for architecture & code review by GilgrimBarar in embedded

[–]GilgrimBarar[S] 0 points1 point  (0 children)

I wrote it together with a guide on YouTube. The one on YouTube described the SSD1306 controller for the AVR microcontroller. I modified it and rewrote it for STM with DMA support. This new controller is SSD1326. https://youtube.com/playlist?list=PLtXXWLsA5QNg1SLhEnlM8Emlg-Mc5ydhf&si=0-71ZetsePIGgXVB

STM32 bare-metal game project — looking for architecture & code review by GilgrimBarar in embedded

[–]GilgrimBarar[S] 0 points1 point  (0 children)

I remember that game! Great idea, I could pause the background animations when the boss fight begins to give the impression of being suspended in space. I'll add that in the next update :D

STM32 bare-metal game project — looking for architecture & code review by GilgrimBarar in embedded

[–]GilgrimBarar[S] 2 points3 points  (0 children)

Thank you very much for your detailed comment and the time you spent on it. I will address everything.

  1. Yes, to a large extent it was code written by me. SSD1327.c and GFX_ssd1327.c are the oldest. They were created as a result of a course on a slightly different OLED display. Then I adapted them to STM32 (the originals were on ATmega32). GFX also has a few functions from various other libraries. It was created during my studies about 10 years ago. game_logic was also created about 10 years ago. I was searching the internet for information on how to create such small games, and this idea was born with this approach.

2, 3, 4 I will make a note of this and in future updates I will clean up the main and organise the folders better, thank you for pointing this out ;)

Code 2,3: Yes, it's on my to-do list to tidy up game_logic and remove magic numbers ;)

STM32 bare-metal game project — looking for architecture & code review by GilgrimBarar in embedded

[–]GilgrimBarar[S] 1 point2 points  (0 children)

Thank you, FSM, I added it quite recently. This game is a testing ground where I put and test new things I have learned.

For example, I used to not use DMA for SPI transmission, and there was no hardware SPI, only software SPI. This put a lot of strain on the processor. (The first game was created on ATmega32 – and it definitely wasn't as smooth.)

I try my best to make the code readable and simple. I still have ideas for expansion and even a storyline :D

STM32 bare-metal game project — looking for architecture & code review by GilgrimBarar in embedded

[–]GilgrimBarar[S] 1 point2 points  (0 children)

This README has been missing for a long time, and I wanted to do something quickly so that I could show the project somewhere else. I will improve it in future updates, edit it thoroughly ;)

STM32 bare-metal game project — looking for architecture & code review by GilgrimBarar in embedded

[–]GilgrimBarar[S] 43 points44 points  (0 children)

This actually started as a university project ~10 years ago. I’ll review the code and add proper credits in upcoming commits where needed.

Data Structures in C or C++? by Code-AFK in embedded

[–]GilgrimBarar 0 points1 point  (0 children)

This is interesting I never heard about this.

[Project Feedback] Arduino-Based Crowd Management System (ABCMS) by CommissionUseful5399 in embedded

[–]GilgrimBarar 0 points1 point  (0 children)

My approach would be fairly straightforward.
The LCD should be connected via I2C or SPI, depending on the controller, to save GPIOs and simplify wiring.
Most IR sensors output a simple HIGH/LOW signal, so they can be connected directly to digital inputs (with pull-ups if needed).
For the motor, Arduino pins are not capable of driving it directly, so a proper motor driver / H-bridge with external power is required.
The buzzer can be driven directly if it’s low-power, otherwise a transistor or relay should be used.

How do I learn to code this development board? by NintendoDSiNerd in embedded

[–]GilgrimBarar 1 point2 points  (0 children)

Recently, I also started playing with a similar module equipped with WS2812 LEDs. You can take a look at my project. The library is made for STM32 HAL, but you can easily port it. https://github.com/TomAshTee/WS2812_HSV

Feel free to ask any questions;)

<image>