NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
ACCLNx.h
1 
2 // ACCLNx.h
3 //
4 // This is a class for reading from ACCL-Nx, made by Mindsensors.
5 // See http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=101
6 
7 // Initial version: 2010-06-10 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 ACCLNx_H
29 #define ACCLNx_H
30 
31 #define ACCLNx_Command 0x41
32 #define READ_SENS 0x19
33 
34 #define ACCLNx_X_TILT 0x42
35 #define ACCLNx_Y_TILT 0x43
36 #define ACCLNx_Z_TILT 0x44
37 #define ACCLNx_X_ACCL 0X45
38 #define ACCLNx_Y_ACCL 0X47
39 #define ACCLNx_Z_ACCL 0X49
40 
41 #include "NXShieldI2C.h"
42 
46 class ACCLNx : public NXShieldI2C
47 {
48 public:
50  ACCLNx(uint8_t i2c_address = 0x02);
51 
53  uint8_t issueCommand(char command);
54 
57 
60 
63 
66 
69 
72 
74  bool resetFactory();
75 
77  short getXTilt();
78 
80  short getYTilt();
81 
83  short getZTilt();
84 
86  int getXAccl();
87 
89  int getYAccl();
90 
92  int getZAccl();
93 
95  short getSens();
96 
97 };
98 
99 #endif
This class implements I2C interfaces used by NXShield.
Definition: NXShieldI2C.h:32
bool aquireXpointCalibrationEnd()
Definition: ACCLNx.cpp:46
bool aquireZpointCalibration()
Definition: ACCLNx.cpp:61
int getZAccl()
Definition: ACCLNx.cpp:101
short getYTilt()
Definition: ACCLNx.cpp:81
bool aquireYpointCalibrationEnd()
Definition: ACCLNx.cpp:56
ACCLNx(uint8_t i2c_address=0x02)
Definition: ACCLNx.cpp:30
short getZTilt()
Definition: ACCLNx.cpp:86
bool aquireXpointCalibration()
Definition: ACCLNx.cpp:41
bool aquireYpointCalibration()
Definition: ACCLNx.cpp:51
uint8_t issueCommand(char command)
Definition: ACCLNx.cpp:36
short getSens()
Definition: ACCLNx.cpp:108
bool aquireZpointCalibrationEnd()
Definition: ACCLNx.cpp:66
bool resetFactory()
Definition: ACCLNx.cpp:71
short getXTilt()
Definition: ACCLNx.cpp:76
int getYAccl()
Definition: ACCLNx.cpp:96
This class interfaces with ACCL-Nx attached to NXShield.
Definition: ACCLNx.h:46
int getXAccl()
Definition: ACCLNx.cpp:91