Adafruit MMA8451 compount.
More...
#include <Adafruit_MMA8451.h>
|
|
int16_t | x |
|
int16_t | y |
|
int16_t | z |
|
|
float | x_g |
|
float | y_g |
|
float | z_g |
|
Adafruit MMA8451 compount.
◆ Adafruit_MMA8451()
Adafruit_MMA8451::Adafruit_MMA8451 |
( |
int32_t |
id = -1 | ) |
|
Adafruit MMA8451 object.
Instantiates a new MMA8451 class in I2C mode.
- Parameters
-
◆ begin()
Connects with the MMA8451.
Setups the HW (reads coefficients values, etc.)
- Parameters
-
addr | Address of the MMA8451 |
theWire | TwoWire bus to use |
- Returns
- Returns a boolean
◆ setRange()
Sets the g range for the accelerometer.
- Parameters
-
range | Desired range of sensor |
◆ getRange()
Gets the g range for the accelerometer.
- Returns
- Range of sensor, either 0b10, 0b01, or 0b00, 8G, 4G, and 2G respectively
◆ setDataRate()
Sets the data rate for the MMA8451 (controls power consumption)
- Parameters
-
dataRate | Data rate of the sensor |
◆ getDataRate()
Gets the data rate for the MMA8451 (controls power consumption)
- Returns
- Data rate, binary value
◆ getEvent()
bool Adafruit_MMA8451::getEvent |
( |
sensors_event_t * |
event | ) |
|
Gets the most recent sensor event.
- Parameters
-
- Returns
- Returns a boolean
◆ getSensor()
void Adafruit_MMA8451::getSensor |
( |
sensor_t * |
sensor | ) |
|
Gets the sensor_t data.
- Parameters
-
◆ getOrientation()
uint8_t Adafruit_MMA8451::getOrientation |
( |
void |
| ) |
|
Read the orientation: Portrait/Landscape + Up/Down/Left/Right + Front/Back.
- Returns
- 3 axis tuple
◆ writeRegister8()
void Adafruit_MMA8451::writeRegister8 |
( |
uint8_t |
reg, |
|
|
uint8_t |
value |
|
) |
| |
Writes to 8 bit register.
Writes 8-bits to the specified destination register.
- Parameters
-
reg | Register to write to |
value | Value to write |
◆ readRegister8()
uint8_t Adafruit_MMA8451::readRegister8 |
( |
uint8_t |
reg | ) |
|
|
protected |
Reads from 8 bit register.
Reads 8-bits from the specified register.
- Parameters
-
- Returns
- Returns the contents of Register8
The documentation for this class was generated from the following files: