User | Revision | Line number | New contents of line |
SED9008 |
0:a973ef498a1d
|
1
|
/**
|
SED9008 |
0:a973ef498a1d
|
2
|
* @author Jose R Padron
|
SED9008 |
0:a973ef498a1d
|
3
|
*
|
SED9008 |
0:a973ef498a1d
|
4
|
* @section LICENSE
|
SED9008 |
0:a973ef498a1d
|
5
|
*
|
SED9008 |
0:a973ef498a1d
|
6
|
* Copyright (c) 2010 ARM Limited
|
SED9008 |
0:a973ef498a1d
|
7
|
*
|
SED9008 |
0:a973ef498a1d
|
8
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
SED9008 |
0:a973ef498a1d
|
9
|
* of this software and associated documentation files (the "Software"), to deal
|
SED9008 |
0:a973ef498a1d
|
10
|
* in the Software without restriction, including without limitation the rights
|
SED9008 |
0:a973ef498a1d
|
11
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
SED9008 |
0:a973ef498a1d
|
12
|
* copies of the Software, and to permit persons to whom the Software is
|
SED9008 |
0:a973ef498a1d
|
13
|
* furnished to do so, subject to the following conditions:
|
SED9008 |
0:a973ef498a1d
|
14
|
*
|
SED9008 |
0:a973ef498a1d
|
15
|
* The above copyright notice and this permission notice shall be included in
|
SED9008 |
0:a973ef498a1d
|
16
|
* all copies or substantial portions of the Software.
|
SED9008 |
0:a973ef498a1d
|
17
|
*
|
SED9008 |
0:a973ef498a1d
|
18
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
SED9008 |
0:a973ef498a1d
|
19
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
SED9008 |
0:a973ef498a1d
|
20
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
SED9008 |
0:a973ef498a1d
|
21
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
SED9008 |
0:a973ef498a1d
|
22
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
SED9008 |
0:a973ef498a1d
|
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
SED9008 |
0:a973ef498a1d
|
24
|
* THE SOFTWARE.
|
SED9008 |
0:a973ef498a1d
|
25
|
*
|
SED9008 |
0:a973ef498a1d
|
26
|
* @section DESCRIPTION
|
SED9008 |
0:a973ef498a1d
|
27
|
*
|
SED9008 |
0:a973ef498a1d
|
28
|
* ADXL345, triple axis, digital interface, accelerometer.
|
SED9008 |
0:a973ef498a1d
|
29
|
*
|
SED9008 |
0:a973ef498a1d
|
30
|
* Datasheet:
|
SED9008 |
0:a973ef498a1d
|
31
|
*
|
SED9008 |
0:a973ef498a1d
|
32
|
* http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf
|
SED9008 |
0:a973ef498a1d
|
33
|
*
|
SED9008 |
0:a973ef498a1d
|
34
|
* Things to know: SDO pin must be tied high for address 0x1D or low for address 0x53.
|
SED9008 |
0:a973ef498a1d
|
35
|
* It cannot be left floating.
|
SED9008 |
0:a973ef498a1d
|
36
|
|
SED9008 |
0:a973ef498a1d
|
37
|
*/
|
SED9008 |
0:a973ef498a1d
|
38
|
|
SED9008 |
0:a973ef498a1d
|
39
|
#ifndef ADXL345_I2C_H
|
SED9008 |
0:a973ef498a1d
|
40
|
#define ADXL345_I2C_H
|
SED9008 |
0:a973ef498a1d
|
41
|
|
SED9008 |
0:a973ef498a1d
|
42
|
/**
|
SED9008 |
0:a973ef498a1d
|
43
|
* Includes
|
SED9008 |
0:a973ef498a1d
|
44
|
*/
|
SED9008 |
0:a973ef498a1d
|
45
|
#include "mbed.h"
|
SED9008 |
0:a973ef498a1d
|
46
|
|
SED9008 |
0:a973ef498a1d
|
47
|
/**
|
SED9008 |
0:a973ef498a1d
|
48
|
* Defines
|
SED9008 |
0:a973ef498a1d
|
49
|
*/
|
SED9008 |
0:a973ef498a1d
|
50
|
//Registers.
|
SED9008 |
0:a973ef498a1d
|
51
|
#define ADXL345_DEVID_REG 0x00
|
SED9008 |
0:a973ef498a1d
|
52
|
#define ADXL345_THRESH_TAP_REG 0x1D
|
SED9008 |
0:a973ef498a1d
|
53
|
#define ADXL345_OFSX_REG 0x1E
|
SED9008 |
0:a973ef498a1d
|
54
|
#define ADXL345_OFSY_REG 0x1F
|
SED9008 |
0:a973ef498a1d
|
55
|
#define ADXL345_OFSZ_REG 0x20
|
SED9008 |
0:a973ef498a1d
|
56
|
#define ADXL345_DUR_REG 0x21
|
SED9008 |
0:a973ef498a1d
|
57
|
#define ADXL345_LATENT_REG 0x22
|
SED9008 |
0:a973ef498a1d
|
58
|
#define ADXL345_WINDOW_REG 0x23
|
SED9008 |
0:a973ef498a1d
|
59
|
#define ADXL345_THRESH_ACT_REG 0x24
|
SED9008 |
0:a973ef498a1d
|
60
|
#define ADXL345_THRESH_INACT_REG 0x25
|
SED9008 |
0:a973ef498a1d
|
61
|
#define ADXL345_TIME_INACT_REG 0x26
|
SED9008 |
0:a973ef498a1d
|
62
|
#define ADXL345_ACT_INACT_CTL_REG 0x27
|
SED9008 |
0:a973ef498a1d
|
63
|
#define ADXL345_THRESH_FF_REG 0x28
|
SED9008 |
0:a973ef498a1d
|
64
|
#define ADXL345_TIME_FF_REG 0x29
|
SED9008 |
0:a973ef498a1d
|
65
|
#define ADXL345_TAP_AXES_REG 0x2A
|
SED9008 |
0:a973ef498a1d
|
66
|
#define ADXL345_ACT_TAP_STATUS_REG 0x2B
|
SED9008 |
0:a973ef498a1d
|
67
|
#define ADXL345_BW_RATE_REG 0x2C
|
SED9008 |
0:a973ef498a1d
|
68
|
#define ADXL345_POWER_CTL_REG 0x2D
|
SED9008 |
0:a973ef498a1d
|
69
|
#define ADXL345_INT_ENABLE_REG 0x2E
|
SED9008 |
0:a973ef498a1d
|
70
|
#define ADXL345_INT_MAP_REG 0x2F
|
SED9008 |
0:a973ef498a1d
|
71
|
#define ADXL345_INT_SOURCE_REG 0x30
|
SED9008 |
0:a973ef498a1d
|
72
|
#define ADXL345_DATA_FORMAT_REG 0x31
|
SED9008 |
0:a973ef498a1d
|
73
|
#define ADXL345_DATAX0_REG 0x32
|
SED9008 |
0:a973ef498a1d
|
74
|
#define ADXL345_DATAX1_REG 0x33
|
SED9008 |
0:a973ef498a1d
|
75
|
#define ADXL345_DATAY0_REG 0x34
|
SED9008 |
0:a973ef498a1d
|
76
|
#define ADXL345_DATAY1_REG 0x35
|
SED9008 |
0:a973ef498a1d
|
77
|
#define ADXL345_DATAZ0_REG 0x36
|
SED9008 |
0:a973ef498a1d
|
78
|
#define ADXL345_DATAZ1_REG 0x37
|
SED9008 |
0:a973ef498a1d
|
79
|
#define ADXL345_FIFO_CTL 0x38
|
SED9008 |
0:a973ef498a1d
|
80
|
#define ADXL345_FIFO_STATUS 0x39
|
SED9008 |
0:a973ef498a1d
|
81
|
|
SED9008 |
0:a973ef498a1d
|
82
|
//Data rate codes.
|
SED9008 |
0:a973ef498a1d
|
83
|
#define ADXL345_3200HZ 0x0F
|
SED9008 |
0:a973ef498a1d
|
84
|
#define ADXL345_1600HZ 0x0E
|
SED9008 |
0:a973ef498a1d
|
85
|
#define ADXL345_800HZ 0x0D
|
SED9008 |
0:a973ef498a1d
|
86
|
#define ADXL345_400HZ 0x0C
|
SED9008 |
0:a973ef498a1d
|
87
|
#define ADXL345_200HZ 0x0B
|
SED9008 |
0:a973ef498a1d
|
88
|
#define ADXL345_100HZ 0x0A
|
SED9008 |
0:a973ef498a1d
|
89
|
#define ADXL345_50HZ 0x09
|
SED9008 |
0:a973ef498a1d
|
90
|
#define ADXL345_25HZ 0x08
|
SED9008 |
0:a973ef498a1d
|
91
|
#define ADXL345_12HZ5 0x07
|
SED9008 |
0:a973ef498a1d
|
92
|
#define ADXL345_6HZ25 0x06
|
SED9008 |
0:a973ef498a1d
|
93
|
|
SED9008 |
0:a973ef498a1d
|
94
|
#define ADXL345_ID 0x53
|
SED9008 |
0:a973ef498a1d
|
95
|
#define ADXL345_I2C_READ 0xA7
|
SED9008 |
0:a973ef498a1d
|
96
|
#define ADXL345_I2C_WRITE 0xA6
|
SED9008 |
0:a973ef498a1d
|
97
|
#define ADXL345_MULTI_BYTE 0x60
|
SED9008 |
0:a973ef498a1d
|
98
|
|
SED9008 |
0:a973ef498a1d
|
99
|
#define ADXL345_X 0x00
|
SED9008 |
0:a973ef498a1d
|
100
|
#define ADXL345_Y 0x01
|
SED9008 |
0:a973ef498a1d
|
101
|
#define ADXL345_Z 0x02
|
SED9008 |
0:a973ef498a1d
|
102
|
|
SED9008 |
0:a973ef498a1d
|
103
|
/**
|
SED9008 |
0:a973ef498a1d
|
104
|
* ADXL345 triple axis, digital interface, accelerometer.
|
SED9008 |
0:a973ef498a1d
|
105
|
*/
|
SED9008 |
0:a973ef498a1d
|
106
|
class ADXL345_I2C {
|
SED9008 |
0:a973ef498a1d
|
107
|
|
SED9008 |
0:a973ef498a1d
|
108
|
public:
|
SED9008 |
0:a973ef498a1d
|
109
|
|
SED9008 |
0:a973ef498a1d
|
110
|
/**
|
SED9008 |
0:a973ef498a1d
|
111
|
* Constructor.
|
SED9008 |
0:a973ef498a1d
|
112
|
*
|
SED9008 |
0:a973ef498a1d
|
113
|
* @param sda mbed pin to use for sda line of I2C interface.
|
SED9008 |
0:a973ef498a1d
|
114
|
* @param scl mbed pin to use for SCL line of I2C interface.
|
SED9008 |
0:a973ef498a1d
|
115
|
* @param cs mbed pin to use for not chip select line of I2C interface.
|
SED9008 |
0:a973ef498a1d
|
116
|
*/
|
SED9008 |
0:a973ef498a1d
|
117
|
ADXL345_I2C(PinName sda, PinName scl);
|
SED9008 |
0:a973ef498a1d
|
118
|
|
SED9008 |
0:a973ef498a1d
|
119
|
/**
|
SED9008 |
0:a973ef498a1d
|
120
|
* Read the device ID register on the device.
|
SED9008 |
0:a973ef498a1d
|
121
|
*
|
SED9008 |
0:a973ef498a1d
|
122
|
* @return The device ID code
|
SED9008 |
0:a973ef498a1d
|
123
|
*/
|
SED9008 |
0:a973ef498a1d
|
124
|
char getDevId(void);
|
SED9008 |
0:a973ef498a1d
|
125
|
|
SED9008 |
0:a973ef498a1d
|
126
|
/**
|
SED9008 |
0:a973ef498a1d
|
127
|
* Read the tap threshold on the device.
|
SED9008 |
0:a973ef498a1d
|
128
|
*
|
SED9008 |
0:a973ef498a1d
|
129
|
* @return The tap threshold as an 8-bit number with a scale factor of
|
SED9008 |
0:a973ef498a1d
|
130
|
* 62.5mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
131
|
*/
|
SED9008 |
0:a973ef498a1d
|
132
|
int getTapThreshold(void);
|
SED9008 |
0:a973ef498a1d
|
133
|
|
SED9008 |
0:a973ef498a1d
|
134
|
/**
|
SED9008 |
0:a973ef498a1d
|
135
|
* Set the tap threshold.
|
SED9008 |
0:a973ef498a1d
|
136
|
*
|
SED9008 |
0:a973ef498a1d
|
137
|
* @param The tap threshold as an 8-bit number with a scale factor of
|
SED9008 |
0:a973ef498a1d
|
138
|
* 62.5mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
139
|
*/
|
SED9008 |
0:a973ef498a1d
|
140
|
void setTapThreshold(int threshold);
|
SED9008 |
0:a973ef498a1d
|
141
|
|
SED9008 |
0:a973ef498a1d
|
142
|
/**
|
SED9008 |
0:a973ef498a1d
|
143
|
* Get the current offset for a particular axis.
|
SED9008 |
0:a973ef498a1d
|
144
|
*
|
SED9008 |
0:a973ef498a1d
|
145
|
* @param axis 0x00 -> X-axis
|
SED9008 |
0:a973ef498a1d
|
146
|
* 0x01 -> Y-axis
|
SED9008 |
0:a973ef498a1d
|
147
|
* 0x02 -> Z-axis
|
SED9008 |
0:a973ef498a1d
|
148
|
* @return The current offset as an 8-bit 2's complement number with scale
|
SED9008 |
0:a973ef498a1d
|
149
|
* factor 15.6mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
150
|
*/
|
SED9008 |
0:a973ef498a1d
|
151
|
int getOffset(int axis);
|
SED9008 |
0:a973ef498a1d
|
152
|
|
SED9008 |
0:a973ef498a1d
|
153
|
/**
|
SED9008 |
0:a973ef498a1d
|
154
|
* Set the offset for a particular axis.
|
SED9008 |
0:a973ef498a1d
|
155
|
*
|
SED9008 |
0:a973ef498a1d
|
156
|
* @param axis 0x00 -> X-axis
|
SED9008 |
0:a973ef498a1d
|
157
|
* 0x01 -> Y-axis
|
SED9008 |
0:a973ef498a1d
|
158
|
* 0x02 -> Z-axis
|
SED9008 |
0:a973ef498a1d
|
159
|
* @param offset The offset as an 8-bit 2's complement number with scale
|
SED9008 |
0:a973ef498a1d
|
160
|
* factor 15.6mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
161
|
*/
|
SED9008 |
0:a973ef498a1d
|
162
|
void setOffset(int axis, char offset);
|
SED9008 |
0:a973ef498a1d
|
163
|
|
SED9008 |
0:a973ef498a1d
|
164
|
/**
|
SED9008 |
0:a973ef498a1d
|
165
|
* Get the tap duration required to trigger an event.
|
SED9008 |
0:a973ef498a1d
|
166
|
*
|
SED9008 |
0:a973ef498a1d
|
167
|
* @return The max time that an event must be above the tap threshold to
|
SED9008 |
0:a973ef498a1d
|
168
|
* qualify as a tap event, in microseconds.
|
SED9008 |
0:a973ef498a1d
|
169
|
*/
|
SED9008 |
0:a973ef498a1d
|
170
|
int getTapDuration(void);
|
SED9008 |
0:a973ef498a1d
|
171
|
|
SED9008 |
0:a973ef498a1d
|
172
|
/**
|
SED9008 |
0:a973ef498a1d
|
173
|
* Set the tap duration required to trigger an event.
|
SED9008 |
0:a973ef498a1d
|
174
|
*
|
SED9008 |
0:a973ef498a1d
|
175
|
* @param duration_us The max time that an event must be above the tap
|
SED9008 |
0:a973ef498a1d
|
176
|
* threshold to qualify as a tap event, in microseconds.
|
SED9008 |
0:a973ef498a1d
|
177
|
* Time will be normalized by the scale factor which is
|
SED9008 |
0:a973ef498a1d
|
178
|
* 625us/LSB. A value of 0 disables the single/double
|
SED9008 |
0:a973ef498a1d
|
179
|
* tap functions.
|
SED9008 |
0:a973ef498a1d
|
180
|
*/
|
SED9008 |
0:a973ef498a1d
|
181
|
void setTapDuration(int duration_us);
|
SED9008 |
0:a973ef498a1d
|
182
|
|
SED9008 |
0:a973ef498a1d
|
183
|
/**
|
SED9008 |
0:a973ef498a1d
|
184
|
* Get the tap latency between the detection of a tap and the time window.
|
SED9008 |
0:a973ef498a1d
|
185
|
*
|
SED9008 |
0:a973ef498a1d
|
186
|
* @return The wait time from the detection of a tap event to the start of
|
SED9008 |
0:a973ef498a1d
|
187
|
* the time window during which a possible second tap event can be
|
SED9008 |
0:a973ef498a1d
|
188
|
* detected in milliseconds.
|
SED9008 |
0:a973ef498a1d
|
189
|
*/
|
SED9008 |
0:a973ef498a1d
|
190
|
float getTapLatency(void);
|
SED9008 |
0:a973ef498a1d
|
191
|
|
SED9008 |
0:a973ef498a1d
|
192
|
/**
|
SED9008 |
0:a973ef498a1d
|
193
|
* Set the tap latency between the detection of a tap and the time window.
|
SED9008 |
0:a973ef498a1d
|
194
|
*
|
SED9008 |
0:a973ef498a1d
|
195
|
* @param latency_ms The wait time from the detection of a tap event to the
|
SED9008 |
0:a973ef498a1d
|
196
|
* start of the time window during which a possible
|
SED9008 |
0:a973ef498a1d
|
197
|
* second tap event can be detected in milliseconds.
|
SED9008 |
0:a973ef498a1d
|
198
|
* A value of 0 disables the double tap function.
|
SED9008 |
0:a973ef498a1d
|
199
|
*/
|
SED9008 |
0:a973ef498a1d
|
200
|
void setTapLatency(int latency_ms);
|
SED9008 |
0:a973ef498a1d
|
201
|
|
SED9008 |
0:a973ef498a1d
|
202
|
/**
|
SED9008 |
0:a973ef498a1d
|
203
|
* Get the time of window between tap latency and a double tap.
|
SED9008 |
0:a973ef498a1d
|
204
|
*
|
SED9008 |
0:a973ef498a1d
|
205
|
* @return The amount of time after the expiration of the latency time
|
SED9008 |
0:a973ef498a1d
|
206
|
* during which a second valid tap can begin, in milliseconds.
|
SED9008 |
0:a973ef498a1d
|
207
|
*/
|
SED9008 |
0:a973ef498a1d
|
208
|
float getWindowTime(void);
|
SED9008 |
0:a973ef498a1d
|
209
|
|
SED9008 |
0:a973ef498a1d
|
210
|
/**
|
SED9008 |
0:a973ef498a1d
|
211
|
* Set the time of the window between tap latency and a double tap.
|
SED9008 |
0:a973ef498a1d
|
212
|
*
|
SED9008 |
0:a973ef498a1d
|
213
|
* @param window_ms The amount of time after the expiration of the latency
|
SED9008 |
0:a973ef498a1d
|
214
|
* time during which a second valid tap can begin,
|
SED9008 |
0:a973ef498a1d
|
215
|
* in milliseconds.
|
SED9008 |
0:a973ef498a1d
|
216
|
*/
|
SED9008 |
0:a973ef498a1d
|
217
|
void setWindowTime(int window_ms);
|
SED9008 |
0:a973ef498a1d
|
218
|
|
SED9008 |
0:a973ef498a1d
|
219
|
/**
|
SED9008 |
0:a973ef498a1d
|
220
|
* Get the threshold value for detecting activity.
|
SED9008 |
0:a973ef498a1d
|
221
|
*
|
SED9008 |
0:a973ef498a1d
|
222
|
* @return The threshold value for detecting activity as an 8-bit number.
|
SED9008 |
0:a973ef498a1d
|
223
|
* Scale factor is 62.5mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
224
|
*/
|
SED9008 |
0:a973ef498a1d
|
225
|
int getActivityThreshold(void);
|
SED9008 |
0:a973ef498a1d
|
226
|
|
SED9008 |
0:a973ef498a1d
|
227
|
/**
|
SED9008 |
0:a973ef498a1d
|
228
|
* Set the threshold value for detecting activity.
|
SED9008 |
0:a973ef498a1d
|
229
|
*
|
SED9008 |
0:a973ef498a1d
|
230
|
* @param threshold The threshold value for detecting activity as an 8-bit
|
SED9008 |
0:a973ef498a1d
|
231
|
* number. Scale factor is 62.5mg/LSB. A value of 0 may
|
SED9008 |
0:a973ef498a1d
|
232
|
* result in undesirable behavior if the activity
|
SED9008 |
0:a973ef498a1d
|
233
|
* interrupt is enabled.
|
SED9008 |
0:a973ef498a1d
|
234
|
*/
|
SED9008 |
0:a973ef498a1d
|
235
|
void setActivityThreshold(int threshold);
|
SED9008 |
0:a973ef498a1d
|
236
|
|
SED9008 |
0:a973ef498a1d
|
237
|
/**
|
SED9008 |
0:a973ef498a1d
|
238
|
* Get the threshold value for detecting inactivity.
|
SED9008 |
0:a973ef498a1d
|
239
|
*
|
SED9008 |
0:a973ef498a1d
|
240
|
* @return The threshold value for detecting inactivity as an 8-bit number.
|
SED9008 |
0:a973ef498a1d
|
241
|
* Scale factor is 62.5mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
242
|
*/
|
SED9008 |
0:a973ef498a1d
|
243
|
int getInactivityThreshold(void);
|
SED9008 |
0:a973ef498a1d
|
244
|
|
SED9008 |
0:a973ef498a1d
|
245
|
/**
|
SED9008 |
0:a973ef498a1d
|
246
|
* Set the threshold value for detecting inactivity.
|
SED9008 |
0:a973ef498a1d
|
247
|
*
|
SED9008 |
0:a973ef498a1d
|
248
|
* @param threshold The threshold value for detecting inactivity as an
|
SED9008 |
0:a973ef498a1d
|
249
|
* 8-bit number. Scale factor is 62.5mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
250
|
*/
|
SED9008 |
0:a973ef498a1d
|
251
|
void setInactivityThreshold(int threshold);
|
SED9008 |
0:a973ef498a1d
|
252
|
|
SED9008 |
0:a973ef498a1d
|
253
|
/**
|
SED9008 |
0:a973ef498a1d
|
254
|
* Get the time required for inactivity to be declared.
|
SED9008 |
0:a973ef498a1d
|
255
|
*
|
SED9008 |
0:a973ef498a1d
|
256
|
* @return The amount of time that acceleration must be less than the
|
SED9008 |
0:a973ef498a1d
|
257
|
* inactivity threshold for inactivity to be declared, in
|
SED9008 |
0:a973ef498a1d
|
258
|
* seconds.
|
SED9008 |
0:a973ef498a1d
|
259
|
*/
|
SED9008 |
0:a973ef498a1d
|
260
|
int getTimeInactivity(void);
|
SED9008 |
0:a973ef498a1d
|
261
|
|
SED9008 |
0:a973ef498a1d
|
262
|
/**
|
SED9008 |
0:a973ef498a1d
|
263
|
* Set the time required for inactivity to be declared.
|
SED9008 |
0:a973ef498a1d
|
264
|
*
|
SED9008 |
0:a973ef498a1d
|
265
|
* @param inactivity The amount of time that acceleration must be less than
|
SED9008 |
0:a973ef498a1d
|
266
|
* the inactivity threshold for inactivity to be
|
SED9008 |
0:a973ef498a1d
|
267
|
* declared, in seconds. A value of 0 results in an
|
SED9008 |
0:a973ef498a1d
|
268
|
* interrupt when the output data is less than the
|
SED9008 |
0:a973ef498a1d
|
269
|
* threshold inactivity.
|
SED9008 |
0:a973ef498a1d
|
270
|
*/
|
SED9008 |
0:a973ef498a1d
|
271
|
void setTimeInactivity(int timeInactivity);
|
SED9008 |
0:a973ef498a1d
|
272
|
|
SED9008 |
0:a973ef498a1d
|
273
|
/**
|
SED9008 |
0:a973ef498a1d
|
274
|
* Get the activity/inactivity control settings.
|
SED9008 |
0:a973ef498a1d
|
275
|
*
|
SED9008 |
0:a973ef498a1d
|
276
|
* D7 D6 D5 D4
|
SED9008 |
0:a973ef498a1d
|
277
|
* +-----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
278
|
* | ACT ac/dc | ACT_X enable | ACT_Y enable | ACT_Z enable |
|
SED9008 |
0:a973ef498a1d
|
279
|
* +-----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
280
|
*
|
SED9008 |
0:a973ef498a1d
|
281
|
* D3 D2 D1 D0
|
SED9008 |
0:a973ef498a1d
|
282
|
* +-------------+----------------+----------------+----------------+
|
SED9008 |
0:a973ef498a1d
|
283
|
* | INACT ac/dc | INACT_X enable | INACT_Y enable | INACT_Z enable |
|
SED9008 |
0:a973ef498a1d
|
284
|
* +-------------+----------------+----------------+----------------+
|
SED9008 |
0:a973ef498a1d
|
285
|
*
|
SED9008 |
0:a973ef498a1d
|
286
|
* See datasheet for details.
|
SED9008 |
0:a973ef498a1d
|
287
|
*
|
SED9008 |
0:a973ef498a1d
|
288
|
* @return The contents of the ACT_INACT_CTL register.
|
SED9008 |
0:a973ef498a1d
|
289
|
*/
|
SED9008 |
0:a973ef498a1d
|
290
|
int getActivityInactivityControl(void);
|
SED9008 |
0:a973ef498a1d
|
291
|
|
SED9008 |
0:a973ef498a1d
|
292
|
/**
|
SED9008 |
0:a973ef498a1d
|
293
|
* Set the activity/inactivity control settings.
|
SED9008 |
0:a973ef498a1d
|
294
|
*
|
SED9008 |
0:a973ef498a1d
|
295
|
* D7 D6 D5 D4
|
SED9008 |
0:a973ef498a1d
|
296
|
* +-----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
297
|
* | ACT ac/dc | ACT_X enable | ACT_Y enable | ACT_Z enable |
|
SED9008 |
0:a973ef498a1d
|
298
|
* +-----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
299
|
*
|
SED9008 |
0:a973ef498a1d
|
300
|
* D3 D2 D1 D0
|
SED9008 |
0:a973ef498a1d
|
301
|
* +-------------+----------------+----------------+----------------+
|
SED9008 |
0:a973ef498a1d
|
302
|
* | INACT ac/dc | INACT_X enable | INACT_Y enable | INACT_Z enable |
|
SED9008 |
0:a973ef498a1d
|
303
|
* +-------------+----------------+----------------+----------------+
|
SED9008 |
0:a973ef498a1d
|
304
|
*
|
SED9008 |
0:a973ef498a1d
|
305
|
* See datasheet for details.
|
SED9008 |
0:a973ef498a1d
|
306
|
*
|
SED9008 |
0:a973ef498a1d
|
307
|
* @param settings The control byte to write to the ACT_INACT_CTL register.
|
SED9008 |
0:a973ef498a1d
|
308
|
*/
|
SED9008 |
0:a973ef498a1d
|
309
|
void setActivityInactivityControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
310
|
|
SED9008 |
0:a973ef498a1d
|
311
|
/**
|
SED9008 |
0:a973ef498a1d
|
312
|
* Get the threshold for free fall detection.
|
SED9008 |
0:a973ef498a1d
|
313
|
*
|
SED9008 |
0:a973ef498a1d
|
314
|
* @return The threshold value for free-fall detection, as an 8-bit number,
|
SED9008 |
0:a973ef498a1d
|
315
|
* with scale factor 62.5mg/LSB.
|
SED9008 |
0:a973ef498a1d
|
316
|
*/
|
SED9008 |
0:a973ef498a1d
|
317
|
int getFreefallThreshold(void);
|
SED9008 |
0:a973ef498a1d
|
318
|
|
SED9008 |
0:a973ef498a1d
|
319
|
/**
|
SED9008 |
0:a973ef498a1d
|
320
|
* Set the threshold for free fall detection.
|
SED9008 |
0:a973ef498a1d
|
321
|
*
|
SED9008 |
0:a973ef498a1d
|
322
|
* @return The threshold value for free-fall detection, as an 8-bit number,
|
SED9008 |
0:a973ef498a1d
|
323
|
* with scale factor 62.5mg/LSB. A value of 0 may result in
|
SED9008 |
0:a973ef498a1d
|
324
|
* undesirable behavior if the free-fall interrupt is enabled.
|
SED9008 |
0:a973ef498a1d
|
325
|
* Values between 300 mg and 600 mg (0x05 to 0x09) are recommended.
|
SED9008 |
0:a973ef498a1d
|
326
|
*/
|
SED9008 |
0:a973ef498a1d
|
327
|
void setFreefallThreshold(int threshold);
|
SED9008 |
0:a973ef498a1d
|
328
|
|
SED9008 |
0:a973ef498a1d
|
329
|
/**
|
SED9008 |
0:a973ef498a1d
|
330
|
* Get the time required to generate a free fall interrupt.
|
SED9008 |
0:a973ef498a1d
|
331
|
*
|
SED9008 |
0:a973ef498a1d
|
332
|
* @return The minimum time that the value of all axes must be less than
|
SED9008 |
0:a973ef498a1d
|
333
|
* the freefall threshold to generate a free-fall interrupt, in
|
SED9008 |
0:a973ef498a1d
|
334
|
* milliseconds.
|
SED9008 |
0:a973ef498a1d
|
335
|
*/
|
SED9008 |
0:a973ef498a1d
|
336
|
int getFreefallTime(void);
|
SED9008 |
0:a973ef498a1d
|
337
|
|
SED9008 |
0:a973ef498a1d
|
338
|
/**
|
SED9008 |
0:a973ef498a1d
|
339
|
* Set the time required to generate a free fall interrupt.
|
SED9008 |
0:a973ef498a1d
|
340
|
*
|
SED9008 |
0:a973ef498a1d
|
341
|
* @return The minimum time that the value of all axes must be less than
|
SED9008 |
0:a973ef498a1d
|
342
|
* the freefall threshold to generate a free-fall interrupt, in
|
SED9008 |
0:a973ef498a1d
|
343
|
* milliseconds. A value of 0 may result in undesirable behavior
|
SED9008 |
0:a973ef498a1d
|
344
|
* if the free-fall interrupt is enabled. Values between 100 ms
|
SED9008 |
0:a973ef498a1d
|
345
|
* and 350 ms (0x14 to 0x46) are recommended.
|
SED9008 |
0:a973ef498a1d
|
346
|
*/
|
SED9008 |
0:a973ef498a1d
|
347
|
void setFreefallTime(int freefallTime_ms);
|
SED9008 |
0:a973ef498a1d
|
348
|
|
SED9008 |
0:a973ef498a1d
|
349
|
/**
|
SED9008 |
0:a973ef498a1d
|
350
|
* Get the axis tap settings.
|
SED9008 |
0:a973ef498a1d
|
351
|
*
|
SED9008 |
0:a973ef498a1d
|
352
|
* D3 D2 D1 D0
|
SED9008 |
0:a973ef498a1d
|
353
|
* +----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
354
|
* | Suppress | TAP_X enable | TAP_Y enable | TAP_Z enable |
|
SED9008 |
0:a973ef498a1d
|
355
|
* +----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
356
|
*
|
SED9008 |
0:a973ef498a1d
|
357
|
* (D7-D4 are 0s).
|
SED9008 |
0:a973ef498a1d
|
358
|
*
|
SED9008 |
0:a973ef498a1d
|
359
|
* See datasheet for more details.
|
SED9008 |
0:a973ef498a1d
|
360
|
*
|
SED9008 |
0:a973ef498a1d
|
361
|
* @return The contents of the TAP_AXES register.
|
SED9008 |
0:a973ef498a1d
|
362
|
*/
|
SED9008 |
0:a973ef498a1d
|
363
|
int getTapAxisControl(void);
|
SED9008 |
0:a973ef498a1d
|
364
|
|
SED9008 |
0:a973ef498a1d
|
365
|
/**
|
SED9008 |
0:a973ef498a1d
|
366
|
* Set the axis tap settings.
|
SED9008 |
0:a973ef498a1d
|
367
|
*
|
SED9008 |
0:a973ef498a1d
|
368
|
* D3 D2 D1 D0
|
SED9008 |
0:a973ef498a1d
|
369
|
* +----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
370
|
* | Suppress | TAP_X enable | TAP_Y enable | TAP_Z enable |
|
SED9008 |
0:a973ef498a1d
|
371
|
* +----------+--------------+--------------+--------------+
|
SED9008 |
0:a973ef498a1d
|
372
|
*
|
SED9008 |
0:a973ef498a1d
|
373
|
* (D7-D4 are 0s).
|
SED9008 |
0:a973ef498a1d
|
374
|
*
|
SED9008 |
0:a973ef498a1d
|
375
|
* See datasheet for more details.
|
SED9008 |
0:a973ef498a1d
|
376
|
*
|
SED9008 |
0:a973ef498a1d
|
377
|
* @param The control byte to write to the TAP_AXES register.
|
SED9008 |
0:a973ef498a1d
|
378
|
*/
|
SED9008 |
0:a973ef498a1d
|
379
|
void setTapAxisControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
380
|
|
SED9008 |
0:a973ef498a1d
|
381
|
/**
|
SED9008 |
0:a973ef498a1d
|
382
|
* Get the source of a tap.
|
SED9008 |
0:a973ef498a1d
|
383
|
*
|
SED9008 |
0:a973ef498a1d
|
384
|
* @return The contents of the ACT_TAP_STATUS register.
|
SED9008 |
0:a973ef498a1d
|
385
|
*/
|
SED9008 |
0:a973ef498a1d
|
386
|
int getTapSource(void);
|
SED9008 |
0:a973ef498a1d
|
387
|
|
SED9008 |
0:a973ef498a1d
|
388
|
/**
|
SED9008 |
0:a973ef498a1d
|
389
|
* Set the power mode.
|
SED9008 |
0:a973ef498a1d
|
390
|
*
|
SED9008 |
0:a973ef498a1d
|
391
|
* @param mode 0 -> Normal operation.
|
SED9008 |
0:a973ef498a1d
|
392
|
* 1 -> Reduced power operation.
|
SED9008 |
0:a973ef498a1d
|
393
|
*/
|
SED9008 |
0:a973ef498a1d
|
394
|
void setPowerMode(char mode);
|
SED9008 |
0:a973ef498a1d
|
395
|
|
SED9008 |
0:a973ef498a1d
|
396
|
/**
|
SED9008 |
0:a973ef498a1d
|
397
|
* Set the data rate.
|
SED9008 |
0:a973ef498a1d
|
398
|
*
|
SED9008 |
0:a973ef498a1d
|
399
|
* @param rate The rate code (see #defines or datasheet).
|
SED9008 |
0:a973ef498a1d
|
400
|
*/
|
SED9008 |
0:a973ef498a1d
|
401
|
void setDataRate(int rate);
|
SED9008 |
0:a973ef498a1d
|
402
|
|
SED9008 |
0:a973ef498a1d
|
403
|
/**
|
SED9008 |
0:a973ef498a1d
|
404
|
* Get the power control settings.
|
SED9008 |
0:a973ef498a1d
|
405
|
*
|
SED9008 |
0:a973ef498a1d
|
406
|
* See datasheet for details.
|
SED9008 |
0:a973ef498a1d
|
407
|
*
|
SED9008 |
0:a973ef498a1d
|
408
|
* @return The contents of the POWER_CTL register.
|
SED9008 |
0:a973ef498a1d
|
409
|
*/
|
SED9008 |
0:a973ef498a1d
|
410
|
int getPowerControl(void);
|
SED9008 |
0:a973ef498a1d
|
411
|
|
SED9008 |
0:a973ef498a1d
|
412
|
/**
|
SED9008 |
0:a973ef498a1d
|
413
|
* Set the power control settings.
|
SED9008 |
0:a973ef498a1d
|
414
|
*
|
SED9008 |
0:a973ef498a1d
|
415
|
* See datasheet for details.
|
SED9008 |
0:a973ef498a1d
|
416
|
*
|
SED9008 |
0:a973ef498a1d
|
417
|
* @param The control byte to write to the POWER_CTL register.
|
SED9008 |
0:a973ef498a1d
|
418
|
*/
|
SED9008 |
0:a973ef498a1d
|
419
|
void setPowerControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
420
|
|
SED9008 |
0:a973ef498a1d
|
421
|
/**
|
SED9008 |
0:a973ef498a1d
|
422
|
* Get the interrupt enable settings.
|
SED9008 |
0:a973ef498a1d
|
423
|
*
|
SED9008 |
0:a973ef498a1d
|
424
|
* @return The contents of the INT_ENABLE register.
|
SED9008 |
0:a973ef498a1d
|
425
|
*/
|
SED9008 |
0:a973ef498a1d
|
426
|
int getInterruptEnableControl(void);
|
SED9008 |
0:a973ef498a1d
|
427
|
|
SED9008 |
0:a973ef498a1d
|
428
|
/**
|
SED9008 |
0:a973ef498a1d
|
429
|
* Set the interrupt enable settings.
|
SED9008 |
0:a973ef498a1d
|
430
|
*
|
SED9008 |
0:a973ef498a1d
|
431
|
* @param settings The control byte to write to the INT_ENABLE register.
|
SED9008 |
0:a973ef498a1d
|
432
|
*/
|
SED9008 |
0:a973ef498a1d
|
433
|
void setInterruptEnableControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
434
|
|
SED9008 |
0:a973ef498a1d
|
435
|
/**
|
SED9008 |
0:a973ef498a1d
|
436
|
* Get the interrupt mapping settings.
|
SED9008 |
0:a973ef498a1d
|
437
|
*
|
SED9008 |
0:a973ef498a1d
|
438
|
* @return The contents of the INT_MAP register.
|
SED9008 |
0:a973ef498a1d
|
439
|
*/
|
SED9008 |
0:a973ef498a1d
|
440
|
int getInterruptMappingControl(void);
|
SED9008 |
0:a973ef498a1d
|
441
|
|
SED9008 |
0:a973ef498a1d
|
442
|
/**
|
SED9008 |
0:a973ef498a1d
|
443
|
* Set the interrupt mapping settings.
|
SED9008 |
0:a973ef498a1d
|
444
|
*
|
SED9008 |
0:a973ef498a1d
|
445
|
* @param settings The control byte to write to the INT_MAP register.
|
SED9008 |
0:a973ef498a1d
|
446
|
*/
|
SED9008 |
0:a973ef498a1d
|
447
|
void setInterruptMappingControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
448
|
|
SED9008 |
0:a973ef498a1d
|
449
|
/**
|
SED9008 |
0:a973ef498a1d
|
450
|
* Get the interrupt source.
|
SED9008 |
0:a973ef498a1d
|
451
|
*
|
SED9008 |
0:a973ef498a1d
|
452
|
* @return The contents of the INT_SOURCE register.
|
SED9008 |
0:a973ef498a1d
|
453
|
*/
|
SED9008 |
0:a973ef498a1d
|
454
|
int getInterruptSource(void);
|
SED9008 |
0:a973ef498a1d
|
455
|
|
SED9008 |
0:a973ef498a1d
|
456
|
/**
|
SED9008 |
0:a973ef498a1d
|
457
|
* Get the data format settings.
|
SED9008 |
0:a973ef498a1d
|
458
|
*
|
SED9008 |
0:a973ef498a1d
|
459
|
* @return The contents of the DATA_FORMAT register.
|
SED9008 |
0:a973ef498a1d
|
460
|
*/
|
SED9008 |
0:a973ef498a1d
|
461
|
int getDataFormatControl(void);
|
SED9008 |
0:a973ef498a1d
|
462
|
|
SED9008 |
0:a973ef498a1d
|
463
|
/**
|
SED9008 |
0:a973ef498a1d
|
464
|
* Set the data format settings.
|
SED9008 |
0:a973ef498a1d
|
465
|
*
|
SED9008 |
0:a973ef498a1d
|
466
|
* @param settings The control byte to write to the DATA_FORMAT register.
|
SED9008 |
0:a973ef498a1d
|
467
|
*/
|
SED9008 |
0:a973ef498a1d
|
468
|
void setDataFormatControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
469
|
|
SED9008 |
0:a973ef498a1d
|
470
|
/**
|
SED9008 |
0:a973ef498a1d
|
471
|
* Get the output of all three axes.
|
SED9008 |
0:a973ef498a1d
|
472
|
*
|
SED9008 |
0:a973ef498a1d
|
473
|
* @param Pointer to a buffer to hold the accelerometer value for the
|
SED9008 |
0:a973ef498a1d
|
474
|
* x-axis, y-axis and z-axis [in that order].
|
SED9008 |
0:a973ef498a1d
|
475
|
*/
|
SED9008 |
0:a973ef498a1d
|
476
|
void getOutput(int* readings);
|
SED9008 |
0:a973ef498a1d
|
477
|
|
SED9008 |
0:a973ef498a1d
|
478
|
|
SED9008 |
0:a973ef498a1d
|
479
|
/**
|
SED9008 |
0:a973ef498a1d
|
480
|
* Get acceleration of X axis.
|
SED9008 |
0:a973ef498a1d
|
481
|
*
|
SED9008 |
0:a973ef498a1d
|
482
|
*@return Accelerometer value for the x-axis.
|
SED9008 |
0:a973ef498a1d
|
483
|
*/
|
SED9008 |
0:a973ef498a1d
|
484
|
int getAx();
|
SED9008 |
0:a973ef498a1d
|
485
|
|
SED9008 |
0:a973ef498a1d
|
486
|
|
SED9008 |
0:a973ef498a1d
|
487
|
/**
|
SED9008 |
0:a973ef498a1d
|
488
|
* Get acceleration of Y axis.
|
SED9008 |
0:a973ef498a1d
|
489
|
*
|
SED9008 |
0:a973ef498a1d
|
490
|
*@return Accelerometer value for the y-axis
|
SED9008 |
0:a973ef498a1d
|
491
|
*/
|
SED9008 |
0:a973ef498a1d
|
492
|
int getAy();
|
SED9008 |
0:a973ef498a1d
|
493
|
|
SED9008 |
0:a973ef498a1d
|
494
|
|
SED9008 |
0:a973ef498a1d
|
495
|
/**
|
SED9008 |
0:a973ef498a1d
|
496
|
* Get acceleration of Z axis.
|
SED9008 |
0:a973ef498a1d
|
497
|
*
|
SED9008 |
0:a973ef498a1d
|
498
|
*@return Accelerometer value for the z-axis
|
SED9008 |
0:a973ef498a1d
|
499
|
*/
|
SED9008 |
0:a973ef498a1d
|
500
|
int getAz();
|
SED9008 |
0:a973ef498a1d
|
501
|
|
SED9008 |
0:a973ef498a1d
|
502
|
|
SED9008 |
0:a973ef498a1d
|
503
|
|
SED9008 |
0:a973ef498a1d
|
504
|
|
SED9008 |
0:a973ef498a1d
|
505
|
|
SED9008 |
0:a973ef498a1d
|
506
|
/**
|
SED9008 |
0:a973ef498a1d
|
507
|
* Get the FIFO control settings.
|
SED9008 |
0:a973ef498a1d
|
508
|
*
|
SED9008 |
0:a973ef498a1d
|
509
|
* @return The contents of the FIFO_CTL register.
|
SED9008 |
0:a973ef498a1d
|
510
|
*/
|
SED9008 |
0:a973ef498a1d
|
511
|
int getFifoControl(void);
|
SED9008 |
0:a973ef498a1d
|
512
|
|
SED9008 |
0:a973ef498a1d
|
513
|
/**
|
SED9008 |
0:a973ef498a1d
|
514
|
* Set the FIFO control settings.
|
SED9008 |
0:a973ef498a1d
|
515
|
*
|
SED9008 |
0:a973ef498a1d
|
516
|
* @param The control byte to write to the FIFO_CTL register.
|
SED9008 |
0:a973ef498a1d
|
517
|
*/
|
SED9008 |
0:a973ef498a1d
|
518
|
void setFifoControl(int settings);
|
SED9008 |
0:a973ef498a1d
|
519
|
|
SED9008 |
0:a973ef498a1d
|
520
|
/**
|
SED9008 |
0:a973ef498a1d
|
521
|
* Get FIFO status.
|
SED9008 |
0:a973ef498a1d
|
522
|
*
|
SED9008 |
0:a973ef498a1d
|
523
|
* @return The contents of the FIFO_STATUS register.
|
SED9008 |
0:a973ef498a1d
|
524
|
*/
|
SED9008 |
0:a973ef498a1d
|
525
|
int getFifoStatus(void);
|
SED9008 |
0:a973ef498a1d
|
526
|
|
SED9008 |
0:a973ef498a1d
|
527
|
private:
|
SED9008 |
0:a973ef498a1d
|
528
|
I2C i2c_;
|
SED9008 |
0:a973ef498a1d
|
529
|
|
SED9008 |
0:a973ef498a1d
|
530
|
/**
|
SED9008 |
0:a973ef498a1d
|
531
|
* Read one byte from a register on the device.
|
SED9008 |
0:a973ef498a1d
|
532
|
*
|
SED9008 |
0:a973ef498a1d
|
533
|
* @param address Address of the register to read.
|
SED9008 |
0:a973ef498a1d
|
534
|
*
|
SED9008 |
0:a973ef498a1d
|
535
|
* @return The contents of the register address.
|
SED9008 |
0:a973ef498a1d
|
536
|
*/
|
SED9008 |
0:a973ef498a1d
|
537
|
char oneByteRead(char address);
|
SED9008 |
0:a973ef498a1d
|
538
|
|
SED9008 |
0:a973ef498a1d
|
539
|
/**
|
SED9008 |
0:a973ef498a1d
|
540
|
* Write one byte to a register on the device.
|
SED9008 |
0:a973ef498a1d
|
541
|
*
|
SED9008 |
0:a973ef498a1d
|
542
|
* @param address Address of the register to write to.
|
SED9008 |
0:a973ef498a1d
|
543
|
* @param data The data to write into the register.
|
SED9008 |
0:a973ef498a1d
|
544
|
*/
|
SED9008 |
0:a973ef498a1d
|
545
|
void oneByteWrite(char address, char data);
|
SED9008 |
0:a973ef498a1d
|
546
|
|
SED9008 |
0:a973ef498a1d
|
547
|
/**
|
SED9008 |
0:a973ef498a1d
|
548
|
* Read Two consecutive bytes on the device.
|
SED9008 |
0:a973ef498a1d
|
549
|
*
|
SED9008 |
0:a973ef498a1d
|
550
|
* @param startAddress The address of the first register to read from.
|
SED9008 |
0:a973ef498a1d
|
551
|
* @param buffer Pointer to a buffer to store data read from the device.
|
SED9008 |
0:a973ef498a1d
|
552
|
*
|
SED9008 |
0:a973ef498a1d
|
553
|
*/
|
SED9008 |
0:a973ef498a1d
|
554
|
void TwoByteRead(char startAddress, char* buffer);
|
SED9008 |
0:a973ef498a1d
|
555
|
|
SED9008 |
0:a973ef498a1d
|
556
|
/**
|
SED9008 |
0:a973ef498a1d
|
557
|
* Write Two consecutive bytes on the device.
|
SED9008 |
0:a973ef498a1d
|
558
|
*
|
SED9008 |
0:a973ef498a1d
|
559
|
* @param startAddress The address of the first register to write to.
|
SED9008 |
0:a973ef498a1d
|
560
|
* @param buffer Pointer to a buffer which contains the data to write.
|
SED9008 |
0:a973ef498a1d
|
561
|
*
|
SED9008 |
0:a973ef498a1d
|
562
|
*/
|
SED9008 |
0:a973ef498a1d
|
563
|
void TwoByteWrite(char startAddress, char* buffer);
|
SED9008 |
0:a973ef498a1d
|
564
|
|
SED9008 |
0:a973ef498a1d
|
565
|
};
|
SED9008 |
0:a973ef498a1d
|
566
|
|
SED9008 |
0:a973ef498a1d
|
567
|
#endif /* ADXL345_I2C_H */
|