no-OS
|
Header file of ADXL345 Driver. More...
Go to the source code of this file.
Classes | |
struct | adxl345_dev |
ADXL345 Device structure. More... | |
struct | adxl345_init_param |
Structure holding the parameters for ADXL345 device initialization. More... | |
Macros | |
#define | ADXL345_SPI_COMM 0 |
#define | ADXL345_I2C_COMM 1 |
#define | ADXL345_ADDRESS 0x1D |
#define | ADXL345_SPI_READ (1 << 7) |
#define | ADXL345_SPI_WRITE (0 << 7) |
#define | ADXL345_SPI_MB (1 << 6) |
#define | ADXL345_DEVID 0x00 |
#define | ADXL345_THRESH_TAP 0x1D |
#define | ADXL345_OFSX 0x1E |
#define | ADXL345_OFSY 0x1F |
#define | ADXL345_OFSZ 0x20 |
#define | ADXL345_DUR 0x21 |
#define | ADXL345_LATENT 0x22 |
#define | ADXL345_WINDOW 0x23 |
#define | ADXL345_THRESH_ACT 0x24 |
#define | ADXL345_THRESH_INACT 0x25 |
#define | ADXL345_TIME_INACT 0x26 |
#define | ADXL345_ACT_INACT_CTL 0x27 |
#define | ADXL345_THRESH_FF 0x28 |
#define | ADXL345_TIME_FF 0x29 |
#define | ADXL345_TAP_AXES 0x2A |
#define | ADXL345_ACT_TAP_STATUS 0x2B |
#define | ADXL345_BW_RATE 0x2C |
#define | ADXL345_POWER_CTL 0x2D |
#define | ADXL345_INT_ENABLE 0x2E |
#define | ADXL345_INT_MAP 0x2F |
#define | ADXL345_INT_SOURCE 0x30 |
#define | ADXL345_DATA_FORMAT 0x31 |
#define | ADXL345_DATAX0 0x32 |
#define | ADXL345_DATAX1 0x33 |
#define | ADXL345_DATAY0 0x34 |
#define | ADXL345_DATAY1 0x35 |
#define | ADXL345_DATAZ0 0x36 |
#define | ADXL345_DATAZ1 0x37 |
#define | ADXL345_FIFO_CTL 0x38 |
#define | ADXL345_FIFO_STATUS 0x39 |
#define | ADXL345_TAP_SIGN 0x3A |
#define | ADXL345_ORIENT_CONF 0x3B |
#define | ADXL345_ORIENT 0x3C |
#define | ADXL345_ACT_ACDC (1 << 7) |
#define | ADXL345_ACT_X_EN (1 << 6) |
#define | ADXL345_ACT_Y_EN (1 << 5) |
#define | ADXL345_ACT_Z_EN (1 << 4) |
#define | ADXL345_INACT_ACDC (1 << 3) |
#define | ADXL345_INACT_X_EN (1 << 2) |
#define | ADXL345_INACT_Y_EN (1 << 1) |
#define | ADXL345_INACT_Z_EN (1 << 0) |
#define | ADXL345_SUPPRESS (1 << 3) |
#define | ADXL345_TAP_X_EN (1 << 2) |
#define | ADXL345_TAP_Y_EN (1 << 1) |
#define | ADXL345_TAP_Z_EN (1 << 0) |
#define | ADXL345_ACT_X_SRC (1 << 6) |
#define | ADXL345_ACT_Y_SRC (1 << 5) |
#define | ADXL345_ACT_Z_SRC (1 << 4) |
#define | ADXL345_ASLEEP (1 << 3) |
#define | ADXL345_TAP_X_SRC (1 << 2) |
#define | ADXL345_TAP_Y_SRC (1 << 1) |
#define | ADXL345_TAP_Z_SRC (1 << 0) |
#define | ADXL345_LOW_POWER (1 << 4) |
#define | ADXL345_RATE(x) ((x) & 0xF) |
#define | ADXL345_PCTL_LINK (1 << 5) |
#define | ADXL345_PCTL_AUTO_SLEEP (1 << 4) |
#define | ADXL345_PCTL_MEASURE (1 << 3) |
#define | ADXL345_PCTL_SLEEP (1 << 2) |
#define | ADXL345_PCTL_WAKEUP(x) ((x) & 0x3) |
#define | ADXL345_DATA_READY (1 << 7) |
#define | ADXL345_SINGLE_TAP (1 << 6) |
#define | ADXL345_DOUBLE_TAP (1 << 5) |
#define | ADXL345_ACTIVITY (1 << 4) |
#define | ADXL345_INACTIVITY (1 << 3) |
#define | ADXL345_FREE_FALL (1 << 2) |
#define | ADXL345_WATERMARK (1 << 1) |
#define | ADXL345_OVERRUN (1 << 0) |
#define | ADXL345_ORIENTATION (1 << 0) |
#define | ADXL345_SELF_TEST (1 << 7) |
#define | ADXL345_SPI (1 << 6) |
#define | ADXL345_INT_INVERT (1 << 5) |
#define | ADXL345_FULL_RES (1 << 3) |
#define | ADXL345_JUSTIFY (1 << 2) |
#define | ADXL345_RANGE(x) ((x) & 0x3) |
#define | ADXL345_RANGE_PM_2G 0 |
#define | ADXL345_RANGE_PM_4G 1 |
#define | ADXL345_RANGE_PM_8G 2 |
#define | ADXL345_RANGE_PM_16G 3 |
#define | ADXL345_FIFO_MODE(x) (((x) & 0x3) << 6) |
#define | ADXL345_TRIGGER (1 << 5) |
#define | ADXL345_SAMPLES(x) ((x) & 0x1F) |
#define | ADXL345_FIFO_BYPASS 0 |
#define | ADXL345_FIFO_FIFO 1 |
#define | ADXL345_FIFO_STREAM 2 |
#define | ADXL345_FIFO_TRIGGER 3 |
#define | ADXL345_FIFO_TRIG (1 << 7) |
#define | ADXL345_ENTRIES(x) ((x) & 0x3F) |
#define | ADXL345_INT_ORIENT(x) (((x) & 0x1) << 7) |
#define | ADXL345_DEAD_ZONE(x) (((x) & 0x7) << 4) |
#define | ADXL345_INT_3D(x) (((x) & 0x1) << 3) |
#define | ADXL345_DIVISOR(x) ((x) & 7) |
#define | ADXL345_ID 0xE5 |
#define | ADXL346_ID 0xE6 |
#define | ADXL345_SCALE_FACTOR 0.0039 |
Enumerations | |
enum | adxl345_type { ID_ADXL345, ID_ADXL346 } |
ADXL345 Supported devices. More... | |
enum | adxl345_dead_zone_angle { DEGREES_5_1, DEGREES_10_2, DEGREES_15_2, DEGREES_20_4, DEGREES_25_5, DEGREES_30_8, DEGREES_36_1, DEGREES_41_4 } |
ADXL346 Dead zone angle encoding. More... | |
enum | adxl345_divisor_bandwidth { ODR_DIV_9, ODR_DIV_22, ODR_DIV_50, ODR_DIV_100, ODR_DIV_200, ODR_DIV_400, ODR_DIV_800, ODR_DIV_1600 } |
ADXL346 Divisor bandwidth encoding. More... | |
Functions | |
uint8_t | adxl345_get_register_value (struct adxl345_dev *dev, uint8_t register_address) |
Reads the value of a register. More... | |
void | adxl345_set_register_value (struct adxl345_dev *dev, uint8_t register_address, uint8_t register_value) |
Writes data into a register. More... | |
int32_t | adxl345_init (struct adxl345_dev **device, struct adxl345_init_param init_param) |
Initializes the communication peripheral and checks if the ADXL345 part is present. More... | |
int32_t | adxl345_remove (struct adxl345_dev *dev) |
Free the resources allocated by adxl345_init(). More... | |
void | adxl345_set_power_mode (struct adxl345_dev *dev, uint8_t pwr_mode) |
Places the device into standby/measure mode. More... | |
void | adxl345_get_xyz (struct adxl345_dev *dev, int16_t *x, int16_t *y, int16_t *z) |
Reads the raw output data of each axis. More... | |
void | adxl345_get_g_xyz (struct adxl345_dev *dev, float *x, float *y, float *z) |
Reads the raw output data of each axis and converts it to g. More... | |
void | adxl345_set_tap_detection (struct adxl345_dev *dev, uint8_t tap_type, uint8_t tap_axes, uint8_t tap_dur, uint8_t tap_latent, uint8_t tap_window, uint8_t tap_thresh, uint8_t tap_int) |
Enables/disables the tap detection. More... | |
void | adxl345_set_activity_detection (struct adxl345_dev *dev, uint8_t act_on_off, uint8_t act_axes, uint8_t act_ac_dc, uint8_t act_thresh, uint8_t act_int) |
Enables/disables the activity detection. More... | |
void | adxl345_set_inactivity_detection (struct adxl345_dev *dev, uint8_t inact_on_off, uint8_t inact_axes, uint8_t inact_ac_dc, uint8_t inact_thresh, uint8_t inact_time, uint8_t inact_int) |
Enables/disables the inactivity detection. More... | |
void | adxl345_set_free_fall_detection (struct adxl345_dev *dev, uint8_t ff_on_off, uint8_t ff_thresh, uint8_t ff_time, uint8_t ff_int) |
Enables/disables the free-fall detection. More... | |
void | adxl345_set_orientation_detection (struct adxl345_dev *dev, uint8_t orient_int, uint8_t orient_on_off, uint8_t int_3d, enum adxl345_dead_zone_angle dead_zone, enum adxl345_divisor_bandwidth divisor) |
Enables/disables the orientation detection (only for adxl346). More... | |
void | adxl345_set_offset (struct adxl345_dev *dev, uint8_t x_offset, uint8_t y_offset, uint8_t z_offset) |
Sets an offset value for each axis (Offset Calibration). More... | |
void | adxl345_set_range_resolution (struct adxl345_dev *dev, uint8_t g_range, uint8_t full_res) |
Selects the measurement range. More... | |
Header file of ADXL345 Driver.
Copyright 2012(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ADXL345_ACT_ACDC (1 << 7) |
#define ADXL345_ACT_INACT_CTL 0x27 |
#define ADXL345_ACT_TAP_STATUS 0x2B |
#define ADXL345_ACT_X_EN (1 << 6) |
#define ADXL345_ACT_X_SRC (1 << 6) |
#define ADXL345_ACT_Y_EN (1 << 5) |
#define ADXL345_ACT_Y_SRC (1 << 5) |
#define ADXL345_ACT_Z_EN (1 << 4) |
#define ADXL345_ACT_Z_SRC (1 << 4) |
#define ADXL345_ACTIVITY (1 << 4) |
#define ADXL345_ADDRESS 0x1D |
#define ADXL345_ASLEEP (1 << 3) |
#define ADXL345_BW_RATE 0x2C |
#define ADXL345_DATA_FORMAT 0x31 |
#define ADXL345_DATA_READY (1 << 7) |
#define ADXL345_DATAX0 0x32 |
#define ADXL345_DATAX1 0x33 |
#define ADXL345_DATAY0 0x34 |
#define ADXL345_DATAY1 0x35 |
#define ADXL345_DATAZ0 0x36 |
#define ADXL345_DATAZ1 0x37 |
#define ADXL345_DEAD_ZONE | ( | x | ) | (((x) & 0x7) << 4) |
#define ADXL345_DEVID 0x00 |
#define ADXL345_DIVISOR | ( | x | ) | ((x) & 7) |
#define ADXL345_DOUBLE_TAP (1 << 5) |
#define ADXL345_DUR 0x21 |
#define ADXL345_ENTRIES | ( | x | ) | ((x) & 0x3F) |
#define ADXL345_FIFO_BYPASS 0 |
#define ADXL345_FIFO_CTL 0x38 |
#define ADXL345_FIFO_FIFO 1 |
#define ADXL345_FIFO_MODE | ( | x | ) | (((x) & 0x3) << 6) |
#define ADXL345_FIFO_STATUS 0x39 |
#define ADXL345_FIFO_STREAM 2 |
#define ADXL345_FIFO_TRIG (1 << 7) |
#define ADXL345_FIFO_TRIGGER 3 |
#define ADXL345_FREE_FALL (1 << 2) |
#define ADXL345_FULL_RES (1 << 3) |
#define ADXL345_I2C_COMM 1 |
#define ADXL345_ID 0xE5 |
#define ADXL345_INACT_ACDC (1 << 3) |
#define ADXL345_INACT_X_EN (1 << 2) |
#define ADXL345_INACT_Y_EN (1 << 1) |
#define ADXL345_INACT_Z_EN (1 << 0) |
#define ADXL345_INACTIVITY (1 << 3) |
#define ADXL345_INT_3D | ( | x | ) | (((x) & 0x1) << 3) |
#define ADXL345_INT_ENABLE 0x2E |
#define ADXL345_INT_INVERT (1 << 5) |
#define ADXL345_INT_MAP 0x2F |
#define ADXL345_INT_ORIENT | ( | x | ) | (((x) & 0x1) << 7) |
#define ADXL345_INT_SOURCE 0x30 |
#define ADXL345_JUSTIFY (1 << 2) |
#define ADXL345_LATENT 0x22 |
#define ADXL345_LOW_POWER (1 << 4) |
#define ADXL345_OFSX 0x1E |
#define ADXL345_OFSY 0x1F |
#define ADXL345_OFSZ 0x20 |
#define ADXL345_ORIENT 0x3C |
#define ADXL345_ORIENT_CONF 0x3B |
#define ADXL345_ORIENTATION (1 << 0) |
#define ADXL345_OVERRUN (1 << 0) |
#define ADXL345_PCTL_AUTO_SLEEP (1 << 4) |
#define ADXL345_PCTL_LINK (1 << 5) |
#define ADXL345_PCTL_MEASURE (1 << 3) |
#define ADXL345_PCTL_SLEEP (1 << 2) |
#define ADXL345_PCTL_WAKEUP | ( | x | ) | ((x) & 0x3) |
#define ADXL345_POWER_CTL 0x2D |
#define ADXL345_RANGE | ( | x | ) | ((x) & 0x3) |
#define ADXL345_RANGE_PM_16G 3 |
#define ADXL345_RANGE_PM_2G 0 |
#define ADXL345_RANGE_PM_4G 1 |
#define ADXL345_RANGE_PM_8G 2 |
#define ADXL345_RATE | ( | x | ) | ((x) & 0xF) |
#define ADXL345_SAMPLES | ( | x | ) | ((x) & 0x1F) |
#define ADXL345_SCALE_FACTOR 0.0039 |
#define ADXL345_SELF_TEST (1 << 7) |
#define ADXL345_SINGLE_TAP (1 << 6) |
#define ADXL345_SPI (1 << 6) |
#define ADXL345_SPI_COMM 0 |
#define ADXL345_SPI_MB (1 << 6) |
#define ADXL345_SPI_READ (1 << 7) |
#define ADXL345_SPI_WRITE (0 << 7) |
#define ADXL345_SUPPRESS (1 << 3) |
#define ADXL345_TAP_AXES 0x2A |
#define ADXL345_TAP_SIGN 0x3A |
#define ADXL345_TAP_X_EN (1 << 2) |
#define ADXL345_TAP_X_SRC (1 << 2) |
#define ADXL345_TAP_Y_EN (1 << 1) |
#define ADXL345_TAP_Y_SRC (1 << 1) |
#define ADXL345_TAP_Z_EN (1 << 0) |
#define ADXL345_TAP_Z_SRC (1 << 0) |
#define ADXL345_THRESH_ACT 0x24 |
#define ADXL345_THRESH_FF 0x28 |
#define ADXL345_THRESH_INACT 0x25 |
#define ADXL345_THRESH_TAP 0x1D |
#define ADXL345_TIME_FF 0x29 |
#define ADXL345_TIME_INACT 0x26 |
#define ADXL345_TRIGGER (1 << 5) |
#define ADXL345_WATERMARK (1 << 1) |
#define ADXL345_WINDOW 0x23 |
#define ADXL346_ID 0xE6 |
enum adxl345_type |
void adxl345_get_g_xyz | ( | struct adxl345_dev * | dev, |
float * | x, | ||
float * | y, | ||
float * | z | ||
) |
Reads the raw output data of each axis and converts it to g.
Reads the raw output data of each axis and converts it to g.
dev | - The device structure. |
x | - X-axis's output data. |
y | - Y-axis's output data. |
z | - Z-axis's output data. |
uint8_t adxl345_get_register_value | ( | struct adxl345_dev * | dev, |
uint8_t | register_address | ||
) |
Reads the value of a register.
Reads the value of a register.
dev | - The device structure. |
register_address | - Address of the register. |
void adxl345_get_xyz | ( | struct adxl345_dev * | dev, |
int16_t * | x, | ||
int16_t * | y, | ||
int16_t * | z | ||
) |
Reads the raw output data of each axis.
Reads the raw output data of each axis.
dev | - The device structure. |
x | - X-axis's output data. |
y | - Y-axis's output data. |
z | - Z-axis's output data. |
int32_t adxl345_init | ( | struct adxl345_dev ** | device, |
struct adxl345_init_param | init_param | ||
) |
Initializes the communication peripheral and checks if the ADXL345 part is present.
Init. the comm. peripheral and checks if the ADXL345 part is present.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t adxl345_remove | ( | struct adxl345_dev * | dev | ) |
Free the resources allocated by adxl345_init().
Free the resources allocated by adxl345_init().
dev | - The device structure. |
void adxl345_set_activity_detection | ( | struct adxl345_dev * | dev, |
uint8_t | act_on_off, | ||
uint8_t | act_axes, | ||
uint8_t | act_ac_dc, | ||
uint8_t | act_thresh, | ||
uint8_t | act_int | ||
) |
Enables/disables the activity detection.
Enables/disables the activity detection.
dev | - The device structure. |
act_on_off | - Enables/disables the activity detection. Example: 0x0 - disables the activity detection. 0x1 - enables the activity detection. |
act_axes | - Axes which participate in detecting activity. Example: 0x0 - disables axes participation. ADXL345_ACT_X_EN - enables x-axis participation. ADXL345_ACT_Y_EN - enables y-axis participation. ADXL345_ACT_Z_EN - enables z-axis participation. |
act_ac_dc | - Selects dc-coupled or ac-coupled operation. Example: 0x0 - dc-coupled operation. ADXL345_ACT_ACDC - ac-coupled operation. |
act_thresh | - Threshold value for detecting activity. The scale factor is 62.5 mg/LSB. |
act_int | - Interrupts pin. Example: 0x0 - activity interrupts on INT1 pin. ADXL345_ACTIVITY - activity interrupts on INT2 pin. |
void adxl345_set_free_fall_detection | ( | struct adxl345_dev * | dev, |
uint8_t | ff_on_off, | ||
uint8_t | ff_thresh, | ||
uint8_t | ff_time, | ||
uint8_t | ff_int | ||
) |
Enables/disables the free-fall detection.
Enables/disables the free-fall detection.
dev | - The device structure. |
ff_on_off | - Enables/disables the free-fall detection. Example: 0x0 - disables the free-fall detection. 0x1 - enables the free-fall detection. |
ff_thresh | - Threshold value for free-fall detection. The scale factor is 62.5 mg/LSB. |
ff_time | - Time value for free-fall detection. The scale factor is 5 ms/LSB. |
ff_int | - Interrupts pin. Example: 0x0 - free-fall interrupts on INT1 pin. ADXL345_FREE_FALL - free-fall interrupts on INT2 pin. |
void adxl345_set_inactivity_detection | ( | struct adxl345_dev * | dev, |
uint8_t | inact_on_off, | ||
uint8_t | inact_axes, | ||
uint8_t | inact_ac_dc, | ||
uint8_t | inact_thresh, | ||
uint8_t | inact_time, | ||
uint8_t | inact_int | ||
) |
Enables/disables the inactivity detection.
Enables/disables the inactivity detection.
dev | - The device structure. |
inact_on_off | - Enables/disables the inactivity detection. Example: 0x0 - disables the inactivity detection. 0x1 - enables the inactivity detection. |
inact_axes | - Axes which participate in detecting inactivity. Example: 0x0 - disables axes participation. ADXL345_INACT_X_EN - enables x-axis. ADXL345_INACT_Y_EN - enables y-axis. ADXL345_INACT_Z_EN - enables z-axis. |
inact_ac_dc | - Selects dc-coupled or ac-coupled operation. Example: 0x0 - dc-coupled operation. ADXL345_INACT_ACDC - ac-coupled operation. |
inact_thresh | - Threshold value for detecting inactivity. The scale factor is 62.5 mg/LSB. |
inact_time | - Inactivity time. The scale factor is 1 sec/LSB. |
inact_int | - Interrupts pin. Example: 0x0 - inactivity interrupts on INT1 pin. ADXL345_INACTIVITY - inactivity interrupts on INT2 pin. |
void adxl345_set_offset | ( | struct adxl345_dev * | dev, |
uint8_t | x_offset, | ||
uint8_t | y_offset, | ||
uint8_t | z_offset | ||
) |
Sets an offset value for each axis (Offset Calibration).
Sets an offset value for each axis (Offset Calibration).
dev | - The device structure. |
x_offset | - X-axis's offset. |
y_offset | - Y-axis's offset. |
z_offset | - Z-axis's offset. |
void adxl345_set_orientation_detection | ( | struct adxl345_dev * | dev, |
uint8_t | orient_int, | ||
uint8_t | orient_on_off, | ||
uint8_t | int_3d, | ||
enum adxl345_dead_zone_angle | dead_zone, | ||
enum adxl345_divisor_bandwidth | divisor | ||
) |
Enables/disables the orientation detection (only for adxl346).
Enables/disables the orientation detection.
dev | - The device structure. |
orient_int | - Interrupts pin. Example: 0x0 - orientation interrupts on INT1 pin. ADXL345_ORIENTATION - orientation interrupts on INT2 pin. |
orient_on_off | - Enables/disables the orientation detection. Example: 0x0 - disables the orientation detection. 0x1 - enables the orientation detection. |
int_3d | - Enables/disables the 3d orientation detection. Example: 0x0 - disables the 3d orientation detection (enables 2d orientation detection). 0x1 - enables the 3d orientation detection (disables 2d orientation detection). |
dead_zone | - Dead zone angle encoding. |
divisor | - Bandwidth divisor encoding. |
void adxl345_set_power_mode | ( | struct adxl345_dev * | dev, |
uint8_t | pwr_mode | ||
) |
Places the device into standby/measure mode.
Places the device into standby/measure mode.
dev | - The device structure. |
pwr_mode | - Power mode. Example: 0x0 - standby mode. 0x1 - measure mode. |
void adxl345_set_range_resolution | ( | struct adxl345_dev * | dev, |
uint8_t | g_range, | ||
uint8_t | full_res | ||
) |
Selects the measurement range.
Selects the measurement range.
dev | - The device structure. |
g_range | - Range option. Example: ADXL345_RANGE_PM_2G - +-2 g ADXL345_RANGE_PM_4G - +-4 g ADXL345_RANGE_PM_8G - +-8 g ADXL345_RANGE_PM_16G - +-16 g |
full_res | - Full resolution option. Example: 0x0 - Disables full resolution. ADXL345_FULL_RES - Enables full resolution. |
void adxl345_set_register_value | ( | struct adxl345_dev * | dev, |
uint8_t | register_address, | ||
uint8_t | register_value | ||
) |
Writes data into a register.
Writes data into a register.
dev | - The device structure. |
register_address | - Address of the register. |
register_value | - Data value to write. |
void adxl345_set_tap_detection | ( | struct adxl345_dev * | dev, |
uint8_t | tap_type, | ||
uint8_t | tap_axes, | ||
uint8_t | tap_dur, | ||
uint8_t | tap_latent, | ||
uint8_t | tap_window, | ||
uint8_t | tap_thresh, | ||
uint8_t | tap_int | ||
) |
Enables/disables the tap detection.
Enables/disables the tap detection.
dev | - The device structure. |
tap_type | - Tap type (none, single, double). Example: 0x0 - disables tap detection. ADXL345_SINGLE_TAP - enables single tap detection. ADXL345_DOUBLE_TAP - enables double tap detection. |
tap_axes | - Axes which participate in tap detection. Example: 0x0 - disables axes participation. ADXL345_TAP_X_EN - enables x-axis participation. ADXL345_TAP_Y_EN - enables y-axis participation. ADXL345_TAP_Z_EN - enables z-axis participation. |
tap_dur | - Tap duration. The scale factor is 625us is/LSB. |
tap_latent | - Tap latency. The scale factor is 1.25 ms/LSB. |
tap_window | - Tap window. The scale factor is 1.25 ms/LSB. |
tap_thresh | - Tap threshold. The scale factor is 62.5 mg/LSB. |
tap_int | - Interrupts pin. Example: 0x0 - interrupts on INT1 pin. ADXL345_SINGLE_TAP - single tap interrupts on INT2 pin. ADXL345_DOUBLE_TAP - double tap interrupts on INT2 pin. |