The PSoC® 6 WiFi-BT Pioneer Kit comes with 2.4” TFT Display shield board. The PSoC 62 MCU has 1MB of flash, enough to build a game with minimal graphics. The TFT Display shield has stereo audio codec “AK4954A” with I2S communication to play audio via headphone jack or speaker. In this game we have interfaced a 1W speaker to the audio output. Look here to learn more about the TFT Display.
The display has RGB LED which used as indicators for the user. CapSense Slider/Buttons and Push buttons are used to navigate menus and play the game.
The Eclipse IDE based ModusToolbox Is used for the development of the code. The firmware is developed on the FreeRTOS platform with Segger emWin graphics library and board utils Library’s. The full firmware is written in c and with separate FreeRTOS tasks for display and user input (CapSense). To play the game’s audio the wav file data (Audio Mono, format 16bit PCM) is stored in an array format.
WavToCode software is used for converting audio file into byte array. There is no algorithm used to generate the puzzle matrix, predefined puzzle values are stored in 6x6 matrix array as a proof-of-concept demonstration. For GUI development the pictures are designed from Affinity Studio/Photoshop and emWin tools are used to convert the bitmap into byte arrays.
In the future this idea can be extended to cloud with Wi-Fi to enable multiplayer options.
BlocksIt’s a 6x6 sudoku game with six colors for each box. The rules are the same as normal sudoku, but instead of numbers we have colors. After powerup the board starts with menu options to select the mode “EASY”, “MEDIUM”, and “HARD” using CapSense buttons. Press SW1 once to select the mode, and a second time to start the game. As soon as the game is loaded, the timer starts running.
The usser can use CapSense slider to change the color index from 1 to 6:
- 1 - Red
- 2 - Blue
- 3 - Green
- 4 - Yellow
- 5 - Magenta
- 6 - Cyan
CapsSense buttons are also used to move from left to right and vice versa. Holding the button SW1 allow the user to navigate up and down. The prefilled values (correct color) are shown with inner square marks, here the user has no control in changing the color.
To understand the complete flow, watch the working demo on youtube.
To program your own hardware with the sudoku game, have a look at the.hex file attached to this page and this guide on programming PSoC Devices.
Comments