Goal of the Project was the development of a mini game. The game is described below.
The following hardware of the STM32L476G-DISCOVERY Board is used:
- Joystick
- up, down: configuration,
- right, left: led flashing replication (green: right, red: left)
- center: center is enter (it rhymes)
- LED (green and red) for flash sequence
- LCD Display: Arrow + State messages
- 3-axis magnetometer (lsm303c)
- Quad-SPI Flash memory (for storing calibration data)
- (UART2 for debug printline over serial connection)
- (for mobility: battery or Powerbank over USB)
- For development the STM32Cube IDE is used
- To get a highlevel API the Board BSP from ST is used (see doc/bsp_guide.md)
- Debug Printouts on UART2:
- can be activated via switch in Usercode/Utils/debug.h
#define DEBUG_PRINT
- Setting:
- Baudrate: 9600
- Databits: 8
- Stopbits: 1
- Parity: None
I tried to build up kind of a layered architecture, see below.
Below you see the gameflow of the minigame. The states could be found in the statemachine in Usercode/minigame.c ->minigame_Run()
- Configuration via joystick (selection), center is Enter, using LCD Display for output
- Optional: Calibration of the mems magnet sensor (30 sec. rotating)
- You must fullfil at least one full flat rotation!
- Select player count 2 or 4 (rotation 90° or 180° ... limitation due display arrow)
- Select difficulty level (easy, medium, advanced, hardcore)
- determing difficulty/length of the flash sequence (f.e.: easy - green, green, red)
- The display shows Go
- Player start: rotating that the board so that it's in front of u, display on top
- Press Center Button
- LEDs show a flash sequence Green + Red LED
- Then an arrow on the LCD starts rotating
- When the arrow stops it points to the next player (the display shows Rotate and full bars)
- This player must now rotate the board so it's in front of him (see step 2.)
- there is a timeout for doing this -> the bars on the display visualize this.
- When the board is at the right angle it shows FLASH -> now the player should replicate the sequence with the joystick (see Step 4, timeout for this is 1.5 seconds/flash)
- Verification:
- If the user enter the sequence correct: the display shows "Victory".
- If the user has failed: the display shows "You Failed"
- Back to step 1.