![]() |
LibDriver ADXL345
|
driver adxl345 header file More...
#include <stdint.h>#include <stdio.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | adxl345_handle_s |
| adxl345 handle structure definition More... | |
| struct | adxl345_info_s |
| adxl345 information structure definition More... | |
Macros | |
| #define | DRIVER_ADXL345_LINK_INIT(HANDLE, STRUCTURE) |
| initialize adxl345_handle_t structure | |
| #define | DRIVER_ADXL345_LINK_IIC_INIT(HANDLE, FUC) |
| link iic_init function | |
| #define | DRIVER_ADXL345_LINK_IIC_DEINIT(HANDLE, FUC) |
| link iic_deinit function | |
| #define | DRIVER_ADXL345_LINK_IIC_READ(HANDLE, FUC) |
| link iic_read function | |
| #define | DRIVER_ADXL345_LINK_IIC_WRITE(HANDLE, FUC) |
| link iic_write function | |
| #define | DRIVER_ADXL345_LINK_SPI_INIT(HANDLE, FUC) |
| link spi_init function | |
| #define | DRIVER_ADXL345_LINK_SPI_DEINIT(HANDLE, FUC) |
| link spi_deinit function | |
| #define | DRIVER_ADXL345_LINK_SPI_READ(HANDLE, FUC) |
| link spi_read function | |
| #define | DRIVER_ADXL345_LINK_SPI_WRITE(HANDLE, FUC) |
| link spi_write function | |
| #define | DRIVER_ADXL345_LINK_DELAY_MS(HANDLE, FUC) |
| link delay_ms function | |
| #define | DRIVER_ADXL345_LINK_DEBUG_PRINT(HANDLE, FUC) |
| link debug_print function | |
| #define | DRIVER_ADXL345_LINK_RECEIVE_CALLBACK(HANDLE, FUC) |
| link receive_callback function | |
Typedefs | |
| typedef struct adxl345_handle_s | adxl345_handle_t |
| adxl345 handle structure definition | |
| typedef struct adxl345_info_s | adxl345_info_t |
| adxl345 information structure definition | |
Functions | |
| uint8_t | adxl345_info (adxl345_info_t *info) |
| get chip's information | |
| uint8_t | adxl345_init (adxl345_handle_t *handle) |
| initialize the chip | |
| uint8_t | adxl345_deinit (adxl345_handle_t *handle) |
| close the chip | |
| uint8_t | adxl345_set_interface (adxl345_handle_t *handle, adxl345_interface_t interface) |
| set the chip interface | |
| uint8_t | adxl345_get_interface (adxl345_handle_t *handle, adxl345_interface_t *interface) |
| get the chip interface | |
| uint8_t | adxl345_set_addr_pin (adxl345_handle_t *handle, adxl345_address_t addr_pin) |
| set the iic address pin | |
| uint8_t | adxl345_get_addr_pin (adxl345_handle_t *handle, adxl345_address_t *addr_pin) |
| get the iic address pin | |
| uint8_t | adxl345_read (adxl345_handle_t *handle, int16_t(*raw)[3], float(*g)[3], uint16_t *len) |
| read the data | |
| uint8_t | adxl345_irq_handler (adxl345_handle_t *handle) |
| irq handler | |
| uint8_t | adxl345_set_tap_threshold (adxl345_handle_t *handle, uint8_t threshold) |
| set the tap threshold | |
| uint8_t | adxl345_get_tap_threshold (adxl345_handle_t *handle, uint8_t *threshold) |
| get the tap threshold | |
| uint8_t | adxl345_tap_threshold_convert_to_register (adxl345_handle_t *handle, float g, uint8_t *reg) |
| convert the tap threshold to the register raw data | |
| uint8_t | adxl345_tap_threshold_convert_to_data (adxl345_handle_t *handle, uint8_t reg, float *g) |
| convert the register raw data to the tap threshold | |
| uint8_t | adxl345_set_offset (adxl345_handle_t *handle, int8_t x, int8_t y, int8_t z) |
| set the axis offset | |
| uint8_t | adxl345_get_offset (adxl345_handle_t *handle, int8_t *x, int8_t *y, int8_t *z) |
| get the axis offset | |
| uint8_t | adxl345_offset_convert_to_register (adxl345_handle_t *handle, float g, int8_t *reg) |
| convert the offset to the register raw data | |
| uint8_t | adxl345_offset_convert_to_data (adxl345_handle_t *handle, int8_t reg, float *g) |
| convert the register raw data to the offset | |
| uint8_t | adxl345_set_duration (adxl345_handle_t *handle, uint8_t t) |
| set the duration | |
| uint8_t | adxl345_get_duration (adxl345_handle_t *handle, uint8_t *t) |
| get the duration | |
| uint8_t | adxl345_duration_convert_to_register (adxl345_handle_t *handle, uint32_t us, uint8_t *reg) |
| convert the duration to the register raw data | |
| uint8_t | adxl345_duration_convert_to_data (adxl345_handle_t *handle, uint8_t reg, uint32_t *us) |
| convert the register raw data to the duration | |
| uint8_t | adxl345_set_latent (adxl345_handle_t *handle, uint8_t t) |
| set the latent | |
| uint8_t | adxl345_get_latent (adxl345_handle_t *handle, uint8_t *t) |
| get the latent | |
| uint8_t | adxl345_latent_convert_to_register (adxl345_handle_t *handle, float ms, uint8_t *reg) |
| convert the latent to the register raw data | |
| uint8_t | adxl345_latent_convert_to_data (adxl345_handle_t *handle, uint8_t reg, float *ms) |
| convert the register raw data to the latent | |
| uint8_t | adxl345_set_window (adxl345_handle_t *handle, uint8_t t) |
| set the window | |
| uint8_t | adxl345_get_window (adxl345_handle_t *handle, uint8_t *t) |
| get the window | |
| uint8_t | adxl345_window_convert_to_register (adxl345_handle_t *handle, float ms, uint8_t *reg) |
| convert the window time to the register raw data | |
| uint8_t | adxl345_window_convert_to_data (adxl345_handle_t *handle, uint8_t reg, float *ms) |
| convert the register raw data to the window time | |
| uint8_t | adxl345_set_action_threshold (adxl345_handle_t *handle, uint8_t threshold) |
| set the action threshold | |
| uint8_t | adxl345_get_action_threshold (adxl345_handle_t *handle, uint8_t *threshold) |
| get the action threshold | |
| uint8_t | adxl345_action_threshold_convert_to_register (adxl345_handle_t *handle, float g, uint8_t *reg) |
| convert the action threshold to the register raw data | |
| uint8_t | adxl345_action_threshold_convert_to_data (adxl345_handle_t *handle, uint8_t reg, float *g) |
| convert the register raw data to the action threshold | |
| uint8_t | adxl345_set_inaction_threshold (adxl345_handle_t *handle, uint8_t threshold) |
| set the inaction threshold | |
| uint8_t | adxl345_get_inaction_threshold (adxl345_handle_t *handle, uint8_t *threshold) |
| get the inaction threshold | |
| uint8_t | adxl345_inaction_threshold_convert_to_register (adxl345_handle_t *handle, float g, uint8_t *reg) |
| convert the inaction threshold to the register raw data | |
| uint8_t | adxl345_inaction_threshold_convert_to_data (adxl345_handle_t *handle, uint8_t reg, float *g) |
| convert the register raw data to the inaction threshold | |
| uint8_t | adxl345_set_inaction_time (adxl345_handle_t *handle, uint8_t t) |
| set the inaction time | |
| uint8_t | adxl345_get_inaction_time (adxl345_handle_t *handle, uint8_t *t) |
| get the inaction time | |
| uint8_t | adxl345_inaction_time_convert_to_register (adxl345_handle_t *handle, uint8_t s, uint8_t *reg) |
| convert the inaction time to the register raw data | |
| uint8_t | adxl345_inaction_time_convert_to_data (adxl345_handle_t *handle, uint8_t reg, uint8_t *s) |
| convert the register raw data to the inaction time | |
| uint8_t | adxl345_set_action_inaction (adxl345_handle_t *handle, adxl345_action_inaction_t type, adxl345_bool_t enable) |
| enable or disable the action or inaction | |
| uint8_t | adxl345_get_action_inaction (adxl345_handle_t *handle, adxl345_action_inaction_t type, adxl345_bool_t *enable) |
| get the action or inaction status | |
| uint8_t | adxl345_set_action_coupled (adxl345_handle_t *handle, adxl345_coupled_t coupled) |
| set the action coupled | |
| uint8_t | adxl345_get_action_coupled (adxl345_handle_t *handle, adxl345_coupled_t *coupled) |
| get the action coupled | |
| uint8_t | adxl345_set_inaction_coupled (adxl345_handle_t *handle, adxl345_coupled_t coupled) |
| set the inaction coupled | |
| uint8_t | adxl345_get_inaction_coupled (adxl345_handle_t *handle, adxl345_coupled_t *coupled) |
| get the inaction coupled | |
| uint8_t | adxl345_set_free_fall_threshold (adxl345_handle_t *handle, uint8_t threshold) |
| set the free fall threshold | |
| uint8_t | adxl345_get_free_fall_threshold (adxl345_handle_t *handle, uint8_t *threshold) |
| get the free fall threshold | |
| uint8_t | adxl345_free_fall_threshold_convert_to_register (adxl345_handle_t *handle, float g, uint8_t *reg) |
| convert the free fall threshold to the register raw data | |
| uint8_t | adxl345_free_fall_threshold_convert_to_data (adxl345_handle_t *handle, uint8_t reg, float *g) |
| convert the register raw data to the free fall threshold | |
| uint8_t | adxl345_set_free_fall_time (adxl345_handle_t *handle, uint8_t t) |
| set the free fall time | |
| uint8_t | adxl345_get_free_fall_time (adxl345_handle_t *handle, uint8_t *t) |
| get the free fall time | |
| uint8_t | adxl345_free_fall_time_convert_to_register (adxl345_handle_t *handle, uint16_t ms, uint8_t *reg) |
| convert the free fall time to the register raw data | |
| uint8_t | adxl345_free_fall_time_convert_to_data (adxl345_handle_t *handle, uint8_t reg, uint16_t *ms) |
| convert the register raw data to the free fall time | |
| uint8_t | adxl345_set_tap_axis (adxl345_handle_t *handle, adxl345_tap_axis_t axis, adxl345_bool_t enable) |
| enable or disable the tap axis | |
| uint8_t | adxl345_get_tap_axis (adxl345_handle_t *handle, adxl345_tap_axis_t axis, adxl345_bool_t *enable) |
| get the tap axis status | |
| uint8_t | adxl345_set_tap_suppress (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the tap suppress | |
| uint8_t | adxl345_get_tap_suppress (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the tap suppress status | |
| uint8_t | adxl345_get_tap_status (adxl345_handle_t *handle, uint8_t *status) |
| get the tap status | |
| uint8_t | adxl345_set_rate (adxl345_handle_t *handle, adxl345_rate_t rate) |
| set the sampling rate | |
| uint8_t | adxl345_get_rate (adxl345_handle_t *handle, adxl345_rate_t *rate) |
| get the sampling rate | |
| uint8_t | adxl345_set_self_test (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the self test | |
| uint8_t | adxl345_get_self_test (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the self test status | |
| uint8_t | adxl345_set_spi_wire (adxl345_handle_t *handle, adxl345_spi_wire_t wire) |
| set the chip spi wire | |
| uint8_t | adxl345_get_spi_wire (adxl345_handle_t *handle, adxl345_spi_wire_t *wire) |
| get the chip spi wire | |
| uint8_t | adxl345_set_full_resolution (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the full resolution | |
| uint8_t | adxl345_get_full_resolution (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the full resolution status | |
| uint8_t | adxl345_set_justify (adxl345_handle_t *handle, adxl345_justify_t enable) |
| enable or disable the justify | |
| uint8_t | adxl345_get_justify (adxl345_handle_t *handle, adxl345_justify_t *enable) |
| get the justify status | |
| uint8_t | adxl345_set_range (adxl345_handle_t *handle, adxl345_range_t range) |
| set the chip range | |
| uint8_t | adxl345_get_range (adxl345_handle_t *handle, adxl345_range_t *range) |
| get the chip range | |
| uint8_t | adxl345_set_mode (adxl345_handle_t *handle, adxl345_mode_t mode) |
| set the chip mode | |
| uint8_t | adxl345_get_mode (adxl345_handle_t *handle, adxl345_mode_t *mode) |
| get the chip mode | |
| uint8_t | adxl345_set_trigger_pin (adxl345_handle_t *handle, adxl345_interrupt_pin_t pin) |
| set the trigger pin | |
| uint8_t | adxl345_get_trigger_pin (adxl345_handle_t *handle, adxl345_interrupt_pin_t *pin) |
| get the trigger pin | |
| uint8_t | adxl345_get_trigger_status (adxl345_handle_t *handle, adxl345_trigger_status_t *status) |
| get the trigger status | |
| uint8_t | adxl345_set_link_activity_inactivity (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the activity and inactivity linking | |
| uint8_t | adxl345_get_link_activity_inactivity (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the activity and inactivity linking status | |
| uint8_t | adxl345_set_auto_sleep (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the auto sleep | |
| uint8_t | adxl345_get_auto_sleep (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the auto sleep status | |
| uint8_t | adxl345_set_measure (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the measure | |
| uint8_t | adxl345_get_measure (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the measure status | |
| uint8_t | adxl345_set_sleep (adxl345_handle_t *handle, adxl345_bool_t enable) |
| enable or disable the sleep mode | |
| uint8_t | adxl345_get_sleep (adxl345_handle_t *handle, adxl345_bool_t *enable) |
| get the sleep mode status | |
| uint8_t | adxl345_set_sleep_frequency (adxl345_handle_t *handle, adxl345_sleep_frequency_t sleep_frequency) |
| set the sleep frequency | |
| uint8_t | adxl345_get_sleep_frequency (adxl345_handle_t *handle, adxl345_sleep_frequency_t *sleep_frequency) |
| get the sleep frequency | |
| uint8_t | adxl345_set_interrupt (adxl345_handle_t *handle, adxl345_interrupt_t type, adxl345_bool_t enable) |
| enable or disable the interrupt | |
| uint8_t | adxl345_get_interrupt (adxl345_handle_t *handle, adxl345_interrupt_t type, adxl345_bool_t *enable) |
| get the interrupt status | |
| uint8_t | adxl345_get_interrupt_source (adxl345_handle_t *handle, uint8_t *source) |
| get the interrupt source | |
| uint8_t | adxl345_set_interrupt_map (adxl345_handle_t *handle, adxl345_interrupt_t type, adxl345_interrupt_pin_t pin) |
| set the interrupt map | |
| uint8_t | adxl345_get_interrupt_map (adxl345_handle_t *handle, adxl345_interrupt_t type, adxl345_interrupt_pin_t *pin) |
| get the interrupt map | |
| uint8_t | adxl345_set_interrupt_active_level (adxl345_handle_t *handle, adxl345_interrupt_active_level_t active_level) |
| set the interrupt active level | |
| uint8_t | adxl345_get_interrupt_active_level (adxl345_handle_t *handle, adxl345_interrupt_active_level_t *active_level) |
| get the interrupt active level | |
| uint8_t | adxl345_set_watermark (adxl345_handle_t *handle, uint8_t level) |
| set the fifo watermark | |
| uint8_t | adxl345_get_watermark (adxl345_handle_t *handle, uint8_t *level) |
| get the fifo watermark | |
| uint8_t | adxl345_get_watermark_level (adxl345_handle_t *handle, uint8_t *level) |
| get the current fifo watermark level | |
| uint8_t | adxl345_set_reg (adxl345_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len) |
| set the chip register | |
| uint8_t | adxl345_get_reg (adxl345_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len) |
| get the chip register | |
driver adxl345 header 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.
| Date | Version | Author | Description |
|---|---|---|---|
| 2021/04/20 | 2.0 | Shifeng Li | format the code |
| 2020/12/23 | 1.0 | Shifeng Li | first upload |
Definition in file driver_adxl345.h.