Introduction: Game Console

Really simple gaming console, supporting a menu, tetris and snake. It was made using

- two 8x8 Square Matrix Red LED Display dot Module74hc595 Drive found here

- one STM32F103 Nucleo-64

- 4 buttons and 4 resistors

- wires, a breadbord, jumpers, etc.

- building materials, screws, boards, etc. (those are irelevant regarding the working product)

You may use:

- stm32f manual found here

- hc595 data sheet found here

- some Chinese led-matrix

Step 1: Conections

Here you can see how to connect the pieces:

- push button

- screen

What GPIO pins you choose for input and output is mostly irrelevant, but I chose screen pins from GPIOA and button pins from GPIOB.

Step 2: Build

For buiding your code you can go with something named SEGGER or with(this is what I've used) this.

- openocd is a server for your debuger

- st-link is your programmer

- gcc-arm-none-eabi are your programming tools

- note that in common/openocd.conf I needed to change to:

source [find interface/stlink-v2-1.cfg]
source [find target/stm32f1x.cfg]
reset_config srst_only srst_nogate

- I also needed to change the .ld script and use another link than that shown in that example to get a debugger for arm. Also note that in those examples the stm32f10x_it.* files are not linked in the makefile.

Step 3: Code

The code is fairly simple. The logic is split in main.c, Driver.*, Menu.*, Tetris.* and Snake.*. A short description is that Driver offers functions to interact with the hardware. In main you can find driver and menu initialization and see that in the while loop menu controls the interaction with the other two games. You can also see how games are added into menu. Each game has an initialization part and an update. Update contains logic, state interpretation and drawing.

Step 4: Usage

You start in menu. You can select another item on the page by using up and down. When the last item on the page is selected you can cycle between game pages. Currently there is only one page so this feature is unused. When on a game item you can use right key to play the game.

When you enter the game you get into the start screen where you need to press the down button to start or up to exit. After loosing a game you need to press the up key to go in the start screen.

For Tetris the in-game controls are up for rotating the piece, down for speeding up the fall of the piece, left and right move the piece left and right.

The left key is the one nearest to the cable that connects it to the console.