NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
PSPNx.h
1 
2 // PSPNx.h
3 //
4 // This is a class for reading from PSP-Nx, made by Mindsensors.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=61
6 
7 // Initial version: 2010-06-15 by Andrew Sylvester
8 // Large parts of the code is ported from the NXC library for the device,
9 // written by Deepak Patil.
10 
11 /*
12  This library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU Lesser General Public
14  License as published by the Free Software Foundation; either
15  version 2.1 of the License, or (at your option) any later version.
16 
17  This library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  Lesser General Public License for more details.
21 
22  You should have received a copy of the GNU Lesser General Public
23  License along with this library; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26 
27 
28 #ifndef PSPNx_H
29 #define PSPNx_H
30 
31 #define PSPNx_Command 0x41
32 #define PSPNx_ButtonSet1 0x42
33 #define PSPNx_ButtonSet2 0x43
34 #define PSPNx_XLeftJoystick 0x44
35 #define PSPNx_YLeftJoystick 0x45
36 #define PSPNx_XRightJoystick 0x46
37 #define PSPNx_YRightJoystick 0x47
38 
39 #define BS2_Button_L2 0
40 #define BS2_Button_R2 1
41 #define BS2_Button_L1 2
42 #define BS2_Button_R1 3
43 #define BS2_Button_Triangle 4
44 #define BS2_Button_Circle 5
45 #define BS2_Button_Cross 6
46 #define BS2_Button_Square 7
47 
48 #define BS1_Button_Select 0
49 #define BS1_Button_L3 1
50 #define BS1_Button_R3 2
51 #define BS1_Button_Start 3
52 #define BS1_Button_Up 4
53 #define BS1_Button_Right 5
54 #define BS1_Button_Down 6
55 #define BS1_Button_Left 7
56 
57 #include "NXShieldI2C.h"
58 
62 class PSPNx : public NXShieldI2C
63 {
64 public:
66  PSPNx(uint8_t i2c_address = 0x02);
67 
69  uint8_t issueCommand(char command);
70 
72  bool energize();
73 
75  bool deEnergize();
76 
78  bool setDigitalMode();
79 
81  bool setAnalogMode();
82 
86  int8_t getXLJoy();
87 
91  int8_t getYLJoy();
92 
96  int8_t getXRJoy();
97 
101  int8_t getYRJoy();
102 
104  void getButtons(int8_t *buttons1, int8_t *buttons2);
105 
106 };
107 
108 #endif
This class implements I2C interfaces used by NXShield.
Definition: NXShieldI2C.h:32
uint8_t issueCommand(char command)
Definition: PSPNx.cpp:36
bool energize()
Definition: PSPNx.cpp:41
bool deEnergize()
Definition: PSPNx.cpp:46
This class interfaces with PSP-Nx attached to NXShield.
Definition: PSPNx.h:62
int8_t getYRJoy()
Definition: PSPNx.cpp:85
void getButtons(int8_t *buttons1, int8_t *buttons2)
Definition: PSPNx.cpp:94
PSPNx(uint8_t i2c_address=0x02)
Definition: PSPNx.cpp:31
bool setAnalogMode()
Definition: PSPNx.cpp:56
int8_t getXLJoy()
Definition: PSPNx.cpp:61
int8_t getXRJoy()
Definition: PSPNx.cpp:77
bool setDigitalMode()
Definition: PSPNx.cpp:51
int8_t getYLJoy()
Definition: PSPNx.cpp:69