no-OS
Classes | Macros | Enumerations | Functions
adxl355.h File Reference

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"
Include dependency graph for adxl355.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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...
 

Macros

#define ADXL355_SPI_READ   0x01
 
#define ADXL355_SPI_WRITE   0x00
 
#define ADXL355_ADDR(x)   ((x) & 0xFF)
 
#define GET_ADXL355_TRANSF_LEN(x)   (((x) >> 8) & 0x0000FF)
 
#define SET_ADXL355_TRANSF_LEN(x)   (((x) << 8) & 0x00FF00)
 
#define GET_ADXL355_RESET_VAL(x)   (((x) >> 16) & 0x0000FF)
 
#define SET_ADXL355_RESET_VAL(x)   (((x) << 16) & 0xFF0000)
 
#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_PARTID   (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xED))
 
#define ADXL359_PARTID   (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xE9))
 
#define ADXL355_REVID   (ADXL355_ADDR(0x03) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))
 
#define ADXL355_STATUS   (ADXL355_ADDR(0x04) | 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_TEMP   (ADXL355_ADDR(0x06) | SET_ADXL355_TRANSF_LEN(2))
 
#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 ADXL355_FIFO_DATA   (ADXL355_ADDR(0x11) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
 
#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_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_ACT_CNT   (ADXL355_ADDR(0x27) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))
 
#define ADXL355_FILTER   (ADXL355_ADDR(0x28) | 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_INT_MAP   (ADXL355_ADDR(0x2A) | 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_RANGE   (ADXL355_ADDR(0x2C) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x81))
 
#define ADXL355_POWER_CTL   (ADXL355_ADDR(0x2D) | 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_RESET   (ADXL355_ADDR(0x2F) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))
 
#define ADXL355_SHADOW_REGISTER_BASE_ADDR   (ADXL355_ADDR(0x50) | SET_ADXL355_TRANSF_LEN(5))
 
#define ADXL355_MAX_FIFO_SAMPLES_VAL   0x60
 
#define ADXL355_SELF_TEST_TRIGGER_VAL   0x03
 
#define ADXL355_RESET_CODE   0x52
 
#define ADXL355_ACC_SCALE_FACTOR_MUL   (int64_t) 38245
 
#define ADXL355_ACC_SCALE_FACTOR_DIV   (int32_t)1000000000
 
#define ADXL359_ACC_SCALE_FACTOR_MUL   (int64_t) 191229
 
#define ADXL359_ACC_SCALE_FACTOR_DIV   (int32_t)1000000000
 
#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 ADXL359_TEMP_OFFSET   -207825
 
#define ADXL359_TEMP_OFFSET_DIV   100
 
#define ADXL359_TEMP_SCALE_FACTOR   -110497238
 
#define ADXL359_TEMP_SCALE_FACTOR_DIV   1000000
 
#define ADXL355_NEG_ACC_MSK   NO_OS_GENMASK(31, 20)
 
#define ADXL355_RANGE_FIELD_MSK   NO_OS_GENMASK( 1, 0)
 
#define ADXL355_ODR_LPF_FIELD_MSK   NO_OS_GENMASK( 3, 0)
 
#define ADXL355_HPF_FIELD_MSK   NO_OS_GENMASK( 6, 4)
 
#define ADXL355_INT_POL_FIELD_MSK   NO_OS_BIT(6)
 

Enumerations

enum  adxl355_type {
  ID_ADXL355,
  ID_ADXL357,
  ID_ADXL359
}
 
enum  adxl355_op_mode {
  ADXL355_MEAS_TEMP_ON_DRDY_ON = 0,
  ADXL355_STDBY_TEMP_ON_DRDY_ON = 1,
  ADXL355_MEAS_TEMP_OFF_DRDY_ON = 2,
  ADXL355_STDBY_TEMP_OFF_DRDY_ON = 3,
  ADXL355_MEAS_TEMP_ON_DRDY_OFF = 4,
  ADXL355_STDBY_TEMP_ON_DRDY_OFF = 5,
  ADXL355_MEAS_TEMP_OFF_DRDY_OFF = 6,
  ADXL355_STDBY_TEMP_OFF_DRDY_OFF = 7
}
 
enum  adxl355_comm_type {
  ADXL355_SPI_COMM,
  ADXL355_I2C_COMM
}
 
enum  adxl355_hpf_corner {
  ADXL355_HPF_OFF,
  ADXL355_HPF_24_7,
  ADXL355_HPF_6_2084,
  ADXL355_HPF_1_5545,
  ADXL355_HPF_0_3862,
  ADXL355_HPF_0_0954,
  ADXL355_HPF_0_0238
}
 
enum  adxl355_odr_lpf {
  ADXL355_ODR_4000HZ,
  ADXL355_ODR_2000HZ,
  ADXL355_ODR_1000HZ,
  ADXL355_ODR_500HZ,
  ADXL355_ODR_250HZ,
  ADXL355_ODR_125HZ,
  ADXL355_ODR_62_5HZ,
  ADXL355_ODR_31_25HZ,
  ADXL355_ODR_15_625HZ,
  ADXL355_ODR_7_813HZ,
  ADXL355_ODR_3_906HZ
}
 
enum  adxl355_range {
  ADXL355_RANGE_2G = 1,
  ADXL359_RANGE_10G = 1,
  ADXL355_RANGE_4G = 2,
  ADXL359_RANGE_20G = 2,
  ADXL355_RANGE_8G = 3,
  ADXL359_RANGE_40G = 3
}
 
enum  adxl355_int_pol {
  ADXL355_INT_ACTIVE_LOW = 0,
  ADXL355_INT_ACTIVE_HIGH = 1
}
 

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. More...
 
int adxl355_remove (struct adxl355_dev *dev)
 Free the resources allocated by adxl355_init(). More...
 
int adxl355_set_op_mode (struct adxl355_dev *dev, enum adxl355_op_mode op_mode)
 Places the device into the given operation mode. More...
 
int adxl355_get_op_mode (struct adxl355_dev *dev, enum adxl355_op_mode *read_op_mode)
 Gets the current operation mode of the device. More...
 
int adxl355_soft_reset (struct adxl355_dev *dev)
 Performs a soft reset of the device. More...
 
int adxl355_set_self_test (struct adxl355_dev *dev)
 Triggers the self-test feature. More...
 
int adxl355_set_range (struct adxl355_dev *dev, enum adxl355_range range_val)
 Sets the measurement range register value. More...
 
int adxl355_set_odr_lpf (struct adxl355_dev *dev, enum adxl355_odr_lpf odr_lpf_val)
 Writes the low-pass filter settings. More...
 
int adxl355_set_hpf_corner (struct adxl355_dev *dev, enum adxl355_hpf_corner hpf_corner_val)
 Writes the high-pass filter settings. More...
 
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). More...
 
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. More...
 
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. More...
 
int adxl355_get_raw_temp (struct adxl355_dev *dev, uint16_t *raw_temp)
 Reads the raw temperature. More...
 
int adxl355_get_temp (struct adxl355_dev *dev, struct adxl355_frac_repr *temp)
 Reads the raw temperature data and converts it to millidegrees Celsius. More...
 
int adxl355_get_sts_reg (struct adxl355_dev *dev, union adxl355_sts_reg_flags *status_flags)
 Reads the status register value. More...
 
int adxl355_get_nb_of_fifo_entries (struct adxl355_dev *dev, uint8_t *reg_value)
 Reads the number of FIFO entries register value. More...
 
int adxl355_set_fifo_samples (struct adxl355_dev *dev, uint8_t reg_value)
 Sets the number of FIFO samples register value. More...
 
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. More...
 
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. More...
 
int adxl355_conf_act_en (struct adxl355_dev *dev, union adxl355_act_en_flags act_config)
 Configures the activity enable register. More...
 
int adxl355_conf_act_thr (struct adxl355_dev *dev, uint16_t act_thr)
 Configures the activity threshold registers. More...
 
int adxl355_set_act_cnt_reg (struct adxl355_dev *dev, uint8_t act_cnt)
 Writes the activity count register value. More...
 
int adxl355_config_int_pins (struct adxl355_dev *dev, union adxl355_int_mask int_conf)
 Configures the interrupt map for INT1 and INT2 pins. More...
 
int adxl355_set_int_pol (struct adxl355_dev *dev, enum adxl355_int_pol int_pol)
 Sets the interrupt polarity. More...
 

Detailed Description

Header file of ADXL355 Driver.

Author
RBolboac (ramon.nosp@m.a.bo.nosp@m.lboac.nosp@m.a@an.nosp@m.alog..nosp@m.com)

Copyright 2022(c) Analog Devices, Inc.

All rights reserved.

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 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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.

Macro Definition Documentation

◆ ADXL355_ACC_SCALE_FACTOR_DIV

#define ADXL355_ACC_SCALE_FACTOR_DIV   (int32_t)1000000000

◆ ADXL355_ACC_SCALE_FACTOR_MUL

#define ADXL355_ACC_SCALE_FACTOR_MUL   (int64_t) 38245

◆ ADXL355_ACT_CNT

#define ADXL355_ACT_CNT   (ADXL355_ADDR(0x27) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))

◆ ADXL355_ACT_EN

#define ADXL355_ACT_EN   (ADXL355_ADDR(0x24) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_ACT_THRESH

#define ADXL355_ACT_THRESH   (ADXL355_ADDR(0x25) | SET_ADXL355_TRANSF_LEN(2))

◆ ADXL355_ADDR

#define ADXL355_ADDR (   x)    ((x) & 0xFF)

◆ ADXL355_DEVID_AD

#define ADXL355_DEVID_AD   (ADXL355_ADDR(0x00) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xAD))

◆ ADXL355_DEVID_MST

#define ADXL355_DEVID_MST   (ADXL355_ADDR(0x01) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x1D))

◆ ADXL355_FIFO_DATA

#define ADXL355_FIFO_DATA   (ADXL355_ADDR(0x11) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_FIFO_ENTRIES

#define ADXL355_FIFO_ENTRIES   (ADXL355_ADDR(0x05) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_FIFO_SAMPLES

#define ADXL355_FIFO_SAMPLES   (ADXL355_ADDR(0x29) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x60))

◆ ADXL355_FILTER

#define ADXL355_FILTER   (ADXL355_ADDR(0x28) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_HPF_FIELD_MSK

#define ADXL355_HPF_FIELD_MSK   NO_OS_GENMASK( 6, 4)

◆ ADXL355_INT_MAP

#define ADXL355_INT_MAP   (ADXL355_ADDR(0x2A) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_INT_POL_FIELD_MSK

#define ADXL355_INT_POL_FIELD_MSK   NO_OS_BIT(6)

◆ ADXL355_MAX_FIFO_SAMPLES_VAL

#define ADXL355_MAX_FIFO_SAMPLES_VAL   0x60

◆ ADXL355_NEG_ACC_MSK

#define ADXL355_NEG_ACC_MSK   NO_OS_GENMASK(31, 20)

◆ ADXL355_ODR_LPF_FIELD_MSK

#define ADXL355_ODR_LPF_FIELD_MSK   NO_OS_GENMASK( 3, 0)

◆ ADXL355_OFFSET_X

#define ADXL355_OFFSET_X   (ADXL355_ADDR(0x1E) | SET_ADXL355_TRANSF_LEN(2))

◆ ADXL355_OFFSET_Y

#define ADXL355_OFFSET_Y   (ADXL355_ADDR(0x20) | SET_ADXL355_TRANSF_LEN(2))

◆ ADXL355_OFFSET_Z

#define ADXL355_OFFSET_Z   (ADXL355_ADDR(0x22) | SET_ADXL355_TRANSF_LEN(2))

◆ ADXL355_PARTID

#define ADXL355_PARTID   (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xED))

◆ ADXL355_POWER_CTL

#define ADXL355_POWER_CTL   (ADXL355_ADDR(0x2D) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))

◆ ADXL355_RANGE

#define ADXL355_RANGE   (ADXL355_ADDR(0x2C) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x81))

◆ ADXL355_RANGE_FIELD_MSK

#define ADXL355_RANGE_FIELD_MSK   NO_OS_GENMASK( 1, 0)

◆ ADXL355_RESET

#define ADXL355_RESET   (ADXL355_ADDR(0x2F) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_RESET_CODE

#define ADXL355_RESET_CODE   0x52

◆ ADXL355_REVID

#define ADXL355_REVID   (ADXL355_ADDR(0x03) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x01))

◆ ADXL355_SELF_TEST

#define ADXL355_SELF_TEST   (ADXL355_ADDR(0x2E) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_SELF_TEST_TRIGGER_VAL

#define ADXL355_SELF_TEST_TRIGGER_VAL   0x03

◆ ADXL355_SHADOW_REGISTER_BASE_ADDR

#define ADXL355_SHADOW_REGISTER_BASE_ADDR   (ADXL355_ADDR(0x50) | SET_ADXL355_TRANSF_LEN(5))

◆ ADXL355_SPI_READ

#define ADXL355_SPI_READ   0x01

◆ ADXL355_SPI_WRITE

#define ADXL355_SPI_WRITE   0x00

◆ ADXL355_STATUS

#define ADXL355_STATUS   (ADXL355_ADDR(0x04) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_SYNC

#define ADXL355_SYNC   (ADXL355_ADDR(0x2B) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0x00))

◆ ADXL355_TEMP

#define ADXL355_TEMP   (ADXL355_ADDR(0x06) | SET_ADXL355_TRANSF_LEN(2))

◆ ADXL355_TEMP_OFFSET

#define ADXL355_TEMP_OFFSET   -211125

◆ ADXL355_TEMP_OFFSET_DIV

#define ADXL355_TEMP_OFFSET_DIV   100

◆ ADXL355_TEMP_SCALE_FACTOR

#define ADXL355_TEMP_SCALE_FACTOR   -110497238

◆ ADXL355_TEMP_SCALE_FACTOR_DIV

#define ADXL355_TEMP_SCALE_FACTOR_DIV   1000000

◆ ADXL355_XDATA

#define ADXL355_XDATA   (ADXL355_ADDR(0x08) | SET_ADXL355_TRANSF_LEN(3))

◆ ADXL355_YDATA

#define ADXL355_YDATA   (ADXL355_ADDR(0x0B) | SET_ADXL355_TRANSF_LEN(3))

◆ ADXL355_ZDATA

#define ADXL355_ZDATA   (ADXL355_ADDR(0x0E) | SET_ADXL355_TRANSF_LEN(3))

◆ ADXL359_ACC_SCALE_FACTOR_DIV

#define ADXL359_ACC_SCALE_FACTOR_DIV   (int32_t)1000000000

◆ ADXL359_ACC_SCALE_FACTOR_MUL

#define ADXL359_ACC_SCALE_FACTOR_MUL   (int64_t) 191229

◆ ADXL359_PARTID

#define ADXL359_PARTID   (ADXL355_ADDR(0x02) | SET_ADXL355_TRANSF_LEN(1) | SET_ADXL355_RESET_VAL(0xE9))

◆ ADXL359_TEMP_OFFSET

#define ADXL359_TEMP_OFFSET   -207825

◆ ADXL359_TEMP_OFFSET_DIV

#define ADXL359_TEMP_OFFSET_DIV   100

◆ ADXL359_TEMP_SCALE_FACTOR

#define ADXL359_TEMP_SCALE_FACTOR   -110497238

◆ ADXL359_TEMP_SCALE_FACTOR_DIV

#define ADXL359_TEMP_SCALE_FACTOR_DIV   1000000

◆ GET_ADXL355_RESET_VAL

#define GET_ADXL355_RESET_VAL (   x)    (((x) >> 16) & 0x0000FF)

◆ GET_ADXL355_TRANSF_LEN

#define GET_ADXL355_TRANSF_LEN (   x)    (((x) >> 8) & 0x0000FF)

◆ SET_ADXL355_RESET_VAL

#define SET_ADXL355_RESET_VAL (   x)    (((x) << 16) & 0xFF0000)

◆ SET_ADXL355_TRANSF_LEN

#define SET_ADXL355_TRANSF_LEN (   x)    (((x) << 8) & 0x00FF00)

Enumeration Type Documentation

◆ adxl355_comm_type

Enumerator
ADXL355_SPI_COMM 
ADXL355_I2C_COMM 

◆ adxl355_hpf_corner

Enumerator
ADXL355_HPF_OFF 
ADXL355_HPF_24_7 
ADXL355_HPF_6_2084 
ADXL355_HPF_1_5545 
ADXL355_HPF_0_3862 
ADXL355_HPF_0_0954 
ADXL355_HPF_0_0238 

◆ adxl355_int_pol

Enumerator
ADXL355_INT_ACTIVE_LOW 
ADXL355_INT_ACTIVE_HIGH 

◆ adxl355_odr_lpf

Enumerator
ADXL355_ODR_4000HZ 
ADXL355_ODR_2000HZ 
ADXL355_ODR_1000HZ 
ADXL355_ODR_500HZ 
ADXL355_ODR_250HZ 
ADXL355_ODR_125HZ 
ADXL355_ODR_62_5HZ 
ADXL355_ODR_31_25HZ 
ADXL355_ODR_15_625HZ 
ADXL355_ODR_7_813HZ 
ADXL355_ODR_3_906HZ 

◆ adxl355_op_mode

Enumerator
ADXL355_MEAS_TEMP_ON_DRDY_ON 
ADXL355_STDBY_TEMP_ON_DRDY_ON 
ADXL355_MEAS_TEMP_OFF_DRDY_ON 
ADXL355_STDBY_TEMP_OFF_DRDY_ON 
ADXL355_MEAS_TEMP_ON_DRDY_OFF 
ADXL355_STDBY_TEMP_ON_DRDY_OFF 
ADXL355_MEAS_TEMP_OFF_DRDY_OFF 
ADXL355_STDBY_TEMP_OFF_DRDY_OFF 

◆ adxl355_range

Enumerator
ADXL355_RANGE_2G 
ADXL359_RANGE_10G 
ADXL355_RANGE_4G 
ADXL359_RANGE_20G 
ADXL355_RANGE_8G 
ADXL359_RANGE_40G 

◆ adxl355_type

Enumerator
ID_ADXL355 
ID_ADXL357 
ID_ADXL359 

Function Documentation

◆ adxl355_conf_act_en()

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.

Parameters
dev- The device structure.
act_config- Activity enable mapping.
Returns
ret - Result of the configuration procedure.

◆ adxl355_conf_act_thr()

int adxl355_conf_act_thr ( struct adxl355_dev dev,
uint16_t  act_thr 
)

Configures the activity threshold registers.

Configures the activity threshold registers.

Parameters
dev- The device structure.
act_thr- Activity threshold value.
Returns
ret - Result of the configuration procedure.

◆ adxl355_config_int_pins()

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.

Parameters
dev- The device structure.
int_conf- Interrupt mapping.
Returns
ret - Result of the configuration procedure.

◆ adxl355_get_fifo_data()

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.

Parameters
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.
Returns
ret - Result of the configuration procedure.
Here is the caller graph for this function:

◆ adxl355_get_nb_of_fifo_entries()

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.

Parameters
dev- The device structure.
reg_value- Register value.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl355_get_op_mode()

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.

Parameters
dev- The device structure.
op_mode- Read operation mode.
Returns
ret - Result of the reading operation procedure.

◆ adxl355_get_raw_fifo_data()

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.

Parameters
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.
Returns
ret - Result of the configuration procedure.
Here is the caller graph for this function:

◆ adxl355_get_raw_temp()

int adxl355_get_raw_temp ( struct adxl355_dev dev,
uint16_t *  raw_temp 
)

Reads the raw temperature.

Reads the raw temperature data.

Parameters
dev- The device structure.
raw_temp- Raw temperature output data.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl355_get_raw_xyz()

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.

Parameters
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.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl355_get_sts_reg()

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.

Parameters
dev- The device structure.
status_flags- Register value.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl355_get_temp()

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.

Parameters
dev- The device structure.
temp- Temperature output data.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl355_get_xyz()

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.

Parameters
dev- The device structure.
x- X-axis's output data.
y- Y-axis's output data.
z- Z-axis's output data.
Returns
ret - Result of the reading procedure.
Here is the caller graph for this function:

◆ adxl355_init()

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.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
ret - Result of the initialization procedure.
Here is the caller graph for this function:

◆ adxl355_remove()

int adxl355_remove ( struct adxl355_dev dev)

Free the resources allocated by adxl355_init().

Free the resources allocated by adxl355_init().

Parameters
dev- The device structure.
Returns
ret - Result of the remove procedure.
Here is the caller graph for this function:

◆ adxl355_set_act_cnt_reg()

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.

Parameters
dev- The device structure.
act_cnt- Register value.
Returns
ret - Result of the writing procedure.

◆ adxl355_set_fifo_samples()

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.

Parameters
dev- The device structure.
reg_value- Register value.
Returns
ret - Result of the writing procedure.

◆ adxl355_set_hpf_corner()

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.

Parameters
dev- The device structure.
hpf_corner_val- High-pass filter settings.
Returns
ret - Result of the writing procedure.

◆ adxl355_set_int_pol()

int adxl355_set_int_pol ( struct adxl355_dev dev,
enum adxl355_int_pol  int_pol 
)

Sets the interrupt polarity.

Configures the interrupt polarity.

Parameters
dev- The device structure.
int_pol- Interrupt polarity to be set.
Returns
ret - Result of the reading procedure.

◆ adxl355_set_odr_lpf()

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.

Parameters
dev- The device structure.
odr_lpf_val- Low-pass filter settings.
Returns
ret - Result of the writing procedure.
Here is the caller graph for this function:

◆ adxl355_set_offset()

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).

Parameters
dev- The device structure.
x_offset- X-axis's offset.
y_offset- Y-axis's offset.
z_offset- Z-axis's offset.
Returns
ret - Result of the writing procedure.

◆ adxl355_set_op_mode()

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.

Parameters
dev- The device structure.
op_mode- Operation mode mode.
Returns
ret - Result of the setting operation procedure.
Here is the caller graph for this function:

◆ adxl355_set_range()

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.

Parameters
dev- The device structure.
range_val- Selected range.
Returns
ret - Result of the writing procedure.

◆ adxl355_set_self_test()

int adxl355_set_self_test ( struct adxl355_dev dev)

Triggers the self-test feature.

Triggers the self-test feature.

Parameters
dev- The device structure.
Returns
ret - Result of the writing procedure.

◆ adxl355_soft_reset()

int adxl355_soft_reset ( struct adxl355_dev dev)

Performs a soft reset of the device.

Performs soft reset of the device.

Parameters
dev- The device structure.
Returns
ret - Result of the soft reset procedure.
Here is the caller graph for this function: