FXLS89xx_Arduino 1.0.0
This library enables the developer to evaluate NXP FXLS89xx with Arduino.
|
Class to evaluate FXLS89xx. More...
#include <FXLS89xx_Arduino.h>
Public Member Functions | |
void | read_XYZ (float *pOutBuffer) |
Read XYZ accelerometer value with unit milligravity. | |
void | run (bool sdcd=false) |
Start conversion based on the settings of sensor_range, wake_pm, sleep_pm, wake_odr, sleep_odr. | |
void | sdcd (ref_updm ref, XYZ xyz, float upper_threshold, float lower_threshold, uint8_t debounce=0) |
Set SDCD function. | |
void | enable_sleep (uint16_t asleep=0) |
Sleep mode enable. | |
void | EXT_TRIG_init (bool pinconfig=true) |
Initialize the pin configurations and register for EXT_TRIG mode. | |
void | EXT_TRIG_Trigger () |
Trigger the pin to start one-time conversion. Make sure once EXT_TRIG init is done first. | |
uint8_t | init (bool pinconfig=true) |
Initialize the device with reset. | |
FXLS89xx_Arduino (uint8_t i2c_address=FXLS896x_DEVICE_ADDRESS_SA0_0) | |
FXLS89xx_Arduino (TwoWire &wire, uint8_t i2c_address=FXLS896x_DEVICE_ADDRESS_SA0_0) | |
virtual | ~FXLS89xx_Arduino () |
virtual float | read (void) |
bool | ping (void) |
int | reg_w (uint8_t reg_adr, uint8_t *data, uint16_t size) |
int | reg_w (uint8_t reg_adr, uint8_t data) |
int | reg_r (uint8_t reg_adr, uint8_t *data, uint16_t size) |
uint8_t | reg_r (uint8_t reg_adr) |
void | write_r8 (uint8_t reg, uint8_t val) |
void | write_r16 (uint8_t reg, uint16_t val) |
uint8_t | read_r8 (uint8_t reg) |
uint16_t | read_r16 (uint8_t reg) |
void | bit_op8 (uint8_t reg, uint8_t mask, uint8_t value) |
void | bit_op16 (uint8_t reg, uint16_t mask, uint16_t value) |
Public Attributes | |
SensorRange | sensor_range = FXLS89xx_RANGE_2G |
Sensor range selected through 2g,4g,8g,16g. | |
PowerMode | wake_pm = FXLS89xx_LPM |
Power Mode in WAKE state selected from LPM, HPM, FPM. | |
PowerMode | sleep_pm = FXLS89xx_LPM |
Power Mode in SLEEP state selected from LPM, HPM, FPM. | |
odr_freq | wake_odr = FXLS89xx_ODR_100HZ |
ODR in WAKE state. | |
odr_freq | sleep_odr = FXLS89xx_ODR_12_5HZ |
ODR in SLEEP state. | |
bool | sdcd_wt =false |
true when interruption happens inside thresholds, false when outside thresholds | |
Class to evaluate FXLS89xx.
Definition at line 65 of file FXLS89xx_Arduino.h.
FXLS89xx_Arduino::FXLS89xx_Arduino | ( | uint8_t | i2c_address = FXLS896x_DEVICE_ADDRESS_SA0_0 | ) |
Create a FXLS89xx_Arduino instance
i2c_address | If the device is configured with SA0=H, put FXLS896x_DEVICE_ADDRESS_SA0_1. |
Definition at line 14 of file FXLS89xx_Arduino.cpp.
FXLS89xx_Arduino::FXLS89xx_Arduino | ( | TwoWire & | wire, |
uint8_t | i2c_address = FXLS896x_DEVICE_ADDRESS_SA0_0 |
||
) |
Create a FXLS89xx_Arduino instance
wire | TwoWire instance |
i2c_address | If the device is configured with SA0=H, put FXLS896x_DEVICE_ADDRESS_SA0_1. |
Definition at line 15 of file FXLS89xx_Arduino.cpp.
|
virtual |
Destructor of FXLS89xx_Arduino
Definition at line 16 of file FXLS89xx_Arduino.cpp.
void FXLS89xx_Arduino::bit_op8 | ( | uint8_t | reg, |
uint8_t | mask, | ||
uint8_t | value | ||
) |
Register overwriting with bit-mask
Register can be updated by bit level
reg | register index/address/pointer |
mask | bit-mask to protect overwriting |
value | value to overwrite |
Referenced by enable_sleep(), EXT_TRIG_init(), run(), and sdcd().
void FXLS89xx_Arduino::enable_sleep | ( | uint16_t | asleep = 0 | ) |
Sleep mode enable.
asleep | Asleep count threshold: The device goes to SLEEP state when count reaches to this threshold value. The count increments when no interruption occurs. |
Definition at line 67 of file FXLS89xx_Arduino.cpp.
void FXLS89xx_Arduino::EXT_TRIG_init | ( | bool | pinconfig = true | ) |
Initialize the pin configurations and register for EXT_TRIG mode.
pinconfig | If you wouldn't like to config the pins by this function, put false in this parameter. This parameter can be skipped. |
Definition at line 85 of file FXLS89xx_Arduino.cpp.
void FXLS89xx_Arduino::EXT_TRIG_Trigger | ( | ) |
Trigger the pin to start one-time conversion. Make sure once EXT_TRIG init is done first.
Definition at line 94 of file FXLS89xx_Arduino.cpp.
uint8_t FXLS89xx_Arduino::init | ( | bool | pinconfig = true | ) |
Initialize the device with reset.
pinconfig | If you wouldn't like to config the pins by this function, put false in this parameter. This parameter can be skipped. |
Definition at line 100 of file FXLS89xx_Arduino.cpp.
bool FXLS89xx_Arduino::ping | ( | void | ) |
Ping the device
|
virtual |
Get temperature value in degree Celsius [°C]
This method simply calls "temp()" method
uint16_t FXLS89xx_Arduino::read_r16 | ( | uint8_t | reg | ) |
Register read, 16 bit
This 16 bit access may ot be common but it's useful for sensor devices
reg | register index/address/pointer |
uint8_t FXLS89xx_Arduino::read_r8 | ( | uint8_t | reg | ) |
Register read, 8 bit
reg | register index/address/pointer |
Referenced by init().
void FXLS89xx_Arduino::read_XYZ | ( | float * | pOutBuffer | ) |
Read XYZ accelerometer value with unit milligravity.
pOutBuffer | Pointer to array to store register contents |
Definition at line 75 of file FXLS89xx_Arduino.cpp.
uint8_t FXLS89xx_Arduino::reg_r | ( | uint8_t | reg_adr | ) |
Single register read
reg | register index/address/pointer |
int FXLS89xx_Arduino::reg_r | ( | uint8_t | reg_adr, |
uint8_t * | data, | ||
uint16_t | size | ||
) |
Multiple register read
reg | register index/address/pointer |
data | pointer to data buffer |
size | data size |
Referenced by read_XYZ().
int FXLS89xx_Arduino::reg_w | ( | uint8_t | reg_adr, |
uint8_t * | data, | ||
uint16_t | size | ||
) |
Multiple register write
reg | register index/address/pointer |
data | pointer to data buffer |
size | data size |
Referenced by enable_sleep(), and sdcd().
int FXLS89xx_Arduino::reg_w | ( | uint8_t | reg_adr, |
uint8_t | data | ||
) |
Single register write
reg | register index/address/pointer |
data | pointer to data buffer |
size | data size |
void FXLS89xx_Arduino::run | ( | bool | sdcd = false | ) |
Start conversion based on the settings of sensor_range, wake_pm, sleep_pm, wake_odr, sleep_odr.
sdcd | If you set SDCD mode (using SLEEP states), then put true here. |
Definition at line 22 of file FXLS89xx_Arduino.cpp.
void FXLS89xx_Arduino::sdcd | ( | ref_updm | ref, |
XYZ | xyz, | ||
float | upper_threshold, | ||
float | lower_threshold, | ||
uint8_t | debounce = 0 |
||
) |
Set SDCD function.
ref_updm | |
upper_threshold | Upper threshold by milligravity |
lower_threshold | Lower threshold by milligravity |
debounce | Debounce counter threshold value set to both upper and lower threshold |
Definition at line 33 of file FXLS89xx_Arduino.cpp.
Referenced by run().
void FXLS89xx_Arduino::write_r16 | ( | uint8_t | reg, |
uint16_t | val | ||
) |
Register write, 16 bit
This 16 bit access may ot be common but it's useful for sensor devices
reg | register index/address/pointer |
val | data value |
void FXLS89xx_Arduino::write_r8 | ( | uint8_t | reg, |
uint8_t | val | ||
) |
bool FXLS89xx_Arduino::sdcd_wt =false |
true when interruption happens inside thresholds, false when outside thresholds
Definition at line 72 of file FXLS89xx_Arduino.h.
Referenced by enable_sleep(), and sdcd().
SensorRange FXLS89xx_Arduino::sensor_range = FXLS89xx_RANGE_2G |
Sensor range selected through 2g,4g,8g,16g.
Definition at line 67 of file FXLS89xx_Arduino.h.
Referenced by read_XYZ(), run(), and sdcd().
odr_freq FXLS89xx_Arduino::sleep_odr = FXLS89xx_ODR_12_5HZ |
PowerMode FXLS89xx_Arduino::sleep_pm = FXLS89xx_LPM |
Power Mode in SLEEP state selected from LPM, HPM, FPM.
Definition at line 69 of file FXLS89xx_Arduino.h.
Referenced by run().
odr_freq FXLS89xx_Arduino::wake_odr = FXLS89xx_ODR_100HZ |
PowerMode FXLS89xx_Arduino::wake_pm = FXLS89xx_LPM |
Power Mode in WAKE state selected from LPM, HPM, FPM.
Definition at line 68 of file FXLS89xx_Arduino.h.
Referenced by run().