For the past few days I've worked on the first building blocks of my Space Invaders project. As of right now, the approach I've decided to take is to have the Teensy board take the inputs from an infrared remote and control most of the game logic there and then send some display information, like the position of the different objects on the screen to the Spartan-3 board (maybe via Serial port) and have the Spartan-3 do all the display work through its VGA port.
I have been working in the VGA controller and video memory on the Spartan-3 (more on that later) but I took a break from it to work on the controller for the game. Basically, there is only need for 3 buttons: left, right and fire. Maybe I'll add extra functionality after the basic part is done and use some other buttons, but for now 3 is all I need.
This was my first time using the Arduino environment to program Teensy(or anything), which is compatible with it as well as with C. I was glad to find the many libraries at my disposal. I started with Ken Shirriff's IRremote library and added my 7-segments display with slightly different code than the one I used last time to make its timing more independent from the rest of the program. I also used a piece of an old Ethernet cable for the wiring to make it nicer and avoid the mess from last time.
My IR remote uses the NEC protocol and Shirriff's library worked like a charm, I only added a few lines of code to account for held-down keys so the code for the key pressed keeps repeating instead of changing to the special repeat code. The above picture is of the 7-segments display showing the last 2 bytes of the decoded result, which in the case of my remote, are the only ones that change.
As I mentioned, this is just part of the Space Invaders project, so the code for this sill be available on GitHub HERE. The 7-Segments display files can be reused as a basic library, just keep in mind that the pin assignments are defined in the .h file.