Class that stores state and functions for interacting with Adafruit_LIS331.
More...
#include <Adafruit_LIS331.h>
|
int16_t | x |
|
int16_t | y |
|
int16_t | z |
|
|
virtual void | _scaleValues (void) |
| Scale the acceleration measuremets from their raw value to milli-g depending on the current measurement range.
|
|
void | writeRange (uint8_t range) |
| Set the measurement range for the sensor. More...
|
|
uint8_t | readRange (void) |
| Get the measurement range. More...
|
|
|
float | x_g |
|
float | y_g |
|
float | z_g |
|
Adafruit_I2CDevice * | i2c_dev = NULL |
| Pointer to I2C bus interface.
|
|
Adafruit_SPIDevice * | spi_dev = NULL |
| Pointer to I2C bus interface.
|
|
Class that stores state and functions for interacting with Adafruit_LIS331.
◆ Adafruit_LIS331() [1/3]
Adafruit_LIS331::Adafruit_LIS331 |
( |
TwoWire * |
TheWire = &Wire | ) |
|
Instantiates a new LIS331 class in I2C.
- Parameters
-
TheWire | optional wire object |
◆ Adafruit_LIS331() [2/3]
Adafruit_LIS331::Adafruit_LIS331 |
( |
int8_t |
cspin, |
|
|
SPIClass * |
theSPI = &SPI |
|
) |
| |
Instantiates a new LIS331 class using hardware SPI.
- Parameters
-
cspin | number of CSPIN (Chip Select) |
*theSPI | optional parameter contains spi object |
◆ Adafruit_LIS331() [3/3]
Adafruit_LIS331::Adafruit_LIS331 |
( |
int8_t |
cspin, |
|
|
int8_t |
mosipin, |
|
|
int8_t |
misopin, |
|
|
int8_t |
sckpin |
|
) |
| |
Instantiates a new LIS331 class using software SPI.
- Parameters
-
cspin | number of CSPIN (Chip Select) |
mosipin | number of pin used for MOSI (Master Out Slave In)) |
misopin | number of pin used for MISO (Master In Slave Out) |
sckpin | number of pin used for CLK (clock pin) |
◆ getDeviceID()
uint8_t Adafruit_LIS331::getDeviceID |
( |
void |
| ) |
|
Get Device ID from LIS331_REG_WHOAMI.
- Returns
- WHO AM I value
◆ configIntDataReady()
bool Adafruit_LIS331::configIntDataReady |
( |
uint8_t |
irqnum = 1 , |
|
|
bool |
activelow = true , |
|
|
bool |
opendrain = true |
|
) |
| |
Setup the INT1 or INT2 pin to trigger when new data is ready.
- Parameters
-
irqnum | The interrupt number/pin to configure |
activelow | The polarity of the pin. true: active low false: active high |
opendrain | The pinmode for the given interrupt pin. true: open drain. Connects to GND when activated false: push-pull: connects to VCC when activated |
- Returns
- true
-
false
◆ getEvent()
bool Adafruit_LIS331::getEvent |
( |
sensors_event_t * |
event | ) |
|
Gets the most recent sensor event.
- Parameters
-
*event | sensor event that we want to read |
- Returns
- true if successful
◆ getSensor()
void Adafruit_LIS331::getSensor |
( |
sensor_t * |
sensor | ) |
|
Gets the sensor_t data.
- Parameters
-
*sensor | sensor that we want to write data into |
◆ enableHighPassFilter()
◆ setHPFReference()
void Adafruit_LIS331::setHPFReference |
( |
int8_t |
reference | ) |
|
Set the reference value to offset measurements when using the High-pass filter.
- Parameters
-
reference | The offset amount. The conversion of reference to milli-g depends on the selected range: |
- Full scale Reference mode LSB value (mg) 6g/100g ~16mg 12g/200g ~31mg 24g/400g ~63mg
◆ getHPFReference()
int8_t Adafruit_LIS331::getHPFReference |
( |
void |
| ) |
|
Gets the current high-pass filter reference/offset.
- Returns
- int8_t The current reference value. See
enableHighPassFilter
and setHPFReference
for more information.
◆ HPFReset()
void Adafruit_LIS331::HPFReset |
( |
void |
| ) |
|
Zero the measurement offsets while the high-pass filter is enabled when not using a reference.
See enableHighPassFilter
and setHPFReference
for more information.
◆ setLPFCutoff()
Set the Low Pass Filter cutoff frequency. Useful for removing high frequency noise while sensing orientation using the acceleration from gravity.
Will not work when sensor is in Normal mode because the LPF cutoff bits are used to set the ODR while in Normal mode.
- Parameters
-
cutoff | The frequency above which signals will be ignored. |
- Returns
- true: success false: cuttoff frequency was not set because the
◆ setDataRate()
Sets the data rate for the LIS331 (affects power consumption)
- Parameters
-
data_rate | The new data rate to set. |
◆ getDataRate()
Gets the data rate for the LIS331 (affects power consumption)
- Returns
- Returns Data Rate value
◆ getMode() [1/2]
Return the current power mode from the current data rate.
- Returns
- lis331_mode_t The currently set power mode
◆ getMode() [2/2]
Return the current power mode from a given data rate value.
- Parameters
-
data_rate | The lis331_data_rate_t to return the lis331_mode_t for |
- Returns
- lis331_mode_t
◆ writeRange()
void Adafruit_LIS331::writeRange |
( |
uint8_t |
range | ) |
|
|
protected |
Set the measurement range for the sensor.
- Parameters
-
range | The measurement range to set |
◆ readRange()
uint8_t Adafruit_LIS331::readRange |
( |
void |
| ) |
|
|
protected |
Get the measurement range.
- Returns
- uint8_t The measurement range
int16_t Adafruit_LIS331::x |
int16_t Adafruit_LIS331::y |
int16_t Adafruit_LIS331::z |
◆ x_g
float Adafruit_LIS331::x_g |
|
protected |
x_g axis value (calculated by selected range)
◆ y_g
float Adafruit_LIS331::y_g |
|
protected |
y_g axis value (calculated by selected range)
◆ z_g
float Adafruit_LIS331::z_g |
|
protected |
z_g axis value (calculated by selected scale)
The documentation for this class was generated from the following files: