Go to the documentation of this file.
48 #define ADXL362_WRITE_REG 0x0A
49 #define ADXL362_READ_REG 0x0B
50 #define ADXL362_WRITE_FIFO 0x0D
53 #define ADXL362_REG_DEVID_AD 0x00
54 #define ADXL362_REG_DEVID_MST 0x01
55 #define ADXL362_REG_PARTID 0x02
56 #define ADXL362_REG_REVID 0x03
57 #define ADXL362_REG_XDATA 0x08
58 #define ADXL362_REG_YDATA 0x09
59 #define ADXL362_REG_ZDATA 0x0A
60 #define ADXL362_REG_STATUS 0x0B
61 #define ADXL362_REG_FIFO_L 0x0C
62 #define ADXL362_REG_FIFO_H 0x0D
63 #define ADXL362_REG_XDATA_L 0x0E
64 #define ADXL362_REG_XDATA_H 0x0F
65 #define ADXL362_REG_YDATA_L 0x10
66 #define ADXL362_REG_YDATA_H 0x11
67 #define ADXL362_REG_ZDATA_L 0x12
68 #define ADXL362_REG_ZDATA_H 0x13
69 #define ADXL362_REG_TEMP_L 0x14
70 #define ADXL362_REG_TEMP_H 0x15
71 #define ADXL362_REG_SOFT_RESET 0x1F
72 #define ADXL362_REG_THRESH_ACT_L 0x20
73 #define ADXL362_REG_THRESH_ACT_H 0x21
74 #define ADXL362_REG_TIME_ACT 0x22
75 #define ADXL362_REG_THRESH_INACT_L 0x23
76 #define ADXL362_REG_THRESH_INACT_H 0x24
77 #define ADXL362_REG_TIME_INACT_L 0x25
78 #define ADXL362_REG_TIME_INACT_H 0x26
79 #define ADXL362_REG_ACT_INACT_CTL 0x27
80 #define ADXL362_REG_FIFO_CTL 0x28
81 #define ADXL362_REG_FIFO_SAMPLES 0x29
82 #define ADXL362_REG_INTMAP1 0x2A
83 #define ADXL362_REG_INTMAP2 0x2B
84 #define ADXL362_REG_FILTER_CTL 0x2C
85 #define ADXL362_REG_POWER_CTL 0x2D
86 #define ADXL362_REG_SELF_TEST 0x2E
89 #define ADXL362_STATUS_ERR_USER_REGS (1 << 7)
90 #define ADXL362_STATUS_AWAKE (1 << 6)
91 #define ADXL362_STATUS_INACT (1 << 5)
92 #define ADXL362_STATUS_ACT (1 << 4)
93 #define ADXL362_STATUS_FIFO_OVERRUN (1 << 3)
94 #define ADXL362_STATUS_FIFO_WATERMARK (1 << 2)
95 #define ADXL362_STATUS_FIFO_RDY (1 << 1)
96 #define ADXL362_STATUS_DATA_RDY (1 << 0)
99 #define ADXL362_ACT_INACT_CTL_LINKLOOP(x) (((x) & 0x3) << 4)
100 #define ADXL362_ACT_INACT_CTL_INACT_REF (1 << 3)
101 #define ADXL362_ACT_INACT_CTL_INACT_EN (1 << 2)
102 #define ADXL362_ACT_INACT_CTL_ACT_REF (1 << 1)
103 #define ADXL362_ACT_INACT_CTL_ACT_EN (1 << 0)
106 #define ADXL362_MODE_DEFAULT 0
107 #define ADXL362_MODE_LINK 1
108 #define ADXL362_MODE_LOOP 3
111 #define ADXL362_FIFO_CTL_AH (1 << 3)
112 #define ADXL362_FIFO_CTL_FIFO_TEMP (1 << 2)
113 #define ADXL362_FIFO_CTL_FIFO_MODE(x) (((x) & 0x3) << 0)
116 #define ADXL362_FIFO_DISABLE 0
117 #define ADXL362_FIFO_OLDEST_SAVED 1
118 #define ADXL362_FIFO_STREAM 2
119 #define ADXL362_FIFO_TRIGGERED 3
122 #define ADXL362_INTMAP1_INT_LOW (1 << 7)
123 #define ADXL362_INTMAP1_AWAKE (1 << 6)
124 #define ADXL362_INTMAP1_INACT (1 << 5)
125 #define ADXL362_INTMAP1_ACT (1 << 4)
126 #define ADXL362_INTMAP1_FIFO_OVERRUN (1 << 3)
127 #define ADXL362_INTMAP1_FIFO_WATERMARK (1 << 2)
128 #define ADXL362_INTMAP1_FIFO_READY (1 << 1)
129 #define ADXL362_INTMAP1_DATA_READY (1 << 0)
132 #define ADXL362_INTMAP2_INT_LOW (1 << 7)
133 #define ADXL362_INTMAP2_AWAKE (1 << 6)
134 #define ADXL362_INTMAP2_INACT (1 << 5)
135 #define ADXL362_INTMAP2_ACT (1 << 4)
136 #define ADXL362_INTMAP2_FIFO_OVERRUN (1 << 3)
137 #define ADXL362_INTMAP2_FIFO_WATERMARK (1 << 2)
138 #define ADXL362_INTMAP2_FIFO_READY (1 << 1)
139 #define ADXL362_INTMAP2_DATA_READY (1 << 0)
142 #define ADXL362_FILTER_CTL_RANGE(x) (((x) & 0x3) << 6)
143 #define ADXL362_FILTER_CTL_RES (1 << 5)
144 #define ADXL362_FILTER_CTL_HALF_BW (1 << 4)
145 #define ADXL362_FILTER_CTL_EXT_SAMPLE (1 << 3)
146 #define ADXL362_FILTER_CTL_ODR(x) (((x) & 0x7) << 0)
149 #define ADXL362_RANGE_2G 0
150 #define ADXL362_RANGE_4G 1
151 #define ADXL362_RANGE_8G 2
154 #define ADXL362_ODR_12_5_HZ 0
155 #define ADXL362_ODR_25_HZ 1
156 #define ADXL362_ODR_50_HZ 2
157 #define ADXL362_ODR_100_HZ 3
158 #define ADXL362_ODR_200_HZ 4
159 #define ADXL362_ODR_400_HZ 5
162 #define ADXL362_POWER_CTL_RES (1 << 7)
163 #define ADXL362_POWER_CTL_EXT_CLK (1 << 6)
164 #define ADXL362_POWER_CTL_LOW_NOISE(x) (((x) & 0x3) << 4)
165 #define ADXL362_POWER_CTL_WAKEUP (1 << 3)
166 #define ADXL362_POWER_CTL_AUTOSLEEP (1 << 2)
167 #define ADXL362_POWER_CTL_MEASURE(x) (((x) & 0x3) << 0)
170 #define ADXL362_NOISE_MODE_NORMAL 0
171 #define ADXL362_NOISE_MODE_LOW 1
172 #define ADXL362_NOISE_MODE_ULTRALOW 2
175 #define ADXL362_MEASURE_STANDBY 0
176 #define ADXL362_MEASURE_ON 2
179 #define ADXL362_SELF_TEST_ST (1 << 0)
182 #define ADXL362_DEVICE_AD 0xAD
183 #define ADXL362_DEVICE_MST 0x1D
184 #define ADXL362_PART_ID 0xF2
187 #define ADXL362_RESET_KEY 0x52
226 uint16_t register_value,
227 uint8_t register_address,
228 uint8_t bytes_number);
233 uint8_t register_address,
234 uint8_t bytes_number);
239 uint16_t bytes_number);
274 uint16_t water_mark_lvl,
275 uint8_t en_temp_read);
void adxl362_software_reset(struct adxl362_dev *dev)
Resets the device via SPI communication bus.
Definition: adxl362.c:189
Header file for iio_trigger.
#define ADXL362_REG_TEMP_L
Definition: adxl362.h:69
#define ADXL362_REG_THRESH_ACT_L
Definition: adxl362.h:72
void adxl362_fifo_setup(struct adxl362_dev *dev, uint8_t mode, uint16_t water_mark_lvl, uint8_t en_temp_read)
Configures the FIFO feature.
Definition: adxl362.c:383
void adxl362_setup_activity_detection(struct adxl362_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint8_t time)
Configures activity detection.
Definition: adxl362.c:418
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
#define ADXL362_POWER_CTL_MEASURE(x)
Definition: adxl362.h:167
ADXL362 Device structure.
Definition: adxl362.h:197
float adxl362_read_temperature(struct adxl362_dev *dev)
Reads the temperature of the device.
Definition: adxl362.c:350
Header file of SPI Interface.
#define ADXL362_MEASURE_ON
Definition: adxl362.h:176
#define ADXL362_REG_THRESH_INACT_L
Definition: adxl362.h:75
struct iio_trigger adxl355_iio_trig_desc
Definition: iio_adxl355_trig.c:44
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:127
#define ADXL362_WRITE_FIFO
Definition: adxl362.h:50
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
#define ADXL362_ACT_INACT_CTL_INACT_EN
Definition: adxl362.h:101
Definition: ad9361_util.h:69
void adxl362_set_output_rate(struct adxl362_dev *dev, uint8_t out_rate)
Selects the Output Data Rate of the device.
Definition: adxl362.c:270
void adxl362_set_register_value(struct adxl362_dev *dev, uint16_t register_value, uint8_t register_address, uint8_t bytes_number)
Writes data into a register.
Definition: adxl362.c:109
void adxl362_get_xyz(struct adxl362_dev *dev, int16_t *x, int16_t *y, int16_t *z)
Reads the 3-axis raw data from the accelerometer.
Definition: adxl362.c:298
void adxl362_get_xyz(struct adxl362_dev *dev, int16_t *x, int16_t *y, int16_t *z)
Reads the 3-axis raw data from the accelerometer.
Definition: adxl362.c:298
#define ADXL362_RESET_KEY
Definition: adxl362.h:187
#define ADXL362_FIFO_CTL_FIFO_TEMP
Definition: adxl362.h:112
void adxl362_get_g_xyz(struct adxl362_dev *dev, float *x, float *y, float *z)
Reads the 3-axis raw data from the accelerometer and converts it to g.
Definition: adxl362.c:324
#define ADXL362_PART_ID
Definition: adxl362.h:184
#define ADXL362_FILTER_CTL_RANGE(x)
Definition: adxl362.h:142
#define ADXL362_REG_POWER_CTL
Definition: adxl362.h:85
void adxl362_get_fifo_value(struct adxl362_dev *dev, uint8_t *buffer, uint16_t bytes_number)
Reads multiple bytes from the device's FIFO buffer.
Definition: adxl362.c:164
float adxl362_read_temperature(struct adxl362_dev *dev)
Reads the temperature of the device.
Definition: adxl362.c:350
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:110
#define ADXL362_REG_FIFO_CTL
Definition: adxl362.h:80
Structure holding the parameters for ADXL362 device initialization.
Definition: adxl362.h:208
#define ADXL362_ACT_INACT_CTL_ACT_EN
Definition: adxl362.h:103
#define ADXL362_REG_SOFT_RESET
Definition: adxl362.h:71
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
void adxl362_get_register_value(struct adxl362_dev *dev, uint8_t *read_data, uint8_t register_address, uint8_t bytes_number)
Performs a burst read of a specified number of registers.
Definition: adxl362.c:135
#define ADXL362_REG_ACT_INACT_CTL
Definition: adxl362.h:79
void adxl362_set_register_value(struct adxl362_dev *dev, uint16_t register_value, uint8_t register_address, uint8_t bytes_number)
Writes data into a register.
Definition: adxl362.c:109
struct no_os_spi_init_param spi_init
Definition: adxl362.h:210
void adxl362_get_register_value(struct adxl362_dev *dev, uint8_t *read_data, uint8_t register_address, uint8_t bytes_number)
Performs a burst read of a specified number of registers.
Definition: adxl362.c:135
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
int32_t adxl362_init(struct adxl362_dev **device, struct adxl362_init_param init_param)
Initializes communication with the device and checks if the part is present by reading the device id.
Definition: adxl362.c:56
uint8_t selected_range
Definition: adxl362.h:201
void adxl362_get_g_xyz(struct adxl362_dev *dev, float *x, float *y, float *z)
Reads the 3-axis raw data from the accelerometer and converts it to g.
Definition: adxl362.c:324
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
#define ADXL362_REG_PARTID
Definition: adxl362.h:55
#define ADXL362_FIFO_CTL_FIFO_MODE(x)
Definition: adxl362.h:113
void adxl362_fifo_setup(struct adxl362_dev *dev, uint8_t mode, uint16_t water_mark_lvl, uint8_t en_temp_read)
Configures the FIFO feature.
Definition: adxl362.c:383
Definition: iio_types.h:231
void adxl362_get_fifo_value(struct adxl362_dev *dev, uint8_t *buffer, uint16_t bytes_number)
Reads multiple bytes from the device's FIFO buffer.
Definition: adxl362.c:164
void adxl362_setup_inactivity_detection(struct adxl362_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint16_t time)
Configures inactivity detection.
Definition: adxl362.c:465
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
void adxl362_setup_activity_detection(struct adxl362_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint8_t time)
Configures activity detection.
Definition: adxl362.c:418
void adxl362_set_range(struct adxl362_dev *dev, uint8_t g_range)
Selects the measurement range.
Definition: adxl362.c:237
void adxl362_set_output_rate(struct adxl362_dev *dev, uint8_t out_rate)
Selects the Output Data Rate of the device.
Definition: adxl362.c:270
#define ADXL362_REG_TIME_INACT_L
Definition: adxl362.h:77
int32_t adxl362_init(struct adxl362_dev **device, struct adxl362_init_param init_param)
Initializes communication with the device and checks if the part is present by reading the device id.
Definition: adxl362.c:56
void adxl362_set_power_mode(struct adxl362_dev *dev, uint8_t pwr_mode)
Places the device into standby/measure mode.
Definition: adxl362.c:207
#define ADXL362_WRITE_REG
Definition: adxl362.h:48
int32_t adxl362_remove(struct adxl362_dev *dev)
Free the resources allocated by adxl362_init().
Definition: adxl362.c:88
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
Header file of ADXL362 Driver.
void adxl362_set_power_mode(struct adxl362_dev *dev, uint8_t pwr_mode)
Places the device into standby/measure mode.
Definition: adxl362.c:207
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
#define ADXL362_REG_FIFO_SAMPLES
Definition: adxl362.h:81
bool is_synchronous
Definition: iio_types.h:234
#define ADXL362_REG_FILTER_CTL
Definition: adxl362.h:84
void adxl362_setup_inactivity_detection(struct adxl362_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint16_t time)
Configures inactivity detection.
Definition: adxl362.c:465
#define ADXL362_ACT_INACT_CTL_ACT_REF
Definition: adxl362.h:102
void adxl362_set_range(struct adxl362_dev *dev, uint8_t g_range)
Selects the measurement range.
Definition: adxl362.c:237
void adxl362_software_reset(struct adxl362_dev *dev)
Resets the device via SPI communication bus.
Definition: adxl362.c:189
#define ADXL362_FILTER_CTL_ODR(x)
Definition: adxl362.h:146
#define ADXL362_READ_REG
Definition: adxl362.h:49
int32_t adxl362_remove(struct adxl362_dev *dev)
Free the resources allocated by adxl362_init().
Definition: adxl362.c:88
#define ADXL362_REG_TIME_ACT
Definition: adxl362.h:74
#define ADXL362_ACT_INACT_CTL_INACT_REF
Definition: adxl362.h:100
struct no_os_spi_desc * spi_desc
Definition: adxl362.h:199
#define ADXL362_REG_XDATA_L
Definition: adxl362.h:63
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140