Class that stores state and functions for interacting with Adafruit_LIS3DH.
More...
#include <Adafruit_CPlay_LIS3DH.h>
|
| Adafruit_CPlay_LIS3DH (TwoWire *Wi=&Wire) |
| Instantiates a new LIS3DH class in I2C. More...
|
|
| Adafruit_CPlay_LIS3DH (int8_t cspin, SPIClass *theSPI=&SPI) |
| Instantiates a new LIS3DH class using hardware SPI. More...
|
|
| Adafruit_CPlay_LIS3DH (int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) |
| Instantiates a new LIS3DH class using software SPI. More...
|
|
bool | begin (uint8_t addr=LIS3DH_DEFAULT_ADDRESS, uint8_t nWAI=0x33) |
| Setups the HW (reads coefficients values, etc.) More...
|
|
uint8_t | getDeviceID () |
| Get Device ID from LIS3DH_REG_WHOAMI. More...
|
|
bool | haveNewData () |
| Check to see if new data available. More...
|
|
void | read () |
| Reads x y z values at once.
|
|
int16_t | readADC (uint8_t a) |
| Read the auxilary ADC. More...
|
|
void | setRange (lis3dh_range_t range) |
| Sets the g range for the accelerometer. More...
|
|
lis3dh_range_t | getRange (void) |
| Gets the g range for the accelerometer. More...
|
|
void | setDataRate (lis3dh_dataRate_t dataRate) |
| Sets the data rate for the LIS3DH (controls power consumption) More...
|
|
lis3dh_dataRate_t | getDataRate (void) |
| Gets the data rate for the LIS3DH (controls power consumption) More...
|
|
bool | getEvent (sensors_event_t *event) |
| Gets the most recent sensor event. More...
|
|
void | getSensor (sensor_t *sensor) |
| Gets the sensor_t data. More...
|
|
void | setClick (uint8_t c, uint8_t clickthresh, uint8_t timelimit=10, uint8_t timelatency=20, uint8_t timewindow=255) |
| Set INT to output for single or double click. More...
|
|
uint8_t | getClick (void) |
| Get uint8_t for single or double click. More...
|
|
virtual void | enableAutoRange (bool enabled) |
| enable or disable auto-ranging for the sensor More...
|
|
Class that stores state and functions for interacting with Adafruit_LIS3DH.
◆ Adafruit_CPlay_LIS3DH() [1/3]
Adafruit_CPlay_LIS3DH::Adafruit_CPlay_LIS3DH |
( |
TwoWire * |
Wi = &Wire | ) |
|
Instantiates a new LIS3DH class in I2C.
- Parameters
-
◆ Adafruit_CPlay_LIS3DH() [2/3]
Adafruit_CPlay_LIS3DH::Adafruit_CPlay_LIS3DH |
( |
int8_t |
cspin, |
|
|
SPIClass * |
theSPI = &SPI |
|
) |
| |
Instantiates a new LIS3DH class using hardware SPI.
- Parameters
-
cspin | number of CSPIN (Chip Select) |
*theSPI | optional parameter contains spi object |
◆ Adafruit_CPlay_LIS3DH() [3/3]
Adafruit_CPlay_LIS3DH::Adafruit_CPlay_LIS3DH |
( |
int8_t |
cspin, |
|
|
int8_t |
mosipin, |
|
|
int8_t |
misopin, |
|
|
int8_t |
sckpin |
|
) |
| |
Instantiates a new LIS3DH 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) |
◆ begin()
Setups the HW (reads coefficients values, etc.)
- Parameters
-
i2caddr | i2c address (optional, fallback to default) |
nWAI | Who Am I register value - defaults to 0x33 (LIS3DH) |
- Returns
- true if successful
◆ getDeviceID()
uint8_t Adafruit_CPlay_LIS3DH::getDeviceID |
( |
| ) |
|
Get Device ID from LIS3DH_REG_WHOAMI.
- Returns
- WHO AM I value
◆ haveNewData()
bool Adafruit_CPlay_LIS3DH::haveNewData |
( |
| ) |
|
Check to see if new data available.
- Returns
- true if there is new data available, false otherwise
◆ readADC()
int16_t Adafruit_CPlay_LIS3DH::readADC |
( |
uint8_t |
adc | ) |
|
Read the auxilary ADC.
- Parameters
-
adc | adc index. possible values (1, 2, 3). |
- Returns
- auxilary ADC value
◆ setRange()
Sets the g range for the accelerometer.
- Parameters
-
◆ getRange()
Gets the g range for the accelerometer.
- Returns
- Returns g range value
◆ setDataRate()
Sets the data rate for the LIS3DH (controls power consumption)
- Parameters
-
◆ getDataRate()
Gets the data rate for the LIS3DH (controls power consumption)
- Returns
- Returns Data Rate value
◆ getEvent()
Gets the most recent sensor event.
- Parameters
-
*event | sensor event that we want to read |
- Returns
- true if successful
Implements Adafruit_Sensor.
◆ getSensor()
void Adafruit_CPlay_LIS3DH::getSensor |
( |
sensor_t * |
sensor | ) |
|
|
virtual |
◆ setClick()
void Adafruit_CPlay_LIS3DH::setClick |
( |
uint8_t |
c, |
|
|
uint8_t |
clickthresh, |
|
|
uint8_t |
timelimit = 10 , |
|
|
uint8_t |
timelatency = 20 , |
|
|
uint8_t |
timewindow = 255 |
|
) |
| |
Set INT to output for single or double click.
- Parameters
-
c | 0 = turn off I1_CLICK 1 = turn on all axes & singletap 2 = turn on all axes & doubletap |
clickthresh | CLICK threshold value |
timelimit | sets time limit (default 10) |
timelatency | sets time latency (default 20) |
timewindow | sets time window (default 255) |
◆ getClick()
uint8_t Adafruit_CPlay_LIS3DH::getClick |
( |
void |
| ) |
|
Get uint8_t for single or double click.
- Returns
- register LIS3DH_REG_CLICKSRC
◆ spixfer()
uint8_t Adafruit_CPlay_LIS3DH::spixfer |
( |
uint8_t |
x = 0xFF | ) |
|
|
protected |
Low level SPI.
- Parameters
-
x | value that will be written throught SPI |
- Returns
- reply
◆ writeRegister8()
void Adafruit_CPlay_LIS3DH::writeRegister8 |
( |
uint8_t |
reg, |
|
|
uint8_t |
value |
|
) |
| |
|
protected |
Writes 8-bits to the specified destination register.
- Parameters
-
reg | register address |
value | value that will be written into selected register |
◆ readRegister8()
uint8_t Adafruit_CPlay_LIS3DH::readRegister8 |
( |
uint8_t |
reg | ) |
|
|
protected |
Reads 8-bits from the specified register.
- Parameters
-
- Returns
- read value
int16_t Adafruit_CPlay_LIS3DH::x |
int16_t Adafruit_CPlay_LIS3DH::y |
int16_t Adafruit_CPlay_LIS3DH::z |
◆ x_g
float Adafruit_CPlay_LIS3DH::x_g |
x_g axis value (calculated by selected range)
◆ y_g
float Adafruit_CPlay_LIS3DH::y_g |
y_g axis value (calculated by selected range)
◆ z_g
float Adafruit_CPlay_LIS3DH::z_g |
z_g axis value (calculated by selected scale)
The documentation for this class was generated from the following files: