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