Adafruit MSA301 Sensor Library
Public Member Functions | List of all members
Adafruit_MSA311 Class Reference

#include <Adafruit_MSA301.h>

Inheritance diagram for Adafruit_MSA311:
Adafruit_MSA301

Public Member Functions

 Adafruit_MSA311 (void)
 Instantiates a new MSA311 class.
 
bool begin (uint8_t i2c_addr=MSA311_I2CADDR_DEFAULT, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
- Public Member Functions inherited from Adafruit_MSA301
 Adafruit_MSA301 (void)
 Instantiates a new MSA301 class.
 
bool begin (uint8_t i2c_addr=MSA301_I2CADDR_DEFAULT, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
void setDataRate (msa301_dataRate_t dataRate)
 Sets the data rate for the MSA301 (controls power consumption) from 1 Hz to 1000Hz. More...
 
msa301_dataRate_t getDataRate (void)
 Gets the data rate for the MSA301 (controls power consumption) More...
 
void enableAxes (bool x, bool y, bool z)
 What axes of the accelerometer we want enabled for reading. More...
 
void setPowerMode (msa301_powermode_t mode)
 Set the power mode, MSA301_NORMALMODE, MSA301_LOWPOWERMODE or MSA301_SUSPENDMODE. More...
 
msa301_powermode_t getPowerMode (void)
 Get the power mode. More...
 
void setBandwidth (msa301_bandwidth_t bandwidth)
 Set the bandwidth, ranges from 1.95Hz to 500Hz. More...
 
msa301_bandwidth_t getBandwidth (void)
 Get the bandwidth. More...
 
void setRange (msa301_range_t range)
 Set the resolution range: +-2g, 4g, 8g, or 16g. More...
 
msa301_range_t getRange (void)
 Read the resolution range: +-2g, 4g, 8g, or 16g. More...
 
void setResolution (msa301_resolution_t resolution)
 Set the resolution - 8, 10, 12, or 14bits. More...
 
msa301_resolution_t getResolution (void)
 Read the resolution - 8, 10, 12, or 14bits. More...
 
void read ()
 Read the XYZ data from the accelerometer and store in the internal x, y and z (and x_g, y_g, z_g) member variables.
 
bool getEvent (sensors_event_t *event)
 Gets the most recent sensor event, Adafruit Unified Sensor format. More...
 
void getSensor (sensor_t *sensor)
 Gets the sensor_t device data, Adafruit Unified Sensor format. More...
 
void enableInterrupts (bool singletap=false, bool doubletap=false, bool activeX=false, bool activeY=false, bool activeZ=false, bool newData=false, bool freefall=false, bool orient=false)
 Set which interrupts are enabled. More...
 
void mapInterruptPin (bool singletap=false, bool doubletap=false, bool activity=false, bool newData=false, bool freefall=false, bool orient=false)
 Set which interrupts are mapped to the INT pin. More...
 
uint8_t getClick (void)
 Gets the most recent click detect status register value. More...
 
uint8_t getMotionInterruptStatus (void)
 Gets the most recent motion interrupt status register value. More...
 
uint8_t getDataInterruptStatus (void)
 Gets the most recent data interrupt status register value. More...
 
void setClick (bool tap_quiet, bool tap_shock, msa301_tapduration_t tapduration, uint8_t tapthresh)
 Set the click detection register thresholds. More...
 

Additional Inherited Members

- Public Attributes inherited from Adafruit_MSA301
int16_t x
 The last read X acceleration in raw units.
 
int16_t y
 The last read Y acceleration in raw units.
 
int16_t z
 The last read Z acceleration in raw units.
 
float x_g
 The last read X acceleration in 'g'.
 
float y_g
 The last read Y acceleration in 'g'.
 
float z_g
 The last read X acceleration in 'g'.
 

Detailed Description

Class for hardware interfacing with an MSA311 accelerometer

Member Function Documentation

◆ begin()

bool Adafruit_MSA311::begin ( uint8_t  i2c_address = MSA311_I2CADDR_DEFAULT,
TwoWire *  wire = &Wire 
)

Sets up the hardware and initializes I2C.

Parameters
i2c_addressThe I2C address to be used.
wireThe Wire object to be used for I2C connections.
Returns
True if initialization was successful, otherwise false.

The documentation for this class was generated from the following files: