![]() |
no-OS
|
Implementation of ADXL362 Driver. More...
Functions | |
| 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. | |
| int32_t | adxl362_remove (struct adxl362_dev *dev) |
| Free the resources allocated by adxl362_init(). | |
| 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. | |
| 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. | |
| 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. | |
| void | adxl362_software_reset (struct adxl362_dev *dev) |
| Resets the device via SPI communication bus. | |
| void | adxl362_set_power_mode (struct adxl362_dev *dev, uint8_t pwr_mode) |
| Places the device into standby/measure mode. | |
| void | adxl362_set_range (struct adxl362_dev *dev, uint8_t g_range) |
| Selects the measurement range. | |
| void | adxl362_set_output_rate (struct adxl362_dev *dev, uint8_t out_rate) |
| Selects the Output Data Rate of the device. | |
| 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. | |
| 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. | |
| float | adxl362_read_temperature (struct adxl362_dev *dev) |
| Reads the temperature of the device. | |
| 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. | |
| void | adxl362_setup_activity_detection (struct adxl362_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint8_t time) |
| Configures activity detection. | |
| void | adxl362_setup_inactivity_detection (struct adxl362_dev *dev, uint8_t ref_or_abs, uint16_t threshold, uint16_t time) |
| Configures inactivity detection. | |
Implementation of ADXL362 Driver.
Copyright 2012(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| 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.
| dev | - The device structure. |
| mode | - Mode selection. Example: ADXL362_FIFO_DISABLE - FIFO is disabled. ADXL362_FIFO_OLDEST_SAVED - Oldest saved mode. ADXL362_FIFO_STREAM - Stream mode. ADXL362_FIFO_TRIGGERED - Triggered mode. |
| water_mark_lvl | - Specifies the number of samples to store in the FIFO. |
| en_temp_read | - Store Temperature Data to FIFO. Example: 1 - temperature data is stored in the FIFO together with x-, y- and x-axis data. 0 - temperature data is skipped. |
| 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.
| dev | - The device structure. |
| buffer | - Stores the read bytes. |
| bytes_number | - Number of bytes to read. |
| 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.
| dev | - The device structure. |
| x | - Stores the X-axis data. |
| y | - Stores the Y-axis data. |
| z | - Stores the Z-axis data. |
| 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.
| dev | - The device structure. |
| read_data | - The read values are stored in this buffer. |
| register_address | - The start address of the burst read. |
| bytes_number | - Number of bytes to read. |
| 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.
| dev | - The device structure. |
| x | - Stores the X-axis data(as two's complement). |
| y | - Stores the Y-axis data(as two's complement). |
| z | - Stores the Z-axis data(as two's complement). |
| 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.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| float adxl362_read_temperature | ( | struct adxl362_dev * | dev | ) |
Reads the temperature of the device.
| dev | - The device structure. |
| int32_t adxl362_remove | ( | struct adxl362_dev * | dev | ) |
Free the resources allocated by adxl362_init().
| dev | - The device structure. |
| void adxl362_set_output_rate | ( | struct adxl362_dev * | dev, |
| uint8_t | out_rate ) |
Selects the Output Data Rate of the device.
| dev | - The device structure. |
| out_rate | - Output Data Rate option. Example: ADXL362_ODR_12_5_HZ - 12.5Hz ADXL362_ODR_25_HZ - 25Hz ADXL362_ODR_50_HZ - 50Hz ADXL362_ODR_100_HZ - 100Hz ADXL362_ODR_200_HZ - 200Hz ADXL362_ODR_400_HZ - 400Hz |
| void adxl362_set_power_mode | ( | struct adxl362_dev * | dev, |
| uint8_t | pwr_mode ) |
Places the device into standby/measure mode.
| dev | - The device structure. |
| pwr_mode | - Power mode. Example: 0 - standby mode. 1 - measure mode. |
| void adxl362_set_range | ( | struct adxl362_dev * | dev, |
| uint8_t | g_range ) |
Selects the measurement range.
| dev | - The device structure. |
| g_range | - Range option. Example: ADXL362_RANGE_2G - +-2 g ADXL362_RANGE_4G - +-4 g ADXL362_RANGE_8G - +-8 g |
| 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.
| dev | - The device structure. |
| register_value | - Data value to write. |
| register_address | - Address of the register. |
| bytes_number | - Number of bytes. Accepted values: 0 - 1. |
| void adxl362_setup_activity_detection | ( | struct adxl362_dev * | dev, |
| uint8_t | ref_or_abs, | ||
| uint16_t | threshold, | ||
| uint8_t | time ) |
Configures activity detection.
| dev | - The device structure. |
| ref_or_abs | - Referenced/Absolute Activity Select. Example: 0 - absolute mode. 1 - referenced mode. |
| threshold | - 11-bit unsigned value that the adxl362 samples are compared to. |
| time | - 8-bit value written to the activity timer register. The amount of time (in seconds) is: time / ODR, where ODR - is the output data rate. |
| void adxl362_setup_inactivity_detection | ( | struct adxl362_dev * | dev, |
| uint8_t | ref_or_abs, | ||
| uint16_t | threshold, | ||
| uint16_t | time ) |
Configures inactivity detection.
| dev | - The device structure. |
| ref_or_abs | - Referenced/Absolute Inactivity Select. Example: 0 - absolute mode. 1 - referenced mode. |
| threshold | - 11-bit unsigned value that the adxl362 samples are compared to. |
| time | - 16-bit value written to the inactivity timer register. The amount of time (in seconds) is: time / ODR, where ODR - is the output data rate. |
| void adxl362_software_reset | ( | struct adxl362_dev * | dev | ) |
Resets the device via SPI communication bus.
| dev | - The device structure. |