LibDriver ADXL345  2.0.0
ADXL345 full-featured driver
driver_adxl345.h
Go to the documentation of this file.
1 
38 #ifndef DRIVER_ADXL345_H
39 #define DRIVER_ADXL345_H
40 
41 #include <stdint.h>
42 #include <stdio.h>
43 #include <string.h>
44 
45 #ifdef __cplusplus
46 extern "C"{
47 #endif
48 
63 typedef enum
64 {
68 
72 typedef enum
73 {
77 
81 typedef enum
82 {
86 
90 typedef enum
91 {
95 
99 typedef enum
100 {
108 
112 typedef enum
113 {
118 
122 typedef enum
123 {
132 
136 typedef enum
137 {
161 
165 typedef enum
166 {
170 
174 typedef enum
175 {
179 
183 typedef enum
184 {
190 
194 typedef enum
195 {
201 
205 typedef enum
206 {
212 
216 typedef enum
217 {
221 
234 typedef enum
235 {
245 
249 typedef enum
250 {
254 
258 typedef enum
259 {
263 
276 typedef struct adxl345_handle_s
277 {
278  uint8_t iic_addr;
279  uint8_t (*iic_init)(void);
280  uint8_t (*iic_deinit)(void);
281  uint8_t (*iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
282  uint8_t (*iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
283  uint8_t (*spi_init)(void);
284  uint8_t (*spi_deinit)(void);
285  uint8_t (*spi_read)(uint8_t reg, uint8_t *buf, uint16_t len);
286  uint8_t (*spi_write)(uint8_t reg, uint8_t *buf, uint16_t len);
287  void (*receive_callback)(uint8_t type);
288  void (*delay_ms)(uint32_t ms);
289  void (*debug_print)(const char *const fmt, ...);
290  uint8_t inited;
291  uint8_t iic_spi;
293 
297 typedef struct adxl345_info_s
298 {
299  char chip_name[32];
300  char manufacturer_name[32];
301  char interface[8];
307  uint32_t driver_version;
309 
327 #define DRIVER_ADXL345_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
328 
335 #define DRIVER_ADXL345_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
336 
343 #define DRIVER_ADXL345_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
344 
351 #define DRIVER_ADXL345_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
352 
359 #define DRIVER_ADXL345_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
360 
367 #define DRIVER_ADXL345_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
368 
375 #define DRIVER_ADXL345_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
376 
383 #define DRIVER_ADXL345_LINK_SPI_READ(HANDLE, FUC) (HANDLE)->spi_read = FUC
384 
391 #define DRIVER_ADXL345_LINK_SPI_WRITE(HANDLE, FUC) (HANDLE)->spi_write = FUC
392 
399 #define DRIVER_ADXL345_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
400 
407 #define DRIVER_ADXL345_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
408 
415 #define DRIVER_ADXL345_LINK_RECEIVE_CALLBACK(HANDLE, FUC) (HANDLE)->receive_callback = FUC
416 
436 uint8_t adxl345_info(adxl345_info_t *info);
437 
449 uint8_t adxl345_init(adxl345_handle_t *handle);
450 
462 uint8_t adxl345_deinit(adxl345_handle_t *handle);
463 
474 
484 uint8_t adxl345_get_interface(adxl345_handle_t *handle, adxl345_interface_t *interface);
485 
495 uint8_t adxl345_set_addr_pin(adxl345_handle_t *handle, adxl345_address_t addr_pin);
496 
506 uint8_t adxl345_get_addr_pin(adxl345_handle_t *handle, adxl345_address_t *addr_pin);
507 
521 uint8_t adxl345_read(adxl345_handle_t *handle, int16_t (*raw)[3], float (*g)[3], uint16_t *len);
522 
533 uint8_t adxl345_irq_handler(adxl345_handle_t *handle);
534 
546 uint8_t adxl345_set_tap_threshold(adxl345_handle_t *handle, uint8_t threshold);
547 
559 uint8_t adxl345_get_tap_threshold(adxl345_handle_t *handle, uint8_t *threshold);
560 
572 uint8_t adxl345_tap_threshold_convert_to_register(adxl345_handle_t *handle, float g, uint8_t *reg);
573 
585 uint8_t adxl345_tap_threshold_convert_to_data(adxl345_handle_t *handle, uint8_t reg, float *g);
586 
600 uint8_t adxl345_set_offset(adxl345_handle_t *handle, int8_t x, int8_t y, int8_t z);
601 
615 uint8_t adxl345_get_offset(adxl345_handle_t *handle, int8_t *x, int8_t *y, int8_t *z);
616 
628 uint8_t adxl345_offset_convert_to_register(adxl345_handle_t *handle, float g, int8_t *reg);
629 
641 uint8_t adxl345_offset_convert_to_data(adxl345_handle_t *handle, int8_t reg, float *g);
642 
654 uint8_t adxl345_set_duration(adxl345_handle_t *handle, uint8_t t);
655 
667 uint8_t adxl345_get_duration(adxl345_handle_t *handle, uint8_t *t);
668 
680 uint8_t adxl345_duration_convert_to_register(adxl345_handle_t *handle, uint32_t us, uint8_t *reg);
681 
693 uint8_t adxl345_duration_convert_to_data(adxl345_handle_t *handle, uint8_t reg, uint32_t *us);
694 
706 uint8_t adxl345_set_latent(adxl345_handle_t *handle, uint8_t t);
707 
719 uint8_t adxl345_get_latent(adxl345_handle_t *handle, uint8_t *t);
720 
732 uint8_t adxl345_latent_convert_to_register(adxl345_handle_t *handle, float ms, uint8_t *reg);
733 
745 uint8_t adxl345_latent_convert_to_data(adxl345_handle_t *handle, uint8_t reg, float *ms);
746 
758 uint8_t adxl345_set_window(adxl345_handle_t *handle, uint8_t t);
759 
771 uint8_t adxl345_get_window(adxl345_handle_t *handle, uint8_t *t);
772 
784 uint8_t adxl345_window_convert_to_register(adxl345_handle_t *handle, float ms, uint8_t *reg);
785 
797 uint8_t adxl345_window_convert_to_data(adxl345_handle_t *handle, uint8_t reg, float *ms);
798 
810 uint8_t adxl345_set_action_threshold(adxl345_handle_t *handle, uint8_t threshold);
811 
823 uint8_t adxl345_get_action_threshold(adxl345_handle_t *handle, uint8_t *threshold);
824 
836 uint8_t adxl345_action_threshold_convert_to_register(adxl345_handle_t *handle, float g, uint8_t *reg);
837 
849 uint8_t adxl345_action_threshold_convert_to_data(adxl345_handle_t *handle, uint8_t reg, float *g);
850 
862 uint8_t adxl345_set_inaction_threshold(adxl345_handle_t *handle, uint8_t threshold);
863 
875 uint8_t adxl345_get_inaction_threshold(adxl345_handle_t *handle, uint8_t *threshold);
876 
888 uint8_t adxl345_inaction_threshold_convert_to_register(adxl345_handle_t *handle, float g, uint8_t *reg);
889 
901 uint8_t adxl345_inaction_threshold_convert_to_data(adxl345_handle_t *handle, uint8_t reg, float *g);
902 
914 uint8_t adxl345_set_inaction_time(adxl345_handle_t *handle, uint8_t t);
915 
927 uint8_t adxl345_get_inaction_time(adxl345_handle_t *handle, uint8_t *t);
928 
940 uint8_t adxl345_inaction_time_convert_to_register(adxl345_handle_t *handle, uint8_t s, uint8_t *reg);
941 
953 uint8_t adxl345_inaction_time_convert_to_data(adxl345_handle_t *handle, uint8_t reg, uint8_t *s);
954 
968 
982 
995 
1008 
1021 
1034 
1046 uint8_t adxl345_set_free_fall_threshold(adxl345_handle_t *handle, uint8_t threshold);
1047 
1059 uint8_t adxl345_get_free_fall_threshold(adxl345_handle_t *handle, uint8_t *threshold);
1060 
1072 uint8_t adxl345_free_fall_threshold_convert_to_register(adxl345_handle_t *handle, float g, uint8_t *reg);
1073 
1085 uint8_t adxl345_free_fall_threshold_convert_to_data(adxl345_handle_t *handle, uint8_t reg, float *g);
1086 
1098 uint8_t adxl345_set_free_fall_time(adxl345_handle_t *handle, uint8_t t);
1099 
1111 uint8_t adxl345_get_free_fall_time(adxl345_handle_t *handle, uint8_t *t);
1112 
1124 uint8_t adxl345_free_fall_time_convert_to_register(adxl345_handle_t *handle, uint16_t ms, uint8_t *reg);
1125 
1137 uint8_t adxl345_free_fall_time_convert_to_data(adxl345_handle_t *handle, uint8_t reg, uint16_t *ms);
1138 
1152 
1166 
1179 
1191 uint8_t adxl345_get_tap_suppress(adxl345_handle_t *handle, adxl345_bool_t *enable);
1192 
1204 uint8_t adxl345_get_tap_status(adxl345_handle_t *handle, uint8_t *status);
1205 
1217 uint8_t adxl345_set_rate(adxl345_handle_t *handle, adxl345_rate_t rate);
1218 
1230 uint8_t adxl345_get_rate(adxl345_handle_t *handle, adxl345_rate_t *rate);
1231 
1243 uint8_t adxl345_set_self_test(adxl345_handle_t *handle, adxl345_bool_t enable);
1244 
1256 uint8_t adxl345_get_self_test(adxl345_handle_t *handle, adxl345_bool_t *enable);
1257 
1270 
1283 
1296 
1309 
1321 uint8_t adxl345_set_justify(adxl345_handle_t *handle, adxl345_justify_t enable);
1322 
1334 uint8_t adxl345_get_justify(adxl345_handle_t *handle, adxl345_justify_t *enable);
1335 
1347 uint8_t adxl345_set_range(adxl345_handle_t *handle, adxl345_range_t range);
1348 
1360 uint8_t adxl345_get_range(adxl345_handle_t *handle, adxl345_range_t *range);
1361 
1373 uint8_t adxl345_set_mode(adxl345_handle_t *handle, adxl345_mode_t mode);
1374 
1386 uint8_t adxl345_get_mode(adxl345_handle_t *handle, adxl345_mode_t *mode);
1387 
1400 
1413 
1426 
1439 
1452 
1464 uint8_t adxl345_set_auto_sleep(adxl345_handle_t *handle, adxl345_bool_t enable);
1465 
1477 uint8_t adxl345_get_auto_sleep(adxl345_handle_t *handle, adxl345_bool_t *enable);
1478 
1490 uint8_t adxl345_set_measure(adxl345_handle_t *handle, adxl345_bool_t enable);
1491 
1503 uint8_t adxl345_get_measure(adxl345_handle_t *handle, adxl345_bool_t *enable);
1504 
1516 uint8_t adxl345_set_sleep(adxl345_handle_t *handle, adxl345_bool_t enable);
1517 
1529 uint8_t adxl345_get_sleep(adxl345_handle_t *handle, adxl345_bool_t *enable);
1530 
1543 
1556 
1569 
1594 
1608 
1620 uint8_t adxl345_get_interrupt_source(adxl345_handle_t *handle, uint8_t *source);
1621 
1635 
1649 
1662 
1675 
1698 uint8_t adxl345_set_watermark(adxl345_handle_t *handle, uint8_t level);
1699 
1711 uint8_t adxl345_get_watermark(adxl345_handle_t *handle, uint8_t *level);
1712 
1724 uint8_t adxl345_get_watermark_level(adxl345_handle_t *handle, uint8_t *level);
1725 
1750 uint8_t adxl345_set_reg(adxl345_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len);
1751 
1765 uint8_t adxl345_get_reg(adxl345_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len);
1766 
1775 #ifdef __cplusplus
1776 }
1777 #endif
1778 
1779 #endif
adxl345_interface_t
adxl345 interface enumeration definition
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_get_justify(adxl345_handle_t *handle, adxl345_justify_t *enable)
get the justify status
adxl345_spi_wire_t
adxl345 spi wire enumeration definition
uint8_t adxl345_get_action_coupled(adxl345_handle_t *handle, adxl345_coupled_t *coupled)
get the action coupled
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_duration_convert_to_register(adxl345_handle_t *handle, uint32_t us, uint8_t *reg)
convert the duration to the register raw data
struct adxl345_info_s adxl345_info_t
adxl345 information structure definition
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_get_auto_sleep(adxl345_handle_t *handle, adxl345_bool_t *enable)
get the auto sleep status
uint8_t adxl345_set_full_resolution(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the full resolution
uint8_t adxl345_set_inaction_time(adxl345_handle_t *handle, uint8_t t)
set the inaction time
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
adxl345_justify_t
adxl345 justify enumeration definition
uint8_t adxl345_get_tap_threshold(adxl345_handle_t *handle, uint8_t *threshold)
get the tap threshold
uint8_t adxl345_deinit(adxl345_handle_t *handle)
close the chip
uint8_t adxl345_set_inaction_coupled(adxl345_handle_t *handle, adxl345_coupled_t coupled)
set the inaction coupled
uint8_t adxl345_get_tap_axis(adxl345_handle_t *handle, adxl345_tap_axis_t axis, adxl345_bool_t *enable)
get the tap axis status
adxl345_action_inaction_t
adxl345 action inaction enumeration definition
uint8_t adxl345_get_trigger_pin(adxl345_handle_t *handle, adxl345_interrupt_pin_t *pin)
get the trigger pin
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_spi_wire(adxl345_handle_t *handle, adxl345_spi_wire_t wire)
set the chip spi wire
uint8_t adxl345_set_measure(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the measure
uint8_t adxl345_set_trigger_pin(adxl345_handle_t *handle, adxl345_interrupt_pin_t pin)
set the trigger pin
uint8_t adxl345_get_full_resolution(adxl345_handle_t *handle, adxl345_bool_t *enable)
get the full resolution status
uint8_t adxl345_irq_handler(adxl345_handle_t *handle)
irq handler
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_free_fall_time(adxl345_handle_t *handle, uint8_t *t)
get the free fall time
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_get_sleep_frequency(adxl345_handle_t *handle, adxl345_sleep_frequency_t *sleep_frequency)
get the sleep frequency
uint8_t adxl345_get_sleep(adxl345_handle_t *handle, adxl345_bool_t *enable)
get the sleep mode status
uint8_t adxl345_get_mode(adxl345_handle_t *handle, adxl345_mode_t *mode)
get the chip mode
uint8_t adxl345_set_action_threshold(adxl345_handle_t *handle, uint8_t threshold)
set the action threshold
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_get_free_fall_threshold(adxl345_handle_t *handle, uint8_t *threshold)
get the free fall threshold
uint8_t adxl345_set_free_fall_threshold(adxl345_handle_t *handle, uint8_t threshold)
set the free fall threshold
uint8_t adxl345_set_sleep(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the sleep mode
uint8_t adxl345_get_interface(adxl345_handle_t *handle, adxl345_interface_t *interface)
get the chip interface
uint8_t adxl345_get_window(adxl345_handle_t *handle, uint8_t *t)
get the window
adxl345_trigger_status_t
adxl345 trigger status enumeration definition
uint8_t adxl345_read(adxl345_handle_t *handle, int16_t(*raw)[3], float(*g)[3], uint16_t *len)
read the data
uint8_t adxl345_get_duration(adxl345_handle_t *handle, uint8_t *t)
get the duration
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_get_latent(adxl345_handle_t *handle, uint8_t *t)
get the latent
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_set_latent(adxl345_handle_t *handle, uint8_t t)
set the latent
uint8_t adxl345_set_rate(adxl345_handle_t *handle, adxl345_rate_t rate)
set the sampling rate
uint8_t adxl345_set_inaction_threshold(adxl345_handle_t *handle, uint8_t threshold)
set the inaction threshold
uint8_t adxl345_get_inaction_time(adxl345_handle_t *handle, uint8_t *t)
get the inaction time
uint8_t adxl345_set_addr_pin(adxl345_handle_t *handle, adxl345_address_t addr_pin)
set the iic address pin
uint8_t adxl345_get_range(adxl345_handle_t *handle, adxl345_range_t *range)
get the chip range
uint8_t adxl345_set_self_test(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the self test
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_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_get_measure(adxl345_handle_t *handle, adxl345_bool_t *enable)
get the measure status
adxl345_range_t
adxl345 range enumeration definition
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_get_spi_wire(adxl345_handle_t *handle, adxl345_spi_wire_t *wire)
get the chip spi wire
uint8_t adxl345_get_rate(adxl345_handle_t *handle, adxl345_rate_t *rate)
get the sampling rate
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_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_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_get_trigger_status(adxl345_handle_t *handle, adxl345_trigger_status_t *status)
get the trigger status
uint8_t adxl345_set_duration(adxl345_handle_t *handle, uint8_t t)
set the duration
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_set_tap_suppress(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the tap suppress
uint8_t adxl345_set_auto_sleep(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the auto sleep
uint8_t adxl345_get_addr_pin(adxl345_handle_t *handle, adxl345_address_t *addr_pin)
get the iic address pin
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
adxl345_rate_t
adxl345 rate enumeration definition
uint8_t adxl345_set_free_fall_time(adxl345_handle_t *handle, uint8_t t)
set the free fall time
uint8_t adxl345_get_inaction_coupled(adxl345_handle_t *handle, adxl345_coupled_t *coupled)
get the inaction coupled
uint8_t adxl345_set_window(adxl345_handle_t *handle, uint8_t t)
set the window
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_set_sleep_frequency(adxl345_handle_t *handle, adxl345_sleep_frequency_t sleep_frequency)
set the sleep frequency
adxl345_address_t
adxl345 address enumeration definition
uint8_t adxl345_latent_convert_to_register(adxl345_handle_t *handle, float ms, uint8_t *reg)
convert the latent to the register raw data
adxl345_tap_axis_t
adxl345 tap axis enumeration definition
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_init(adxl345_handle_t *handle)
initialize the chip
struct adxl345_handle_s adxl345_handle_t
adxl345 handle structure definition
adxl345_coupled_t
adxl345 coupled enumeration definition
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_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_coupled(adxl345_handle_t *handle, adxl345_coupled_t coupled)
set the action coupled
adxl345_bool_t
adxl345 bool enumeration definition
uint8_t adxl345_get_inaction_threshold(adxl345_handle_t *handle, uint8_t *threshold)
get the inaction threshold
uint8_t adxl345_get_tap_status(adxl345_handle_t *handle, uint8_t *status)
get the tap status
uint8_t adxl345_get_self_test(adxl345_handle_t *handle, adxl345_bool_t *enable)
get the self test status
uint8_t adxl345_set_justify(adxl345_handle_t *handle, adxl345_justify_t enable)
enable or disable the justify
uint8_t adxl345_set_interface(adxl345_handle_t *handle, adxl345_interface_t interface)
set the chip interface
uint8_t adxl345_get_action_threshold(adxl345_handle_t *handle, uint8_t *threshold)
get the action threshold
uint8_t adxl345_set_mode(adxl345_handle_t *handle, adxl345_mode_t mode)
set the chip mode
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_get_tap_suppress(adxl345_handle_t *handle, adxl345_bool_t *enable)
get the tap suppress status
adxl345_sleep_frequency_t
adxl345 sleep frequency enumeration definition
uint8_t adxl345_offset_convert_to_data(adxl345_handle_t *handle, int8_t reg, float *g)
convert the register raw data to the offset
adxl345_mode_t
adxl345 mode enumeration definition
uint8_t adxl345_info(adxl345_info_t *info)
get chip's information
uint8_t adxl345_set_tap_threshold(adxl345_handle_t *handle, uint8_t threshold)
set the tap threshold
adxl345_action_tap_status_t
adxl345 action tap status enumeration definition
uint8_t adxl345_set_range(adxl345_handle_t *handle, adxl345_range_t range)
set the chip range
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
@ ADXL345_INTERFACE_SPI
@ ADXL345_INTERFACE_IIC
@ ADXL345_SPI_WIRE_3
@ ADXL345_SPI_WIRE_4
@ ADXL345_JUSTIFY_LEFT
@ ADXL345_JUSTIFY_RIGHT
@ ADXL345_ACTION_Z
@ ADXL345_INACTION_Z
@ ADXL345_INACTION_X
@ ADXL345_INACTION_Y
@ ADXL345_ACTION_X
@ ADXL345_ACTION_Y
@ ADXL345_TRIGGER_NOT_OCCURRED
@ ADXL345_TRIGGER_OCCURRED
@ ADXL345_RANGE_8G
@ ADXL345_RANGE_2G
@ ADXL345_RANGE_16G
@ ADXL345_RANGE_4G
@ ADXL345_RATE_800
@ ADXL345_RATE_6P25
@ ADXL345_RATE_1P56
@ ADXL345_RATE_1600
@ ADXL345_LOW_POWER_RATE_200
@ ADXL345_RATE_3200
@ ADXL345_RATE_50
@ ADXL345_RATE_0P2
@ ADXL345_RATE_100
@ ADXL345_RATE_3P13
@ ADXL345_RATE_200
@ ADXL345_RATE_400
@ ADXL345_RATE_0P1
@ ADXL345_RATE_0P78
@ ADXL345_LOW_POWER_RATE_12P5
@ ADXL345_RATE_0P39
@ ADXL345_LOW_POWER_RATE_100
@ ADXL345_RATE_12P5
@ ADXL345_LOW_POWER_RATE_50
@ ADXL345_LOW_POWER_RATE_400
@ ADXL345_RATE_25
@ ADXL345_LOW_POWER_RATE_25
@ ADXL345_ADDRESS_ALT_1
@ ADXL345_ADDRESS_ALT_0
@ ADXL345_TAP_AXIS_Z
@ ADXL345_TAP_AXIS_Y
@ ADXL345_TAP_AXIS_X
@ ADXL345_COUPLED_DC
@ ADXL345_COUPLED_AC
@ ADXL345_BOOL_FALSE
@ ADXL345_BOOL_TRUE
@ ADXL345_SLEEP_FREQUENCY_2HZ
@ ADXL345_SLEEP_FREQUENCY_4HZ
@ ADXL345_SLEEP_FREQUENCY_8HZ
@ ADXL345_SLEEP_FREQUENCY_1HZ
@ ADXL345_MODE_BYPASS
@ ADXL345_MODE_FIFO
@ ADXL345_MODE_STREAM
@ ADXL345_MODE_TRIGGER
@ ADXL345_ACTION_TAP_STATUS_ACT_Z
@ ADXL345_ACTION_TAP_STATUS_TAP_Z
@ ADXL345_ACTION_TAP_STATUS_TAP_X
@ ADXL345_ACTION_TAP_STATUS_ACT_X
@ ADXL345_ACTION_TAP_STATUS_TAP_Y
@ ADXL345_ACTION_TAP_STATUS_ASLEEP
@ ADXL345_ACTION_TAP_STATUS_ACT_Y
uint8_t adxl345_get_reg(adxl345_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
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_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_watermark(adxl345_handle_t *handle, uint8_t level)
set the fifo watermark
adxl345_interrupt_active_level_t
adxl345 interrupt active_level enumeration definition
adxl345_interrupt_pin_t
adxl345 interrupt pin enumeration definition
uint8_t adxl345_get_interrupt_source(adxl345_handle_t *handle, uint8_t *source)
get the interrupt source
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_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
adxl345_interrupt_t
adxl345 interrupt enumeration definition
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_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_map(adxl345_handle_t *handle, adxl345_interrupt_t type, adxl345_interrupt_pin_t *pin)
get the interrupt map
@ ADXL345_INTERRUPT_ACTIVE_LEVEL_HIGH
@ ADXL345_INTERRUPT_ACTIVE_LEVEL_LOW
@ ADXL345_INTERRUPT_PIN2
@ ADXL345_INTERRUPT_PIN1
@ ADXL345_INTERRUPT_DATA_READY
@ ADXL345_INTERRUPT_DOUBLE_TAP
@ ADXL345_INTERRUPT_ACTIVITY
@ ADXL345_INTERRUPT_SINGLE_TAP
@ ADXL345_INTERRUPT_INACTIVITY
@ ADXL345_INTERRUPT_WATERMARK
@ ADXL345_INTERRUPT_OVERRUN
@ ADXL345_INTERRUPT_FREE_FALL
adxl345 handle structure definition
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read)(uint8_t reg, uint8_t *buf, uint16_t len)
void(* receive_callback)(uint8_t type)
uint8_t(* spi_write)(uint8_t reg, uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* spi_deinit)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
adxl345 information structure definition
float supply_voltage_max_v
uint32_t driver_version
char manufacturer_name[32]
float supply_voltage_min_v
char chip_name[32]