Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: sensors/MMA8451Q.h
- Revision:
- 0:f0de320e23ac
- Child:
- 7:aa858d789025
diff -r 000000000000 -r f0de320e23ac sensors/MMA8451Q.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sensors/MMA8451Q.h Fri Dec 01 06:16:31 2017 +0000
@@ -0,0 +1,43 @@
+/**
+ * MMA8451Q 3-Axis, 14-bit/8-bit Digital Accelerometer
+ */
+#ifndef _MMA8451Q_H_
+#define _MMA8451Q_H_
+
+#include "mbed.h"
+
+class MMA8451Q {
+public:
+ /**
+ * MMA8451Q constructor
+ *
+ * @param sda SDA pin
+ * @param sdl SCL pin
+ * @param addr 7bit addr of the I2C peripheral
+ */
+ MMA8451Q(I2C *i2c, int addr);
+
+ /**
+ * MMA8451Q destructor
+ */
+ ~MMA8451Q();
+
+ int getAllRawData(int16_t data[]) ;
+ int getAllData(float value[]) ;
+ int16_t getRawData(uint8_t addr) ;
+ int16_t getRawX(void) ;
+ int16_t getRawY(void) ;
+ int16_t getRawZ(void) ;
+
+ float getAccX(void) ;
+ float getAccY(void) ;
+ float getAccZ(void) ;
+
+private:
+ I2C *p_i2c;
+ int m_addr;
+ int readRegs(int addr, uint8_t * data, int len);
+ int writeRegs(uint8_t * data, int len);
+} ;
+
+#endif /* _MMA8451Q_H_ */
\ No newline at end of file