How about to use the Freescale FRDM-KL43Z board (see “Unboxing the Freescale FRDM-KL43Z Board“) to play a Tetris game?
You can find the sources on GitHub (see link at the end). The project is built with Freescale Kinetis Design Studio (KDS) V3.0.0 and the Kinetis SDK V1.3.0. To make it really easy with the SDK I have used Processor Expert:
I used Processor Expert for the Kinetis SDK as this makes using the Kinetis SDK usable in an easy way: I can configure the ports and pins, and I see in a graphical view the methods I can use:
The game idea is simple:
- The FRDM board is running the game
- The board is connected to the host via USB CDC (virtual COM) connection.
- As display for the game, a terminal on the host is used
- The FRDM board writes text to the terminal to ‘paint’ the game area
- The keyboard on the host and the push buttons on the board are used to move and rotate the pieces in the game
I used the fsl_debug_console to write so I can use the virtual COM (USB CDC) port of the OpenSDA debug circuit.
The fsl_gpio is used for LEDs and push button handling.
The game engine itself is messy and could be improved, but it does its job :-).
The game uses a console for the game area and communication. The game can be played with the keyboard on the host and/or with push buttons on the board. At startup, it writes the instruction to the console:
Then it starts dropping the pieces which can be moved and rotated by using the keyboard keys or the push buttons on the board:
To show ‘graphics’, I’m using UTF-8 encoding in Putty Terminal:
I have set the Putty Cursor Color to black so the cursor is hidden:
Play and losing the game (I admit I’m not good at it ;-):
The nice thing is that I can use both the board or the keyboard to play it:
Left and right push buttons are used to move the pieces left or right, pressing both buttons rotate it.
💡 Thanks to Luis Olea for suggesting that cool game and for providing the initial game engine!
Happy Gaming 🙂
Links
- Project and sources on GitHub: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-KL43Z/FRDM-KL43Z_Tetris
- Putty Terminal program: http://www.chiark.greenend.org.uk/~sgtatham/putty/
- FRDM-KL43Z Board: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL43Z
- Freescale Kinetis Design Studio: http://www.freescale.com/kds
so it acts as a controller 😀
but I wonder, what does that card for?
LikeLike
The game runs on the board itself, and provides the controller buttons. There is only the terminal on the host to display the game area.
LikeLike
Pingback: 3D Printed Gameboy and Remote Controller with tinyK20 Board | MCU on Eclipse
Pingback: Tutorial: Blinky with Kinetis SDK V1.3 and Processor Expert | MCU on Eclipse
Hello,
How to use Freescale K22F board to do this project?
LikeLike
With Processor Expert it is very simple: Use Kinetis Design Studio and create a new Processor Expert project, with SDK set to ‘none’. Then add the Asynchroserial component to it for the UART connection and configure it to use the OpenSDA UART port. Move over the game code and then with some smaller changes you will be able to play the game.
I hope this helps,
Erich
LikeLike