no-OS
|
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include "adxl313.h"
#include "no_os_print_log.h"
#include "no_os_util.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
Functions | |
int | adxl313_read (struct adxl313_dev *dev, uint8_t base_address, uint16_t size, uint8_t *read_data) |
int | adxl313_write (struct adxl313_dev *dev, uint8_t base_address, uint16_t size, uint8_t *write_data) |
int | adxl313_reg_write_msk (struct adxl313_dev *dev, uint8_t reg_addr, uint8_t data, uint8_t mask) |
int | adxl313_init (struct adxl313_dev **device, struct adxl313_init_param init_param) |
int | adxl313_remove (struct adxl313_dev *dev) |
int | adxl313_software_reset (struct adxl313_dev *dev) |
int | adxl313_set_op_mode (struct adxl313_dev *dev, enum adxl313_op_mode op_mode) |
int | adxl313_get_op_mode (struct adxl313_dev *dev, enum adxl313_op_mode *op_mode) |
int | adxl313_set_offset (struct adxl313_dev *dev, int32_t offset_ug, enum adxl313_axis axis) |
int | adxl313_get_offset (struct adxl313_dev *dev, int32_t *offset_ug, enum adxl313_axis axis) |
int | adxl313_set_raw_offset (struct adxl313_dev *dev, int32_t offset_raw, enum adxl313_axis axis) |
int | adxl313_get_raw_offset (struct adxl313_dev *dev, int32_t *offset_raw, enum adxl313_axis axis) |
int | adxl313_get_raw_xyz (struct adxl313_dev *dev, int16_t *x_raw, int16_t *y_raw, int16_t *z_raw) |
int | adxl313_get_xyz (struct adxl313_dev *dev, struct adxl313_frac_repr *x_m_s2, struct adxl313_frac_repr *y_m_s2, struct adxl313_frac_repr *z_m_s2) |
int | adxl313_get_no_of_fifo_entries (struct adxl313_dev *dev, uint8_t *entries_no) |
int | adxl313_set_fifo_samples (struct adxl313_dev *dev, uint8_t samples_no) |
int | adxl313_set_fifo_mode (struct adxl313_dev *dev, enum adxl313_fifo_mode mode) |
int | adxl313_get_raw_fifo_data (struct adxl313_dev *dev, uint8_t *entries, int16_t *x_raw, int16_t *y_raw, int16_t *z_raw) |
int | adxl313_get_fifo_data (struct adxl313_dev *dev, uint8_t *entries, struct adxl313_frac_repr *x, struct adxl313_frac_repr *y, struct adxl313_frac_repr *z) |
int | adxl313_conf_act_thr (struct adxl313_dev *dev, uint32_t act_thr_ug) |
int | adxl313_get_act_thr (struct adxl313_dev *dev, uint32_t *act_thr_ug) |
int | adxl313_conf_inact_thr (struct adxl313_dev *dev, uint32_t inact_thr_ug) |
int | adxl313_get_inact_thr (struct adxl313_dev *dev, uint32_t *inact_thr_ug) |
int | adxl313_conf_time_inact (struct adxl313_dev *dev, uint8_t time_inact_s) |
int | adxl313_get_time_inact (struct adxl313_dev *dev, uint8_t *time_inact_s) |
int | adxl313_conf_act_inact_ctl (struct adxl313_dev *dev, union adxl313_act_inact_ctl_flags config) |
int | adxl313_get_conf_act_inact_ctl (struct adxl313_dev *dev, union adxl313_act_inact_ctl_flags *config) |
int | adxl313_set_activity_detection (struct adxl313_dev *dev, uint8_t act_axes, uint8_t act_ac_dc, uint32_t act_thresh_ug, uint8_t int_pin) |
Enable the activity detection. More... | |
int | adxl313_set_inactivity_detection (struct adxl313_dev *dev, uint8_t inact_axes, uint8_t inact_ac_dc, uint32_t inact_thresh_ug, uint8_t inact_time_s, uint8_t int_pin) |
Enables the inactivity detection. More... | |
int | adxl313_set_odr (struct adxl313_dev *dev, enum adxl313_odr odr) |
int | adxl313_get_odr (struct adxl313_dev *dev, enum adxl313_odr *odr) |
int | adxl313_disable_i2c (struct adxl313_dev *dev) |
int | adxl313_enable_i2c (struct adxl313_dev *dev) |
int | adxl313_set_low_power_mode (struct adxl313_dev *dev, enum bit_action enable) |
int | adxl313_set_autosleep_mode (struct adxl313_dev *dev, enum bit_action enable, uint8_t inact_thr, uint8_t time_inact_s) |
int | adxl313_link_mode_enable (struct adxl313_dev *dev) |
int | adxl313_link_mode_disable (struct adxl313_dev *dev) |
int | adxl313_sleep (struct adxl313_dev *dev, enum adxl313_wake_up_f wake_up_f_hz) |
int | adxl313_exit_sleep (struct adxl313_dev *dev) |
int | adxl313_conf_int_enable (struct adxl313_dev *dev, union adxl313_int_en_reg_flags en_ctl) |
int | adxl313_activity_int_enable (struct adxl313_dev *dev) |
int | adxl313_activity_int_disable (struct adxl313_dev *dev) |
int | adxl313_inactivity_int_enable (struct adxl313_dev *dev) |
int | adxl313_inactivity_int_disable (struct adxl313_dev *dev) |
int | adxl313_conf_int_map (struct adxl313_dev *dev, union adxl313_int_map_reg_flags int_map) |
int | adxl313_data_ready_int_map (struct adxl313_dev *dev, uint8_t int_pin) |
int | adxl313_activity_int_map (struct adxl313_dev *dev, uint8_t int_pin) |
int | adxl313_inactivity_int_map (struct adxl313_dev *dev, uint8_t int_pin) |
int | adxl313_watermark_int_map (struct adxl313_dev *dev, uint8_t int_pin) |
int | adxl313_overrun_int_map (struct adxl313_dev *dev, uint8_t int_pin) |
int | adxl313_get_int_source_reg (struct adxl313_dev *dev, union adxl313_int_src_reg_flags *int_status_flags) |
int | adxl313_set_int_pol (struct adxl313_dev *dev, enum adxl313_int_pol int_pol) |
int | adxl313_enable_full_res (struct adxl313_dev *dev) |
int | adxl313_disable_full_res (struct adxl313_dev *dev) |
int | adxl313_get_full_res_setting (struct adxl313_dev *dev, uint8_t *full_res) |
int | adxl313_set_range (struct adxl313_dev *dev, enum adxl313_range range) |
int | adxl313_get_range (struct adxl313_dev *dev, enum adxl313_range *range) |
int | adxl313_self_test (struct adxl313_dev *dev) |
int adxl313_activity_int_disable | ( | struct adxl313_dev * | dev | ) |
Configure interrupt disable control for activity.
int adxl313_activity_int_enable | ( | struct adxl313_dev * | dev | ) |
Configure interrupt enable control for activity.
int adxl313_activity_int_map | ( | struct adxl313_dev * | dev, |
uint8_t | int_pin | ||
) |
Set pin for activity interrupt.
int adxl313_conf_act_inact_ctl | ( | struct adxl313_dev * | dev, |
union adxl313_act_inact_ctl_flags | config | ||
) |
Configure the ACT AC/DC and INACT AC/DC bits.
int adxl313_conf_act_thr | ( | struct adxl313_dev * | dev, |
uint32_t | act_thr_ug | ||
) |
Configure the activity threshold register.
int adxl313_conf_inact_thr | ( | struct adxl313_dev * | dev, |
uint32_t | inact_thr_ug | ||
) |
Configure the inactivity threshold register.
int adxl313_conf_int_enable | ( | struct adxl313_dev * | dev, |
union adxl313_int_en_reg_flags | en_ctl | ||
) |
Configure interrupt enable control.
int adxl313_conf_int_map | ( | struct adxl313_dev * | dev, |
union adxl313_int_map_reg_flags | int_map | ||
) |
Configure interrupt mapping control.
int adxl313_conf_time_inact | ( | struct adxl313_dev * | dev, |
uint8_t | time_inact_s | ||
) |
Configure the time inactivity threshold register.
int adxl313_data_ready_int_map | ( | struct adxl313_dev * | dev, |
uint8_t | int_pin | ||
) |
Set pin for DATA_READY interrupt.
int adxl313_disable_full_res | ( | struct adxl313_dev * | dev | ) |
Disable full resolution for the ADXL312/ADXL313 device.
int adxl313_disable_i2c | ( | struct adxl313_dev * | dev | ) |
Disable I2C.
int adxl313_enable_full_res | ( | struct adxl313_dev * | dev | ) |
Enable full resolution for the ADXL312/ADXL313 device.
int adxl313_enable_i2c | ( | struct adxl313_dev * | dev | ) |
Enable I2C.
int adxl313_exit_sleep | ( | struct adxl313_dev * | dev | ) |
Exit Sleep mode.
int adxl313_get_act_thr | ( | struct adxl313_dev * | dev, |
uint32_t * | act_thr_ug | ||
) |
Get the value saved in the activity threshold register.
int adxl313_get_conf_act_inact_ctl | ( | struct adxl313_dev * | dev, |
union adxl313_act_inact_ctl_flags * | config | ||
) |
Get the ACT AC/DC and INACT AC/DC bits.
int adxl313_get_fifo_data | ( | struct adxl313_dev * | dev, |
uint8_t * | entries, | ||
struct adxl313_frac_repr * | x, | ||
struct adxl313_frac_repr * | y, | ||
struct adxl313_frac_repr * | z | ||
) |
Read converted values from FIFO.
int adxl313_get_full_res_setting | ( | struct adxl313_dev * | dev, |
uint8_t * | full_res | ||
) |
Get the ADXL312/ADXL313 FULL_RES setting.
int adxl313_get_inact_thr | ( | struct adxl313_dev * | dev, |
uint32_t * | inact_thr_ug | ||
) |
Get the value in the inactivity threshold register.
int adxl313_get_int_source_reg | ( | struct adxl313_dev * | dev, |
union adxl313_int_src_reg_flags * | int_status_flags | ||
) |
Read the INT_SOURCE register value.
int adxl313_get_no_of_fifo_entries | ( | struct adxl313_dev * | dev, |
uint8_t * | entries_no | ||
) |
Read the number of FIFO entries register value.
int adxl313_get_odr | ( | struct adxl313_dev * | dev, |
enum adxl313_odr * | odr | ||
) |
Get output data rate (ODR).
int adxl313_get_offset | ( | struct adxl313_dev * | dev, |
int32_t * | offset_ug, | ||
enum adxl313_axis | axis | ||
) |
Get offset for each axis.
int adxl313_get_op_mode | ( | struct adxl313_dev * | dev, |
enum adxl313_op_mode * | op_mode | ||
) |
Get the current operation mode of the device.
int adxl313_get_range | ( | struct adxl313_dev * | dev, |
enum adxl313_range * | range | ||
) |
Get the ADXL312/ADXL313 device range.
int adxl313_get_raw_fifo_data | ( | struct adxl313_dev * | dev, |
uint8_t * | entries, | ||
int16_t * | x_raw, | ||
int16_t * | y_raw, | ||
int16_t * | z_raw | ||
) |
Read FIFO data and return the raw values.
int adxl313_get_raw_offset | ( | struct adxl313_dev * | dev, |
int32_t * | offset_raw, | ||
enum adxl313_axis | axis | ||
) |
Get raw offset for each axis.
int adxl313_get_raw_xyz | ( | struct adxl313_dev * | dev, |
int16_t * | x_raw, | ||
int16_t * | y_raw, | ||
int16_t * | z_raw | ||
) |
Read the 3-axis raw data from the accelerometer.
int adxl313_get_time_inact | ( | struct adxl313_dev * | dev, |
uint8_t * | time_inact_s | ||
) |
Get the value of the time inactivity threshold register.
int adxl313_get_xyz | ( | struct adxl313_dev * | dev, |
struct adxl313_frac_repr * | x_m_s2, | ||
struct adxl313_frac_repr * | y_m_s2, | ||
struct adxl313_frac_repr * | z_m_s2 | ||
) |
Read the raw output data of each axis and convert it to m/s^2.
int adxl313_inactivity_int_disable | ( | struct adxl313_dev * | dev | ) |
Configure interrupt disable control for inactivity.
int adxl313_inactivity_int_enable | ( | struct adxl313_dev * | dev | ) |
Configure interrupt enable control for inactivity.
int adxl313_inactivity_int_map | ( | struct adxl313_dev * | dev, |
uint8_t | int_pin | ||
) |
Set pin for inactivity interrupt.
int adxl313_init | ( | struct adxl313_dev ** | device, |
struct adxl313_init_param | init_param | ||
) |
Init. the comm. peripheral and check if the ADXL313 is present.
int adxl313_link_mode_disable | ( | struct adxl313_dev * | dev | ) |
Disable Link Mode for activity inactivity functions.
int adxl313_link_mode_enable | ( | struct adxl313_dev * | dev | ) |
Enable Link Mode for activity inactivity functions.
int adxl313_overrun_int_map | ( | struct adxl313_dev * | dev, |
uint8_t | int_pin | ||
) |
Set pin for overrun interrupt.
int adxl313_read | ( | struct adxl313_dev * | dev, |
uint8_t | base_address, | ||
uint16_t | size, | ||
uint8_t * | read_data | ||
) |
int adxl313_reg_write_msk | ( | struct adxl313_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | data, | ||
uint8_t | mask | ||
) |
int adxl313_remove | ( | struct adxl313_dev * | dev | ) |
int adxl313_self_test | ( | struct adxl313_dev * | dev | ) |
int adxl313_set_activity_detection | ( | struct adxl313_dev * | dev, |
uint8_t | act_axes, | ||
uint8_t | act_ac_dc, | ||
uint32_t | act_thresh_ug, | ||
uint8_t | int_pin | ||
) |
Enable the activity detection.
dev | - The device structure. |
act_axes | - Axes which participate in detecting activity (ORed together). Example: 0x0 - disables axes participation. ADXL313_X_EN - enables x-axis participation. ADXL313_Y_EN - enables y-axis participation. ADXL313_Z_EN - enables z-axis participation. |
act_ac_dc | - Selects dc-coupled or ac-coupled operation. Example: 0x00 - dc-coupled operation. 0x01 - ac-coupled operation. |
act_thresh_ug | - Threshold value for detecting activity. The scale factor is 15625 ug/LSB for ADXL313 and 780000 ug/LSB for ADXL314. |
int_pin | - Interrupts pin. Example: 0x00 - activity interrupts on INT1 pin. 0x01 - activity interrupts on INT2 pin. |
int adxl313_set_autosleep_mode | ( | struct adxl313_dev * | dev, |
enum bit_action | enable, | ||
uint8_t | inact_thr, | ||
uint8_t | time_inact_s | ||
) |
Activate/Deactivate AUTOSLEEP.
int adxl313_set_fifo_mode | ( | struct adxl313_dev * | dev, |
enum adxl313_fifo_mode | mode | ||
) |
Set FIFO mode.
int adxl313_set_fifo_samples | ( | struct adxl313_dev * | dev, |
uint8_t | samples_no | ||
) |
Set the number of FIFO samples register value.
int adxl313_set_inactivity_detection | ( | struct adxl313_dev * | dev, |
uint8_t | inact_axes, | ||
uint8_t | inact_ac_dc, | ||
uint32_t | inact_thresh_ug, | ||
uint8_t | inact_time_s, | ||
uint8_t | int_pin | ||
) |
Enables the inactivity detection.
dev | - The device structure. |
inact_axes | - Axes which participate in detecting inactivity. Example: 0x0 - disables axes participation. ADXL313_X_EN - enables x-axis participation. ADXL313_Y_EN - enables y-axis participation. ADXL313_Z_EN - enables z-axis participation. |
inact_ac_dc | - Selects dc-coupled or ac-coupled operation. Example: 0x00 - dc-coupled operation. 0x01 - ac-coupled operation. |
inact_thresh_ug | - Threshold value for detecting inactivity. The scale factor is 62.5 mg/LSB. |
inact_time_s | - Inactivity time. The scale factor is 1 sec/LSB. |
int_pin | - Interrupts pin. Example: 0x00 - activity interrupts on INT1 pin. 0x01 - activity interrupts on INT2 pin. |
int adxl313_set_int_pol | ( | struct adxl313_dev * | dev, |
enum adxl313_int_pol | int_pol | ||
) |
Configure the interrupt polarity.
int adxl313_set_low_power_mode | ( | struct adxl313_dev * | dev, |
enum bit_action | enable | ||
) |
Activate/Deactivate LOW_POWER.
int adxl313_set_odr | ( | struct adxl313_dev * | dev, |
enum adxl313_odr | odr | ||
) |
Set output data rate (ODR).
int adxl313_set_offset | ( | struct adxl313_dev * | dev, |
int32_t | offset_ug, | ||
enum adxl313_axis | axis | ||
) |
Set offset for each axis.
int adxl313_set_op_mode | ( | struct adxl313_dev * | dev, |
enum adxl313_op_mode | op_mode | ||
) |
Place the device into the given operation mode.
int adxl313_set_range | ( | struct adxl313_dev * | dev, |
enum adxl313_range | range | ||
) |
Set the ADXL312/ADXL313 device range.
int adxl313_set_raw_offset | ( | struct adxl313_dev * | dev, |
int32_t | offset_raw, | ||
enum adxl313_axis | axis | ||
) |
Set raw offset for each axis.
int adxl313_sleep | ( | struct adxl313_dev * | dev, |
enum adxl313_wake_up_f | wake_up_f_hz | ||
) |
Put device in Sleep mode.
int adxl313_software_reset | ( | struct adxl313_dev * | dev | ) |
Reset the device via communication.
int adxl313_watermark_int_map | ( | struct adxl313_dev * | dev, |
uint8_t | int_pin | ||
) |
Set pin for watermark interrupt.
int adxl313_write | ( | struct adxl313_dev * | dev, |
uint8_t | base_address, | ||
uint16_t | size, | ||
uint8_t * | write_data | ||
) |