LibDriver ADXL362
Loading...
Searching...
No Matches
driver_adxl362.c File Reference

driver adxl362 source file More...

#include "driver_adxl362.h"
Include dependency graph for driver_adxl362.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Analog Devices ADXL362"
 chip register definition
#define MANUFACTURER_NAME   "Analog Devices"
#define SUPPLY_VOLTAGE_MIN   1.6f
#define SUPPLY_VOLTAGE_MAX   3.5f
#define MAX_CURRENT   0.013f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define ADXL362_REG_DEVID_AD   0x00
 chip register definition
#define ADXL362_REG_DEVID_MST   0x01
#define ADXL362_REG_PARTID   0x02
#define ADXL362_REG_REVID   0x03
#define ADXL362_REG_XDATA   0x08
#define ADXL362_REG_YDATA   0x09
#define ADXL362_REG_ZDATA   0x0A
#define ADXL362_REG_STATUS   0x0B
#define ADXL362_REG_FIFO_ENTRIES_L   0x0C
#define ADXL362_REG_FIFO_ENTRIES_H   0x0D
#define ADXL362_REG_XDATA_L   0x0E
#define ADXL362_REG_XDATA_H   0x0F
#define ADXL362_REG_YDATA_L   0x10
#define ADXL362_REG_YDATA_H   0x11
#define ADXL362_REG_ZDATA_L   0x12
#define ADXL362_REG_ZDATA_H   0x13
#define ADXL362_REG_TEMP_L   0x14
#define ADXL362_REG_TEMP_H   0x15
#define ADXL362_REG_SOFT_RESET   0x1F
#define ADXL362_REG_THRESH_ACT_L   0x20
#define ADXL362_REG_THRESH_ACT_H   0x21
#define ADXL362_REG_TIME_ACT   0x22
#define ADXL362_REG_THRESH_INACT_L   0x23
#define ADXL362_REG_THRESH_INACT_H   0x24
#define ADXL362_REG_TIME_INACT_L   0x25
#define ADXL362_REG_TIME_INACT_H   0x26
#define ADXL362_REG_ACT_INACT_CTL   0x27
#define ADXL362_REG_FIFO_CONTROL   0x28
#define ADXL362_REG_FIFO_SAMPLES   0x29
#define ADXL362_REG_INTMAP1   0x2A
#define ADXL362_REG_INTMAP2   0x2B
#define ADXL362_REG_FILTER_CTL   0x2C
#define ADXL362_REG_POWER_CTL   0x2D
#define ADXL362_REG_SELF_TEST   0x2E

Functions

uint8_t adxl362_get_revision (adxl362_handle_t *handle, uint8_t *id)
 get the chip revision
uint8_t adxl362_init (adxl362_handle_t *handle)
 initialize the chip
uint8_t adxl362_deinit (adxl362_handle_t *handle)
 close the chip
uint8_t adxl362_read_8msb (adxl362_handle_t *handle, int8_t raw[3], float g[3])
 read the data with eight most significant bits
uint8_t adxl362_read_temperature (adxl362_handle_t *handle, int16_t *raw, float *temp)
 read the temperature
uint8_t adxl362_get_status (adxl362_handle_t *handle, uint8_t *status)
 get the chip status
uint8_t adxl362_get_fifo_counter (adxl362_handle_t *handle, uint16_t *counter)
 get the fifo counter
uint8_t adxl362_soft_reset (adxl362_handle_t *handle)
 soft reset
uint8_t adxl362_set_fifo_temperature (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable saving temperature data to fifo
uint8_t adxl362_get_fifo_temperature (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the fifo temperature status
uint8_t adxl362_set_fifo_mode (adxl362_handle_t *handle, adxl362_fifo_mode_t mode)
 set the fifo mode
uint8_t adxl362_get_fifo_mode (adxl362_handle_t *handle, adxl362_fifo_mode_t *mode)
 get the fifo mode
uint8_t adxl362_set_fifo_sample (adxl362_handle_t *handle, uint16_t sample)
 set the fifo sample
uint8_t adxl362_get_fifo_sample (adxl362_handle_t *handle, uint16_t *sample)
 get the fifo sample
uint8_t adxl362_set_interrupt_pin1_active_level (adxl362_handle_t *handle, adxl362_interrupt_pin_level_t level)
 set the interrupt pin1 active level
uint8_t adxl362_get_interrupt_pin1_active_level (adxl362_handle_t *handle, adxl362_interrupt_pin_level_t *level)
 get the interrupt pin1 active level
uint8_t adxl362_set_interrupt_pin1_map (adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t enable)
 set the interrupt pin1 map
uint8_t adxl362_get_interrupt_pin1_map (adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t *enable)
 get the interrupt pin1 map
uint8_t adxl362_set_interrupt_pin2_active_level (adxl362_handle_t *handle, adxl362_interrupt_pin_level_t level)
 set the interrupt pin2 active level
uint8_t adxl362_get_interrupt_pin2_active_level (adxl362_handle_t *handle, adxl362_interrupt_pin_level_t *level)
 get the interrupt pin2 active level
uint8_t adxl362_set_interrupt_pin2_map (adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t enable)
 set the interrupt pin2 map
uint8_t adxl362_get_interrupt_pin2_map (adxl362_handle_t *handle, adxl362_interrupt_map_t map, adxl362_bool_t *enable)
 get the interrupt pin2 map
uint8_t adxl362_set_range (adxl362_handle_t *handle, adxl362_range_t range)
 set the measurement range
uint8_t adxl362_get_range (adxl362_handle_t *handle, adxl362_range_t *range)
 get the measurement range
uint8_t adxl362_set_bandwidth (adxl362_handle_t *handle, adxl362_bandwidth_t bandwidth)
 set the filter bandwidth
uint8_t adxl362_get_bandwidth (adxl362_handle_t *handle, adxl362_bandwidth_t *bandwidth)
 get the filter bandwidth
uint8_t adxl362_set_interrupt_pin2_as_external_sampling_trigger (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable interrupt pin2 as the external sampling trigger
uint8_t adxl362_get_interrupt_pin2_as_external_sampling_trigger (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the interrupt pin2 as the external sampling trigger status
uint8_t adxl362_set_odr (adxl362_handle_t *handle, adxl362_odr_t odr)
 set the output data rate
uint8_t adxl362_get_odr (adxl362_handle_t *handle, adxl362_odr_t *odr)
 get the output data rate
uint8_t adxl362_set_interrupt_pin1_as_external_clock (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable interrupt pin1 as the external clock
uint8_t adxl362_get_interrupt_pin1_as_external_clock (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the interrupt pin1 as the external clock status
uint8_t adxl362_set_noise_mode (adxl362_handle_t *handle, adxl362_noise_mode_t mode)
 set the noise mode
uint8_t adxl362_get_noise_mode (adxl362_handle_t *handle, adxl362_noise_mode_t *mode)
 get the noise mode
uint8_t adxl362_set_wake_up (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable chip wake up
uint8_t adxl362_get_wake_up (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the chip wake up status
uint8_t adxl362_set_auto_sleep (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable auto sleep
uint8_t adxl362_get_auto_sleep (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the auto sleep status
uint8_t adxl362_set_mode (adxl362_handle_t *handle, adxl362_mode_t mode)
 set the chip mode
uint8_t adxl362_get_mode (adxl362_handle_t *handle, adxl362_mode_t *mode)
 get the chip mode
uint8_t adxl362_set_self_test (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable the self test
uint8_t adxl362_get_self_test (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the self test status
uint8_t adxl362_set_activity_threshold (adxl362_handle_t *handle, uint16_t threshold)
 set the activity threshold
uint8_t adxl362_get_activity_threshold (adxl362_handle_t *handle, uint16_t *threshold)
 get the activity threshold
uint8_t adxl362_activity_threshold_convert_to_register (adxl362_handle_t *handle, float g, uint16_t *reg)
 convert the activity threshold to the register raw data
uint8_t adxl362_activity_threshold_convert_to_data (adxl362_handle_t *handle, uint16_t reg, float *g)
 convert the register raw data to the activity threshold
uint8_t adxl362_set_activity_time (adxl362_handle_t *handle, uint8_t tim)
 set the activity time
uint8_t adxl362_get_activity_time (adxl362_handle_t *handle, uint8_t *tim)
 get the activity time
uint8_t adxl362_activity_time_convert_to_register (adxl362_handle_t *handle, float ms, uint8_t *reg)
 convert the activity time to the register raw data
uint8_t adxl362_activity_time_convert_to_data (adxl362_handle_t *handle, uint8_t reg, float *ms)
 convert the register raw data to the activity time
uint8_t adxl362_set_inactivity_threshold (adxl362_handle_t *handle, uint16_t threshold)
 set the inactivity threshold
uint8_t adxl362_get_inactivity_threshold (adxl362_handle_t *handle, uint16_t *threshold)
 get the inactivity threshold
uint8_t adxl362_inactivity_threshold_convert_to_register (adxl362_handle_t *handle, float g, uint16_t *reg)
 convert the inactivity threshold to the register raw data
uint8_t adxl362_inactivity_threshold_convert_to_data (adxl362_handle_t *handle, uint16_t reg, float *g)
 convert the register raw data to the inactivity threshold
uint8_t adxl362_set_inactivity_time (adxl362_handle_t *handle, uint16_t tim)
 set the inactivity time
uint8_t adxl362_get_inactivity_time (adxl362_handle_t *handle, uint16_t *tim)
 get the inactivity time
uint8_t adxl362_inactivity_time_convert_to_register (adxl362_handle_t *handle, float ms, uint16_t *reg)
 convert the inactivity time to the register raw data
uint8_t adxl362_inactivity_time_convert_to_data (adxl362_handle_t *handle, uint16_t reg, float *ms)
 convert the register raw data to the inactivity time
uint8_t adxl362_set_detect_mode (adxl362_handle_t *handle, adxl362_detect_mode_t mode)
 set the detect mode
uint8_t adxl362_get_detect_mode (adxl362_handle_t *handle, adxl362_detect_mode_t *mode)
 get the detect mode
uint8_t adxl362_set_inactivity_detect_trigger (adxl362_handle_t *handle, adxl362_detect_trigger_t trigger)
 set the inactivity detect trigger mode
uint8_t adxl362_get_inactivity_detect_trigger (adxl362_handle_t *handle, adxl362_detect_trigger_t *trigger)
 get the inactivity detect trigger mode
uint8_t adxl362_set_activity_detect_trigger (adxl362_handle_t *handle, adxl362_detect_trigger_t trigger)
 set the activity detect trigger mode
uint8_t adxl362_get_activity_detect_trigger (adxl362_handle_t *handle, adxl362_detect_trigger_t *trigger)
 get the activity detect trigger mode
uint8_t adxl362_set_inactivity (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable inactivity
uint8_t adxl362_get_inactivity (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the inactivity status
uint8_t adxl362_set_activity (adxl362_handle_t *handle, adxl362_bool_t enable)
 enable or disable activity
uint8_t adxl362_get_activity (adxl362_handle_t *handle, adxl362_bool_t *enable)
 get the activity status
uint8_t adxl362_read (adxl362_handle_t *handle, int16_t raw[3], float g[3])
 read the data
uint8_t adxl362_read_fifo (adxl362_handle_t *handle, adxl362_frame_t *frame, uint16_t *frame_len)
 read data from the fifo
uint8_t adxl362_irq_handler (adxl362_handle_t *handle)
 irq handler
uint8_t adxl362_set_reg (adxl362_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t adxl362_get_reg (adxl362_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t adxl362_get_fifo (adxl362_handle_t *handle, uint8_t *buf, uint16_t len)
 read from fifo
uint8_t adxl362_info (adxl362_info_t *info)
 get chip's information

Detailed Description

driver adxl362 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2023-02-28

history

Date Version Author Description
2023/02/28 1.0 Shifeng Li first upload

Definition in file driver_adxl362.c.

Macro Definition Documentation

◆ ADXL362_REG_ACT_INACT_CTL

#define ADXL362_REG_ACT_INACT_CTL   0x27

action inaction control register

Definition at line 80 of file driver_adxl362.c.

◆ ADXL362_REG_DEVID_AD

#define ADXL362_REG_DEVID_AD   0x00

chip register definition

device id register

Definition at line 54 of file driver_adxl362.c.

◆ ADXL362_REG_DEVID_MST

#define ADXL362_REG_DEVID_MST   0x01

device id register

Definition at line 55 of file driver_adxl362.c.

◆ ADXL362_REG_FIFO_CONTROL

#define ADXL362_REG_FIFO_CONTROL   0x28

fifo control register

Definition at line 81 of file driver_adxl362.c.

◆ ADXL362_REG_FIFO_ENTRIES_H

#define ADXL362_REG_FIFO_ENTRIES_H   0x0D

fifo entries high register

Definition at line 63 of file driver_adxl362.c.

◆ ADXL362_REG_FIFO_ENTRIES_L

#define ADXL362_REG_FIFO_ENTRIES_L   0x0C

fifo entries low register

Definition at line 62 of file driver_adxl362.c.

◆ ADXL362_REG_FIFO_SAMPLES

#define ADXL362_REG_FIFO_SAMPLES   0x29

fifo samples register

Definition at line 82 of file driver_adxl362.c.

◆ ADXL362_REG_FILTER_CTL

#define ADXL362_REG_FILTER_CTL   0x2C

filter register

Definition at line 85 of file driver_adxl362.c.

◆ ADXL362_REG_INTMAP1

#define ADXL362_REG_INTMAP1   0x2A

interrupt1 map register

Definition at line 83 of file driver_adxl362.c.

◆ ADXL362_REG_INTMAP2

#define ADXL362_REG_INTMAP2   0x2B

interrupt2 map register

Definition at line 84 of file driver_adxl362.c.

◆ ADXL362_REG_PARTID

#define ADXL362_REG_PARTID   0x02

part id register

Definition at line 56 of file driver_adxl362.c.

◆ ADXL362_REG_POWER_CTL

#define ADXL362_REG_POWER_CTL   0x2D

power register

Definition at line 86 of file driver_adxl362.c.

◆ ADXL362_REG_REVID

#define ADXL362_REG_REVID   0x03

revision id register

Definition at line 57 of file driver_adxl362.c.

◆ ADXL362_REG_SELF_TEST

#define ADXL362_REG_SELF_TEST   0x2E

self register

Definition at line 87 of file driver_adxl362.c.

◆ ADXL362_REG_SOFT_RESET

#define ADXL362_REG_SOFT_RESET   0x1F

soft reset register

Definition at line 72 of file driver_adxl362.c.

◆ ADXL362_REG_STATUS

#define ADXL362_REG_STATUS   0x0B

status register

Definition at line 61 of file driver_adxl362.c.

◆ ADXL362_REG_TEMP_H

#define ADXL362_REG_TEMP_H   0x15

temperature high register

Definition at line 71 of file driver_adxl362.c.

◆ ADXL362_REG_TEMP_L

#define ADXL362_REG_TEMP_L   0x14

temperature low register

Definition at line 70 of file driver_adxl362.c.

◆ ADXL362_REG_THRESH_ACT_H

#define ADXL362_REG_THRESH_ACT_H   0x21

threshold action high register

Definition at line 74 of file driver_adxl362.c.

◆ ADXL362_REG_THRESH_ACT_L

#define ADXL362_REG_THRESH_ACT_L   0x20

threshold action low register

Definition at line 73 of file driver_adxl362.c.

◆ ADXL362_REG_THRESH_INACT_H

#define ADXL362_REG_THRESH_INACT_H   0x24

threshold inaction high register

Definition at line 77 of file driver_adxl362.c.

◆ ADXL362_REG_THRESH_INACT_L

#define ADXL362_REG_THRESH_INACT_L   0x23

threshold inaction low register

Definition at line 76 of file driver_adxl362.c.

◆ ADXL362_REG_TIME_ACT

#define ADXL362_REG_TIME_ACT   0x22

time action register

Definition at line 75 of file driver_adxl362.c.

◆ ADXL362_REG_TIME_INACT_H

#define ADXL362_REG_TIME_INACT_H   0x26

time inaction high register

Definition at line 79 of file driver_adxl362.c.

◆ ADXL362_REG_TIME_INACT_L

#define ADXL362_REG_TIME_INACT_L   0x25

time inaction low register

Definition at line 78 of file driver_adxl362.c.

◆ ADXL362_REG_XDATA

#define ADXL362_REG_XDATA   0x08

x axis data register

Definition at line 58 of file driver_adxl362.c.

◆ ADXL362_REG_XDATA_H

#define ADXL362_REG_XDATA_H   0x0F

x axis data high register

Definition at line 65 of file driver_adxl362.c.

◆ ADXL362_REG_XDATA_L

#define ADXL362_REG_XDATA_L   0x0E

x axis data low register

Definition at line 64 of file driver_adxl362.c.

◆ ADXL362_REG_YDATA

#define ADXL362_REG_YDATA   0x09

y axis data register

Definition at line 59 of file driver_adxl362.c.

◆ ADXL362_REG_YDATA_H

#define ADXL362_REG_YDATA_H   0x11

y axis data high register

Definition at line 67 of file driver_adxl362.c.

◆ ADXL362_REG_YDATA_L

#define ADXL362_REG_YDATA_L   0x10

y axis data low register

Definition at line 66 of file driver_adxl362.c.

◆ ADXL362_REG_ZDATA

#define ADXL362_REG_ZDATA   0x0A

z axis data register

Definition at line 60 of file driver_adxl362.c.

◆ ADXL362_REG_ZDATA_H

#define ADXL362_REG_ZDATA_H   0x13

z axis data high register

Definition at line 69 of file driver_adxl362.c.

◆ ADXL362_REG_ZDATA_L

#define ADXL362_REG_ZDATA_L   0x12

z axis data low register

Definition at line 68 of file driver_adxl362.c.

◆ CHIP_NAME

#define CHIP_NAME   "Analog Devices ADXL362"

chip register definition

chip name

Definition at line 42 of file driver_adxl362.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_adxl362.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Analog Devices"

manufacturer name

Definition at line 43 of file driver_adxl362.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.013f

chip max current

Definition at line 46 of file driver_adxl362.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.5f

chip max supply voltage

Definition at line 45 of file driver_adxl362.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.6f

chip min supply voltage

Definition at line 44 of file driver_adxl362.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_adxl362.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_adxl362.c.