EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVs_PSPNx.h
1 
2 // EVs_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 // Modified for EVShield: 2015-02-17 by Michael Giles
9 // Large parts of the code is ported from the NXC library for the device,
10 // written by Deepak Patil.
11 
12 /*
13  This library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU Lesser General Public
15  License as published by the Free Software Foundation; either
16  version 2.1 of the License, or (at your option) any later version.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 */
27 
28 
29 #ifndef EVs_PSPNx_H
30 #define EVs_PSPNx_H
31 
32 #define PSPNx_Command 0x41
33 #define PSPNx_ButtonSet1 0x42
34 #define PSPNx_ButtonSet2 0x43
35 #define PSPNx_XLeftJoystick 0x44
36 #define PSPNx_YLeftJoystick 0x45
37 #define PSPNx_XRightJoystick 0x46
38 #define PSPNx_YRightJoystick 0x47
39 
40 #define BS2_Button_L2 0
41 #define BS2_Button_R2 1
42 #define BS2_Button_L1 2
43 #define BS2_Button_R1 3
44 #define BS2_Button_Triangle 4
45 #define BS2_Button_Circle 5
46 #define BS2_Button_Cross 6
47 #define BS2_Button_Square 7
48 
49 #define BS1_Button_Select 0
50 #define BS1_Button_L3 1
51 #define BS1_Button_R3 2
52 #define BS1_Button_Start 3
53 #define BS1_Button_Up 4
54 #define BS1_Button_Right 5
55 #define BS1_Button_Down 6
56 #define BS1_Button_Left 7
57 
58 #include "EVShieldI2C.h"
59 
63 class EVs_PSPNx : public EVShieldI2C
64 {
65 public:
67  EVs_PSPNx(uint8_t i2c_address = 0x02);
68 
70  uint8_t issueCommand(char command);
71 
73  bool energize();
74 
76  bool deEnergize();
77 
79  bool setDigitalMode();
80 
82  bool setAnalogMode();
83 
87  int8_t getXLJoy();
88 
92  int8_t getYLJoy();
93 
97  int8_t getXRJoy();
98 
102  int8_t getYRJoy();
103 
105  void getButtons(int8_t *buttons1, int8_t *buttons2);
106 
107 };
108 
109 #endif
int8_t getXLJoy()
Definition: EVs_PSPNx.cpp:61
uint8_t issueCommand(char command)
Definition: EVs_PSPNx.cpp:36
void getButtons(int8_t *buttons1, int8_t *buttons2)
Definition: EVs_PSPNx.cpp:94
int8_t getYRJoy()
Definition: EVs_PSPNx.cpp:85
This class interfaces with PSP-Nx attached to EVShield.
Definition: EVs_PSPNx.h:63
bool deEnergize()
Definition: EVs_PSPNx.cpp:46
EVs_PSPNx(uint8_t i2c_address=0x02)
Definition: EVs_PSPNx.cpp:31
This class implements I2C interfaces used by EVShield.
Definition: EVShieldI2C.h:32
bool setDigitalMode()
Definition: EVs_PSPNx.cpp:51
int8_t getYLJoy()
Definition: EVs_PSPNx.cpp:69
bool energize()
Definition: EVs_PSPNx.cpp:41
int8_t getXRJoy()
Definition: EVs_PSPNx.cpp:77
bool setAnalogMode()
Definition: EVs_PSPNx.cpp:56