Adafruit LSM303 Accelerometer Library
Public Member Functions | List of all members
Adafruit_LSM303_Accel_Unified Class Reference

Unified sensor driver for the accelerometer. More...

#include <Adafruit_LSM303_Accel.h>

Inheritance diagram for Adafruit_LSM303_Accel_Unified:

Public Member Functions

 Adafruit_LSM303_Accel_Unified (int32_t sensorID=-1)
 Instantiates a new Adafruit_LSM303 class. More...
 
bool begin (uint8_t i2c_addr=LSM303_ADDRESS_ACCEL, TwoWire *wire=&Wire)
 Sets up the hardware and initializes I2C. More...
 
bool getEvent (sensors_event_t *)
 Gets the most recent sensor event, Adafruit Unified Sensor format. More...
 
void getSensor (sensor_t *)
 Gets the sensor_t data.
 
void setRange (lsm303_accel_range_t)
 Sets the accelerometer's range. More...
 
lsm303_accel_range_t getRange (void)
 Gets the accelerometer's range. More...
 
lsm303_accel_mode_t getMode (void)
 Get the accelerometer's power mode. More...
 
void setMode (lsm303_accel_mode_t)
 Sets the accelerometer's power mode. More...
 
void interruptsActiveHigh (bool)
 Sets the polarity of the interrupt pins. More...
 

Detailed Description

Unified sensor driver for the accelerometer.

Constructor & Destructor Documentation

◆ Adafruit_LSM303_Accel_Unified()

Adafruit_LSM303_Accel_Unified::Adafruit_LSM303_Accel_Unified ( int32_t  sensorID = -1)

Instantiates a new Adafruit_LSM303 class.

Parameters
sensorIDan optional identifier for the sensor instance

Member Function Documentation

◆ begin()

bool Adafruit_LSM303_Accel_Unified::begin ( uint8_t  i2c_address = LSM303_ADDRESS_ACCEL,
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.

◆ getEvent()

bool Adafruit_LSM303_Accel_Unified::getEvent ( sensors_event_t *  event)

Gets the most recent sensor event, Adafruit Unified Sensor format.

Parameters
eventPointer to an Adafruit Unified sensor_event_t object that we'll fill in
Returns
True on successful read

◆ setRange()

void Adafruit_LSM303_Accel_Unified::setRange ( lsm303_accel_range_t  new_range)

Sets the accelerometer's range.

Parameters
new_rangean lsm303_accel_range_t representing the range of measurements in +/-G. The smaller the range, the more accurate.

◆ getRange()

lsm303_accel_range_t Adafruit_LSM303_Accel_Unified::getRange ( void  )

Gets the accelerometer's range.

Returns
The lsm303_accel_range_t representing the range of measurements in +/-G.

◆ getMode()

lsm303_accel_mode_t Adafruit_LSM303_Accel_Unified::getMode ( void  )

Get the accelerometer's power mode.

Returns
The lsm303_accel_mode_t representing the power mode.

◆ setMode()

void Adafruit_LSM303_Accel_Unified::setMode ( lsm303_accel_mode_t  new_mode)

Sets the accelerometer's power mode.

Parameters
new_modean lsm303_accel_mode_t representing the power mode. The mode effects the precision of the sensor's readings High resolution is 12-bit Normal mode is 10-bit Low power is 8-bit

◆ interruptsActiveHigh()

void Adafruit_LSM303_Accel_Unified::interruptsActiveHigh ( bool  active_high)

Sets the polarity of the interrupt pins.

Parameters
active_highSet to true for the INT pints to be active high, false for active low

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