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.
Dependencies: BLE_API PinDetect mbed-src-bmd-200
MMA845x Class Reference
API abstraction for the MMA845x 3-axis accelerometer IC. More...
#include <MMA845x.h>
Public Types | |
| enum | MMA845x_SA0 { SA0_VSS = 0, SA0_VDD } |
Possible terminations for the ADDR pin. More... | |
| enum | MMA845x_WHO_AM_I { MMA8451 = 0x1a, MMA8452 = 0x2a, MMA8453 = 0x3a, MMA8652 = 0x4a } |
Device ID's that this class is compatible with. More... | |
| enum | MMA845x_REGISTER |
The device register map. More... | |
Public Member Functions | |
| MMA845x (I2C &i2c, PinName p_int1, PinName p_int2, MMA845x_SA0 const i2c_addr) | |
| Create the MMA845x object. | |
| uint16_t | getX (void) const |
| Get the X data. | |
| uint16_t | getY (void) const |
| Get the Y data. | |
| uint16_t | getZ (void) const |
| Get the Z data. | |
| MMA845x_DATA | getXYZ (void) const |
| Get the XYZ data structure. | |
| void | disable (void) |
| Put the MMA845x in the lowest possible power mode and suspend operation. | |
| void | writeRegister (uint8_t const reg, uint8_t const data) const |
| Write to a register (exposed for debugging reasons) Note: most writes are only valid in stop mode. | |
| uint8_t | readRegister (uint8_t const reg) const |
| Read from a register (exposed for debugging reasons) | |
| void | registerDump (void) const |
| print the register map and values to the console | |
| void | setIntMode (int) |
| Set display mode of interrupt. | |
Detailed Description
API abstraction for the MMA845x 3-axis accelerometer IC.
Definition at line 105 of file MMA845x.h.
Member Enumeration Documentation
| enum MMA845x_REGISTER |
| enum MMA845x_SA0 |
| enum MMA845x_WHO_AM_I |
Constructor & Destructor Documentation
| MMA845x | ( | I2C & | i2c, |
| PinName | p_int1, | ||
| PinName | p_int2, | ||
| MMA845x_SA0 const | i2c_addr | ||
| ) |
Member Function Documentation
| void disable | ( | void | ) |
Put the MMA845x in the lowest possible power mode and suspend operation.
Definition at line 29 of file MMA845x.cpp.
| uint16_t getX | ( | void | ) | const |
Get the X data.
- Returns:
- The last valid reading from the accelerometer
Definition at line 297 of file MMA845x.cpp.
| MMA845x_DATA getXYZ | ( | void | ) | const |
Get the XYZ data structure.
- Returns:
- The last valid reading from the accelerometer
Definition at line 312 of file MMA845x.cpp.
| uint16_t getY | ( | void | ) | const |
Get the Y data.
- Returns:
- The last valid reading from the accelerometer
Definition at line 302 of file MMA845x.cpp.
| uint16_t getZ | ( | void | ) | const |
Get the Z data.
- Returns:
- The last valid reading from the accelerometer
Definition at line 307 of file MMA845x.cpp.
| uint8_t readRegister | ( | uint8_t const | reg ) | const |
Read from a register (exposed for debugging reasons)
- Parameters:
-
reg - The register to read from
- Returns:
- The register contents
Definition at line 338 of file MMA845x.cpp.
| void registerDump | ( | void | ) | const |
print the register map and values to the console
Definition at line 366 of file MMA845x.cpp.
| void setIntMode | ( | int | intMode ) |
Set display mode of interrupt.
- Returns:
- The last valid reading from the accelerometer
Definition at line 42 of file MMA845x.cpp.
| void writeRegister | ( | uint8_t const | reg, |
| uint8_t const | data | ||
| ) | const |
Write to a register (exposed for debugging reasons) Note: most writes are only valid in stop mode.
- Parameters:
-
reg - The register to be written data - The data to be written
Definition at line 317 of file MMA845x.cpp.
Generated on Wed Jul 20 2022 08:27:04 by
1.7.2