The preloaded firmware shipped on the E-Dice.

Dependencies:   mbed

Committer:
Experiment626
Date:
Mon Sep 15 16:09:51 2014 +0000
Revision:
1:a30065092967
Parent:
0:7c263455b8b9
Added Apache 2 license text

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Experiment626 0:7c263455b8b9 1 /* Copyright (c) 2014 GHI Electronics, LLC
Experiment626 0:7c263455b8b9 2 *
Experiment626 0:7c263455b8b9 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Experiment626 0:7c263455b8b9 4 * and associated documentation files (the "Software"), to deal in the Software without
Experiment626 0:7c263455b8b9 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
Experiment626 0:7c263455b8b9 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Experiment626 0:7c263455b8b9 7 * Software is furnished to do so, subject to the following conditions:
Experiment626 0:7c263455b8b9 8 *
Experiment626 0:7c263455b8b9 9 * The above copyright notice and this permission notice shall be included in all copies or
Experiment626 0:7c263455b8b9 10 * substantial portions of the Software.
Experiment626 0:7c263455b8b9 11 *
Experiment626 0:7c263455b8b9 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Experiment626 0:7c263455b8b9 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Experiment626 0:7c263455b8b9 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Experiment626 0:7c263455b8b9 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Experiment626 0:7c263455b8b9 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Experiment626 0:7c263455b8b9 17 */
Experiment626 0:7c263455b8b9 18
Experiment626 0:7c263455b8b9 19 #ifndef MMA845X_H
Experiment626 0:7c263455b8b9 20 #define MMA845X_H
Experiment626 0:7c263455b8b9 21
Experiment626 0:7c263455b8b9 22 #include "mbed.h"
Experiment626 0:7c263455b8b9 23
Experiment626 0:7c263455b8b9 24 class MMA845x
Experiment626 0:7c263455b8b9 25 {
Experiment626 0:7c263455b8b9 26 public:
Experiment626 0:7c263455b8b9 27 MMA845x(PinName sda, PinName scl, int i2cAddress);
Experiment626 0:7c263455b8b9 28 ~MMA845x();
Experiment626 0:7c263455b8b9 29
Experiment626 0:7c263455b8b9 30 int16_t getX();
Experiment626 0:7c263455b8b9 31 int16_t getY();
Experiment626 0:7c263455b8b9 32 int16_t getZ();
Experiment626 0:7c263455b8b9 33 void GetXYZ(int& x, int& y, int& z);
Experiment626 0:7c263455b8b9 34
Experiment626 0:7c263455b8b9 35 struct AccelerationAxes
Experiment626 0:7c263455b8b9 36 {
Experiment626 0:7c263455b8b9 37 int x;
Experiment626 0:7c263455b8b9 38 int y;
Experiment626 0:7c263455b8b9 39 int z;
Experiment626 0:7c263455b8b9 40 };
Experiment626 0:7c263455b8b9 41
Experiment626 0:7c263455b8b9 42 private:
Experiment626 0:7c263455b8b9 43 I2C i2cBus;
Experiment626 0:7c263455b8b9 44 int i2cAddress;
Experiment626 0:7c263455b8b9 45 void readRegister(uint8_t registerAddress, uint8_t* data, int length);
Experiment626 0:7c263455b8b9 46 int16_t readAxisRegister(uint8_t axisRegisterAddress);
Experiment626 0:7c263455b8b9 47 //void writeRegister(uint8_t * data, int length);
Experiment626 0:7c263455b8b9 48 //int16_t getAccAxis(uint8_t address);
Experiment626 0:7c263455b8b9 49
Experiment626 0:7c263455b8b9 50 };
Experiment626 0:7c263455b8b9 51
Experiment626 0:7c263455b8b9 52 #endif
Experiment626 0:7c263455b8b9 53
Experiment626 0:7c263455b8b9 54