Playing Tetris with a FRDM-KL43Z Board

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:

FRDM-KL43Z Tetris project

FRDM-KL43Z Tetris project

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:

Processor Expert Components

Processor Expert Components

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.

Communication Settings

Communication Settings

The fsl_gpio is used for LEDs and push button handling.

Button Pins

Button Pins

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:

Game Start

Game Start

Then it starts dropping the pieces which can be moved and rotated by using the keyboard keys or the push buttons on the board:

Gameplay

Gameplay

To show ‘graphics’, I’m using UTF-8 encoding in Putty Terminal:

UTF8 in Putty

UTF8 in Putty

I have set the Putty Cursor Color to black so the cursor is hidden:

Putty Cursor Color

Putty Cursor Color

Play and losing the game (I admit I’m not good at it ;-):

Lost Tetris Game

Lost Tetris Game

The nice thing is that I can use both the board or the keyboard to play it:

FRDM-KL43Z with Tetris

FRDM-KL43Z with Tetris

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

 

Advertisements

6 thoughts on “Playing Tetris with a FRDM-KL43Z Board

  1. Pingback: 3D Printed Gameboy and Remote Controller with tinyK20 Board | MCU on Eclipse

  2. Pingback: Tutorial: Blinky with Kinetis SDK V1.3 and Processor Expert | MCU on Eclipse

    • 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

      Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s