napoleon leoni / joystickAppBoard
Committer:
nleoni
Date:
Thu Feb 13 08:03:28 2014 +0000
Revision:
0:180cf3834ece
/joystickAppBoard class; //Written by Napoleon Leoni; February 2014; //Simple class object to handle joystick state for the mbed application board; //5 way Joystick    ALPS SKRHADE010; //Down:p12; Left:p13 Centre:p14 Up:p15 Right:p16;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nleoni 0:180cf3834ece 1 //joystickAppBoard class
nleoni 0:180cf3834ece 2 //Written by Napoleon Leoni; February 2014
nleoni 0:180cf3834ece 3 //Simple class object to handle joystick state for the mbed application board
nleoni 0:180cf3834ece 4 //5 way Joystick ALPS SKRHADE010
nleoni 0:180cf3834ece 5 //Down:p12; Left:p13 Centre:p14 Up:p15 Right:p16
nleoni 0:180cf3834ece 6
nleoni 0:180cf3834ece 7 #include "mbed.h"
nleoni 0:180cf3834ece 8 #include <BusIn.h>
nleoni 0:180cf3834ece 9
nleoni 0:180cf3834ece 10 #ifndef JOYAPPPCB
nleoni 0:180cf3834ece 11 #define JOYAPPPCB
nleoni 0:180cf3834ece 12 // Joystick state definitions
nleoni 0:180cf3834ece 13 #define JOYSTICKDOWN 0x01 //0b00001 d1
nleoni 0:180cf3834ece 14 #define JOYSTICKLEFT 0x02 //0b00010 d2
nleoni 0:180cf3834ece 15 #define JOYSTICKCENTER 0x04 //0b00100 d4
nleoni 0:180cf3834ece 16 #define JOYSTICKUP 0x08 //0b01000 d8
nleoni 0:180cf3834ece 17 #define JOYSTICKRIGHT 0x10 //0b10000 d16
nleoni 0:180cf3834ece 18
nleoni 0:180cf3834ece 19 //***************************** TESTING ********************************************************//
nleoni 0:180cf3834ece 20 // TEST TEST DESCRIPTION STATUS //
nleoni 0:180cf3834ece 21 // 1 getJoystickState yields the right hex value as shown above PASS //
nleoni 0:180cf3834ece 22 // 2 Joystick posistion (up, down center, leff, right) are all PASS //
nleoni 0:180cf3834ece 23 // properly identified when the Joystick is actuated //
nleoni 0:180cf3834ece 24 //**********************************************************************************************//
nleoni 0:180cf3834ece 25
nleoni 0:180cf3834ece 26 class joystickAppBoard{
nleoni 0:180cf3834ece 27 //members
nleoni 0:180cf3834ece 28 private:
nleoni 0:180cf3834ece 29 BusIn *joystickPins;//this will be defined using all 5 pins fo joystick Busin(12,13,14,15,16)
nleoni 0:180cf3834ece 30 int joystickState;
nleoni 0:180cf3834ece 31 //methods
nleoni 0:180cf3834ece 32
nleoni 0:180cf3834ece 33 public:
nleoni 0:180cf3834ece 34 joystickAppBoard();
nleoni 0:180cf3834ece 35 void readJoystick();
nleoni 0:180cf3834ece 36 int getJoystickState(void);
nleoni 0:180cf3834ece 37 bool isJoystickUp();
nleoni 0:180cf3834ece 38 bool isJoystickDown();
nleoni 0:180cf3834ece 39 bool isJoystickLeft();
nleoni 0:180cf3834ece 40 bool isJoystickRight();
nleoni 0:180cf3834ece 41 bool isJoystickCenter();
nleoni 0:180cf3834ece 42
nleoni 0:180cf3834ece 43 };
nleoni 0:180cf3834ece 44
nleoni 0:180cf3834ece 45 #endif