Space invaders with a nRF2401A wireless joypad

Dependencies:   Gameduino mbed nRF2401A

Fork of Gameduino_Invaders_game by Chris Dick

Gameduino and an nRF2401A hooked up to an mbed on an mbeduino:

/media/uploads/TheChrisyd/2014-03-08_22.53.54.jpg

Files at this revision

API Documentation at this revision

Comitter:
TheChrisyd
Date:
Sun Mar 09 12:27:20 2014 +0000
Parent:
4:bb78bedae411
Commit message:
Update to match Library update

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
nRF2401A.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Oct 26 22:34:08 2013 +0000
+++ b/main.cpp	Sun Mar 09 12:27:20 2014 +0000
@@ -20,16 +20,15 @@
 #include "nRF2401A.h"
 
 #define WIRELESS
-nRF2401A    wireless_joypad(p10, p11, p12, p13, p14);
-byte wireless_dpad = 0;
-byte wireless_buttons = 0;
+nRF2401A    wireless_joypad(p10, p11, p12, p13, p14);//ce, cs, dr1, clk1, data
+uint8_t wireless_dpad = 0;
+uint8_t wireless_buttons = 0;
 DigitalOut debug(LED1);
-//void nRF2401A_rx (void *arg);
 
 void nRF2401A_rx (void *arg) 
 {
-     wireless_joypad.readMsg_byte(&wireless_dpad,  0 );
-     wireless_joypad.readMsg_byte(&wireless_buttons,  1 );
+     wireless_dpad = wireless_joypad.readMsg_byte( 0 );
+     wireless_buttons = wireless_joypad.readMsg_byte( 1 );
      debug = !debug;
 }
 
@@ -37,11 +36,7 @@
     GD.begin();
     #ifdef WIRELESS
      wait(0.005);
-     wireless_joypad.setDataPayloadLength(4 << 3)
-                    .setAddress(0x0, 0x0, 0x53, 0x53, 0x53, 3 << 3)
-                    .setCRCMode(nRF2401A::NO_CRC)
-                    .setDataRate(nRF2401A::BIT_RATE_250KBITS)
-                    .setChannel(0x02);
+     wireless_joypad.setAddress(0x0, 0x0, 0x53, 0x53, 0x53, 3 << 3);
      
     wireless_joypad.flushControlPacket();   
     wireless_joypad.attachRXHandler(&nRF2401A_rx, 0);
--- a/nRF2401A.lib	Sat Oct 26 22:34:08 2013 +0000
+++ b/nRF2401A.lib	Sun Mar 09 12:27:20 2014 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/TheChrisyd/code/nRF2401A/#fb7cb88e80a4
+https://mbed.org/users/TheChrisyd/code/nRF2401A/#7245524e37e4