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.
Fork of MMA8452 by
Diff: MMA8452.h
- Revision:
- 1:584301c98fb8
- Parent:
- 0:df3b9e41edf3
--- a/MMA8452.h Sun Mar 08 15:31:02 2015 +0000
+++ b/MMA8452.h Mon May 11 03:36:44 2015 +0000
@@ -2,7 +2,7 @@
@file MMA8452.h
@brief Header file containing member functions and variables
-
+@see https://developer.mbed.org/users/eencae/code/MMA8452/
*/
#ifndef MMA8452_H
@@ -13,9 +13,24 @@
#define MMA8452_R_ADDRESS 0x3B
// Register Descriptions - p18 datasheet
#define OUT_X_MSB 0x01
+#define INT_SOURCE 0x0C
#define WHO_AM_I 0x0D
+#define XYZ_DATA_CFG 0x0E
+#define HP_FILTER_CUTOFF 0x0F
+#define TRANSIENT_CFG 0x1D
+#define TRANSIENT_SRC 0x1E
+#define TRANSIENT_THS 0x1F
+#define TRANSIENT_COUNT 0x20
+#define PULSE_CFG 0x21
+#define PULSE_SRC 0x22
+#define PULSE_THSY 0x24
+#define PULSE_TMLT 0x26
+#define PULSE_LTCY 0x27
#define CTRL_REG1 0x2A
-#define XYZ_DATA_CFG 0x0E
+#define CTRL_REG3 0x2C
+#define CTRL_REG4 0x2D
+#define CTRL_REG5 0x2E
+
typedef struct Acceleration Acceleration;
struct Acceleration {
@@ -82,6 +97,9 @@
* Powers up the accelerometer, sets 100 Hz update rate and ±4g scale
*/
void init();
+ void transient_counting();
+
+ Acceleration average();
/** Get values of acceleration
*
@@ -89,11 +107,11 @@
* @returns an Acceleration structure with x,y,z members (float)
*/
Acceleration readValues();
+ char readByteFromRegister(char reg); //change for public by Edson
private:
void sendByteToRegister(char byte,char reg);
- char readByteFromRegister(char reg);
void readBytesFromRegister(char reg,int numberOfBytes,char bytes[]);
void error();
