![]() |
no-OS
|
Header file of ADXL355 Driver. More...
#include <stdint.h>#include <string.h>#include "no_os_util.h"#include "no_os_i2c.h"#include "no_os_spi.h"Classes | |
| union | adxl355_comm_init_param |
| struct | adxl355_init_param |
| Structure holding the parameters for ADXL355 device initialization. More... | |
| struct | _adxl355_int_mask |
| union | adxl355_int_mask |
| struct | _adxl355_sts_reg_flags |
| union | adxl355_sts_reg_flags |
| struct | _adxl355_act_en_flags |
| union | adxl355_act_en_flags |
| struct | adxl355_frac_repr |
| union | adxl355_comm_desc |
| struct | adxl355_dev |
| ADXL355 Device structure. More... | |
Functions | |
| int | adxl355_init (struct adxl355_dev **device, struct adxl355_init_param init_param) |
| Initializes the communication peripheral and checks if the ADXL355 part is present. | |
| int | adxl355_remove (struct adxl355_dev *dev) |
| Free the resources allocated by adxl355_init(). | |
| int | adxl355_set_op_mode (struct adxl355_dev *dev, enum adxl355_op_mode op_mode) |
| Places the device into the given operation mode. | |
| int | adxl355_get_op_mode (struct adxl355_dev *dev, enum adxl355_op_mode *read_op_mode) |
| Gets the current operation mode of the device. | |
| int | adxl355_soft_reset (struct adxl355_dev *dev) |
| Performs a soft reset of the device. | |
| int | adxl355_set_self_test (struct adxl355_dev *dev) |
| Triggers the self-test feature. | |
| int | adxl355_set_range (struct adxl355_dev *dev, enum adxl355_range range_val) |
| Sets the measurement range register value. | |
| int | adxl355_set_odr_lpf (struct adxl355_dev *dev, enum adxl355_odr_lpf odr_lpf_val) |
| Writes the low-pass filter settings. | |
| int | adxl355_set_hpf_corner (struct adxl355_dev *dev, enum adxl355_hpf_corner hpf_corner_val) |
| Writes the high-pass filter settings. | |
| int | adxl355_set_offset (struct adxl355_dev *dev, uint16_t x_offset, uint16_t y_offset, uint16_t z_offset) |
| Sets an offset value for each axis (Offset Calibration). | |
| int | adxl355_get_raw_xyz (struct adxl355_dev *dev, uint32_t *raw_x, uint32_t *raw_y, uint32_t *raw_z) |
| Reads the raw output data. | |
| int | adxl355_get_xyz (struct adxl355_dev *dev, struct adxl355_frac_repr *x, struct adxl355_frac_repr *y, struct adxl355_frac_repr *z) |
| Reads the raw output data of each axis and converts it to g. | |
| int | adxl355_get_raw_temp (struct adxl355_dev *dev, uint16_t *raw_temp) |
| Reads the raw temperature. | |
| int | adxl355_get_temp (struct adxl355_dev *dev, struct adxl355_frac_repr *temp) |
| Reads the raw temperature data and converts it to millidegrees Celsius. | |
| int | adxl355_get_sts_reg (struct adxl355_dev *dev, union adxl355_sts_reg_flags *status_flags) |
| Reads the status register value. | |
| int | adxl355_get_nb_of_fifo_entries (struct adxl355_dev *dev, uint8_t *reg_value) |
| Reads the number of FIFO entries register value. | |
| int | adxl355_set_fifo_samples (struct adxl355_dev *dev, uint8_t reg_value) |
| Sets the number of FIFO samples register value. | |
| int | adxl355_get_raw_fifo_data (struct adxl355_dev *dev, uint8_t *fifo_entries, uint32_t *raw_x, uint32_t *raw_y, uint32_t *raw_z) |
| Reads fifo data and returns the raw values. | |
| int | adxl355_get_fifo_data (struct adxl355_dev *dev, uint8_t *fifo_entries, struct adxl355_frac_repr *x, struct adxl355_frac_repr *y, struct adxl355_frac_repr *z) |
| Reads fifo data and returns the values converted in m/s^2. | |
| int | adxl355_conf_act_en (struct adxl355_dev *dev, union adxl355_act_en_flags act_config) |
| Configures the activity enable register. | |
| int | adxl355_conf_act_thr (struct adxl355_dev *dev, uint16_t act_thr) |
| Configures the activity threshold registers. | |
| int | adxl355_set_act_cnt_reg (struct adxl355_dev *dev, uint8_t act_cnt) |
| Writes the activity count register value. | |
| int | adxl355_config_int_pins (struct adxl355_dev *dev, union adxl355_int_mask int_conf) |
| Configures the interrupt map for INT1 and INT2 pins. | |
| int | adxl355_set_int_pol (struct adxl355_dev *dev, enum adxl355_int_pol int_pol) |
| Sets the interrupt polarity. | |
Header file of ADXL355 Driver.
Copyright 2022(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define ADXL355_ACC_SCALE_FACTOR_DIV (int32_t)1000000000 |
| #define ADXL355_ACC_SCALE_FACTOR_MUL (int64_t) 38245 |
| #define ADXL355_ACT_CNT (ADXL355_ADDR(0x27) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01)) |
| #define ADXL355_ACT_EN (ADXL355_ADDR(0x24) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_ACT_THRESH (ADXL355_ADDR(0x25) | SET_ADXL355_TRANSF_LEN(2)) |
| #define ADXL355_ADDR | ( | x | ) |
| #define ADXL355_DEVID_AD (ADXL355_ADDR(0x00) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xAD)) |
| #define ADXL355_DEVID_MST (ADXL355_ADDR(0x01) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x1D)) |
| #define ADXL355_FIFO_DATA (ADXL355_ADDR(0x11) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_FIFO_ENTRIES (ADXL355_ADDR(0x05) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_FIFO_SAMPLES (ADXL355_ADDR(0x29) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x60)) |
| #define ADXL355_FILTER (ADXL355_ADDR(0x28) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_HPF_FIELD_MSK NO_OS_GENMASK( 6, 4) |
| #define ADXL355_INT_MAP (ADXL355_ADDR(0x2A) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_INT_POL_FIELD_MSK NO_OS_BIT(6) |
| #define ADXL355_MAX_FIFO_SAMPLES_VAL 0x60 |
| #define ADXL355_NEG_ACC_MSK NO_OS_GENMASK(31, 20) |
| #define ADXL355_ODR_LPF_FIELD_MSK NO_OS_GENMASK( 3, 0) |
| #define ADXL355_OFFSET_X (ADXL355_ADDR(0x1E) | SET_ADXL355_TRANSF_LEN(2)) |
| #define ADXL355_OFFSET_Y (ADXL355_ADDR(0x20) | SET_ADXL355_TRANSF_LEN(2)) |
| #define ADXL355_OFFSET_Z (ADXL355_ADDR(0x22) | SET_ADXL355_TRANSF_LEN(2)) |
| #define ADXL355_PARTID (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xED)) |
| #define ADXL355_POWER_CTL (ADXL355_ADDR(0x2D) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01)) |
| #define ADXL355_RANGE (ADXL355_ADDR(0x2C) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x81)) |
| #define ADXL355_RANGE_FIELD_MSK NO_OS_GENMASK( 1, 0) |
| #define ADXL355_RESET (ADXL355_ADDR(0x2F) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_RESET_CODE 0x52 |
| #define ADXL355_REVID (ADXL355_ADDR(0x03) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01)) |
| #define ADXL355_SELF_TEST (ADXL355_ADDR(0x2E) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_SELF_TEST_TRIGGER_VAL 0x03 |
| #define ADXL355_SHADOW_REGISTER_BASE_ADDR (ADXL355_ADDR(0x50) | SET_ADXL355_TRANSF_LEN(5)) |
| #define ADXL355_SPI_READ 0x01 |
| #define ADXL355_SPI_WRITE 0x00 |
| #define ADXL355_STATUS (ADXL355_ADDR(0x04) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_SYNC (ADXL355_ADDR(0x2B) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00)) |
| #define ADXL355_TEMP (ADXL355_ADDR(0x06) | SET_ADXL355_TRANSF_LEN(2)) |
| #define ADXL355_TEMP_OFFSET -211125 |
| #define ADXL355_TEMP_OFFSET_DIV 100 |
| #define ADXL355_TEMP_SCALE_FACTOR -110497238 |
| #define ADXL355_TEMP_SCALE_FACTOR_DIV 1000000 |
| #define ADXL355_XDATA (ADXL355_ADDR(0x08) | SET_ADXL355_TRANSF_LEN(3)) |
| #define ADXL355_YDATA (ADXL355_ADDR(0x0B) | SET_ADXL355_TRANSF_LEN(3)) |
| #define ADXL355_ZDATA (ADXL355_ADDR(0x0E) | SET_ADXL355_TRANSF_LEN(3)) |
| #define ADXL359_ACC_SCALE_FACTOR_DIV (int32_t)1000000000 |
| #define ADXL359_ACC_SCALE_FACTOR_MUL (int64_t) 191229 |
| #define ADXL359_PARTID (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xE9)) |
| #define ADXL359_TEMP_OFFSET -207825 |
| #define ADXL359_TEMP_OFFSET_DIV 100 |
| #define ADXL359_TEMP_SCALE_FACTOR -110497238 |
| #define ADXL359_TEMP_SCALE_FACTOR_DIV 1000000 |
| #define GET_ADXL355_RESET_VAL | ( | x | ) |
| #define GET_ADXL355_TRANSF_LEN | ( | x | ) |
| #define SET_ADXL355_RESET_VAL | ( | x | ) |
| #define SET_ADXL355_TRANSF_LEN | ( | x | ) |
| enum adxl355_comm_type |
| enum adxl355_hpf_corner |
| enum adxl355_int_pol |
| enum adxl355_odr_lpf |
| enum adxl355_op_mode |
| enum adxl355_range |
| enum adxl355_type |
| int adxl355_conf_act_en | ( | struct adxl355_dev * | dev, |
| union adxl355_act_en_flags | act_config ) |
Configures the activity enable register.
Configures the activity enable register.
| dev | - The device structure. |
| act_config | - Activity enable mapping. |
| int adxl355_conf_act_thr | ( | struct adxl355_dev * | dev, |
| uint16_t | act_thr ) |
Configures the activity threshold registers.
Configures the activity threshold registers.
| dev | - The device structure. |
| act_thr | - Activity threshold value. |
| int adxl355_config_int_pins | ( | struct adxl355_dev * | dev, |
| union adxl355_int_mask | int_conf ) |
Configures the interrupt map for INT1 and INT2 pins.
Configures the interrupt map for INT1 and INT2 pins.
| dev | - The device structure. |
| int_conf | - Interrupt mapping. |
| int adxl355_get_fifo_data | ( | struct adxl355_dev * | dev, |
| uint8_t * | fifo_entries, | ||
| struct adxl355_frac_repr * | x, | ||
| struct adxl355_frac_repr * | y, | ||
| struct adxl355_frac_repr * | z ) |
Reads fifo data and returns the values converted in m/s^2.
Reads fifo data and returns the values converted in g.
| dev | - The device structure. |
| fifo_entries | - The number of fifo entries. |
| x | - Converted x-axis data. |
| y | - Converted y-axis data. |
| z | - Converted z-axis data. |
| int adxl355_get_nb_of_fifo_entries | ( | struct adxl355_dev * | dev, |
| uint8_t * | reg_value ) |
Reads the number of FIFO entries register value.
Reads the number of FIFO entries register value.
| dev | - The device structure. |
| reg_value | - Register value. |
| int adxl355_get_op_mode | ( | struct adxl355_dev * | dev, |
| enum adxl355_op_mode * | op_mode ) |
Gets the current operation mode of the device.
Reads the device current operation mode.
| dev | - The device structure. |
| op_mode | - Read operation mode. |
| int adxl355_get_raw_fifo_data | ( | struct adxl355_dev * | dev, |
| uint8_t * | fifo_entries, | ||
| uint32_t * | raw_x, | ||
| uint32_t * | raw_y, | ||
| uint32_t * | raw_z ) |
Reads fifo data and returns the raw values.
Reads fifo data and returns the raw values.
| dev | - The device structure. |
| fifo_entries | - The number of fifo entries. |
| raw_x | - Raw x-axis data. |
| raw_y | - Raw y-axis data. |
| raw_z | - Raw z-axis data. |
| int adxl355_get_raw_temp | ( | struct adxl355_dev * | dev, |
| uint16_t * | raw_temp ) |
Reads the raw temperature.
Reads the raw temperature data.
| dev | - The device structure. |
| raw_temp | - Raw temperature output data. |
| int adxl355_get_raw_xyz | ( | struct adxl355_dev * | dev, |
| uint32_t * | raw_x, | ||
| uint32_t * | raw_y, | ||
| uint32_t * | raw_z ) |
Reads the raw output data.
Reads the raw output data of each axis.
| dev | - The device structure. |
| raw_x | - X-axis's raw output data. |
| raw_y | - Y-axis's raw output data. |
| raw_z | - Z-axis's raw output data. |
| int adxl355_get_sts_reg | ( | struct adxl355_dev * | dev, |
| union adxl355_sts_reg_flags * | status_flags ) |
Reads the status register value.
Reads the status register value.
| dev | - The device structure. |
| status_flags | - Register value. |
| int adxl355_get_temp | ( | struct adxl355_dev * | dev, |
| struct adxl355_frac_repr * | temp ) |
Reads the raw temperature data and converts it to millidegrees Celsius.
Reads the raw temperature data and converts it to millidegrees Celsius.
| dev | - The device structure. |
| temp | - Temperature output data. |
| int adxl355_get_xyz | ( | struct adxl355_dev * | dev, |
| struct adxl355_frac_repr * | x, | ||
| struct adxl355_frac_repr * | y, | ||
| struct adxl355_frac_repr * | 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. |
| int adxl355_init | ( | struct adxl355_dev ** | device, |
| struct adxl355_init_param | init_param ) |
Initializes the communication peripheral and checks if the ADXL355 part is present.
Init. the comm. peripheral and checks if the ADXL355 part is present.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| int adxl355_remove | ( | struct adxl355_dev * | dev | ) |
Free the resources allocated by adxl355_init().
Free the resources allocated by adxl355_init().
| dev | - The device structure. |
| int adxl355_set_act_cnt_reg | ( | struct adxl355_dev * | dev, |
| uint8_t | act_cnt ) |
Writes the activity count register value.
Writes the activity count register value.
| dev | - The device structure. |
| act_cnt | - Register value. |
| int adxl355_set_fifo_samples | ( | struct adxl355_dev * | dev, |
| uint8_t | reg_value ) |
Sets the number of FIFO samples register value.
Sets the number of FIFO samples register value.
| dev | - The device structure. |
| reg_value | - Register value. |
| int adxl355_set_hpf_corner | ( | struct adxl355_dev * | dev, |
| enum adxl355_hpf_corner | hpf_corner_val ) |
Writes the high-pass filter settings.
Writes the high-pass filter settings.
| dev | - The device structure. |
| hpf_corner_val | - High-pass filter settings. |
| int adxl355_set_int_pol | ( | struct adxl355_dev * | dev, |
| enum adxl355_int_pol | int_pol ) |
Sets the interrupt polarity.
Configures the interrupt polarity.
| dev | - The device structure. |
| int_pol | - Interrupt polarity to be set. |
| int adxl355_set_odr_lpf | ( | struct adxl355_dev * | dev, |
| enum adxl355_odr_lpf | odr_lpf_val ) |
Writes the low-pass filter settings.
Writes the low-pass filter settings.
| dev | - The device structure. |
| odr_lpf_val | - Low-pass filter settings. |
| int adxl355_set_offset | ( | struct adxl355_dev * | dev, |
| uint16_t | x_offset, | ||
| uint16_t | y_offset, | ||
| uint16_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. |
| int adxl355_set_op_mode | ( | struct adxl355_dev * | dev, |
| enum adxl355_op_mode | op_mode ) |
Places the device into the given operation mode.
Places the device into the given operation mode.
| dev | - The device structure. |
| op_mode | - Operation mode mode. |
| int adxl355_set_range | ( | struct adxl355_dev * | dev, |
| enum adxl355_range | range_val ) |
Sets the measurement range register value.
Sets the measurement range register value.
| dev | - The device structure. |
| range_val | - Selected range. |
| int adxl355_set_self_test | ( | struct adxl355_dev * | dev | ) |
Triggers the self-test feature.
Triggers the self-test feature.
| dev | - The device structure. |
| int adxl355_soft_reset | ( | struct adxl355_dev * | dev | ) |
Performs a soft reset of the device.
Performs soft reset of the device.
| dev | - The device structure. |