no-OS
adxl345.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __ADXL345_H__
34 #define __ADXL345_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include "no_os_i2c.h"
41 #include "no_os_spi.h"
42 
43 /******************************************************************************/
44 /******************************** ADXL345 *************************************/
45 /******************************************************************************/
46 
47 /* Options for communicating with the device. */
48 #define ADXL345_SPI_COMM 0
49 #define ADXL345_I2C_COMM 1
50 
51 /* I2C address of the device */
52 #define ADXL345_ADDRESS 0x1D
53 
54 /* SPI commands */
55 #define ADXL345_SPI_READ (1 << 7)
56 #define ADXL345_SPI_WRITE (0 << 7)
57 #define ADXL345_SPI_MB (1 << 6)
58 
59 /* ADXL345 Register Map */
60 #define ADXL345_DEVID 0x00 // R Device ID.
61 #define ADXL345_THRESH_TAP 0x1D // R/W Tap threshold.
62 #define ADXL345_OFSX 0x1E // R/W X-axis offset.
63 #define ADXL345_OFSY 0x1F // R/W Y-axis offset.
64 #define ADXL345_OFSZ 0x20 // R/W Z-axis offset.
65 #define ADXL345_DUR 0x21 // R/W Tap duration.
66 #define ADXL345_LATENT 0x22 // R/W Tap latency.
67 #define ADXL345_WINDOW 0x23 // R/W Tap window.
68 #define ADXL345_THRESH_ACT 0x24 // R/W Activity threshold.
69 #define ADXL345_THRESH_INACT 0x25 // R/W Inactivity threshold.
70 #define ADXL345_TIME_INACT 0x26 // R/W Inactivity time.
71 #define ADXL345_ACT_INACT_CTL 0x27 // R/W Axis enable control for activity
72 // and inactivity detection.
73 #define ADXL345_THRESH_FF 0x28 // R/W Free-fall threshold.
74 #define ADXL345_TIME_FF 0x29 // R/W Free-fall time.
75 #define ADXL345_TAP_AXES 0x2A // R/W Axis control for tap/double tap.
76 #define ADXL345_ACT_TAP_STATUS 0x2B // R Source of tap/double tap.
77 #define ADXL345_BW_RATE 0x2C // R/W Data rate and power mode control.
78 #define ADXL345_POWER_CTL 0x2D // R/W Power saving features control.
79 #define ADXL345_INT_ENABLE 0x2E // R/W Interrupt enable control.
80 #define ADXL345_INT_MAP 0x2F // R/W Interrupt mapping control.
81 #define ADXL345_INT_SOURCE 0x30 // R Source of interrupts.
82 #define ADXL345_DATA_FORMAT 0x31 // R/W Data format control.
83 #define ADXL345_DATAX0 0x32 // R X-Axis Data 0.
84 #define ADXL345_DATAX1 0x33 // R X-Axis Data 1.
85 #define ADXL345_DATAY0 0x34 // R Y-Axis Data 0.
86 #define ADXL345_DATAY1 0x35 // R Y-Axis Data 1.
87 #define ADXL345_DATAZ0 0x36 // R Z-Axis Data 0.
88 #define ADXL345_DATAZ1 0x37 // R Z-Axis Data 1.
89 #define ADXL345_FIFO_CTL 0x38 // R/W FIFO control.
90 #define ADXL345_FIFO_STATUS 0x39 // R FIFO status.
91 #define ADXL345_TAP_SIGN 0x3A // R Sign and source for single tap/double tap.
92 #define ADXL345_ORIENT_CONF 0x3B // R/W Orientation configuration.
93 #define ADXL345_ORIENT 0x3C // R Orientation status.
94 
95 /* ADXL345_ACT_INACT_CTL definition */
96 #define ADXL345_ACT_ACDC (1 << 7)
97 #define ADXL345_ACT_X_EN (1 << 6)
98 #define ADXL345_ACT_Y_EN (1 << 5)
99 #define ADXL345_ACT_Z_EN (1 << 4)
100 #define ADXL345_INACT_ACDC (1 << 3)
101 #define ADXL345_INACT_X_EN (1 << 2)
102 #define ADXL345_INACT_Y_EN (1 << 1)
103 #define ADXL345_INACT_Z_EN (1 << 0)
104 
105 /* ADXL345_TAP_AXES definition */
106 #define ADXL345_SUPPRESS (1 << 3)
107 #define ADXL345_TAP_X_EN (1 << 2)
108 #define ADXL345_TAP_Y_EN (1 << 1)
109 #define ADXL345_TAP_Z_EN (1 << 0)
110 
111 /* ADXL345_ACT_TAP_STATUS definition */
112 #define ADXL345_ACT_X_SRC (1 << 6)
113 #define ADXL345_ACT_Y_SRC (1 << 5)
114 #define ADXL345_ACT_Z_SRC (1 << 4)
115 #define ADXL345_ASLEEP (1 << 3)
116 #define ADXL345_TAP_X_SRC (1 << 2)
117 #define ADXL345_TAP_Y_SRC (1 << 1)
118 #define ADXL345_TAP_Z_SRC (1 << 0)
119 
120 /* ADXL345_BW_RATE definition */
121 #define ADXL345_LOW_POWER (1 << 4)
122 #define ADXL345_RATE(x) ((x) & 0xF)
123 
124 /* ADXL345_POWER_CTL definition */
125 #define ADXL345_PCTL_LINK (1 << 5)
126 #define ADXL345_PCTL_AUTO_SLEEP (1 << 4)
127 #define ADXL345_PCTL_MEASURE (1 << 3)
128 #define ADXL345_PCTL_SLEEP (1 << 2)
129 #define ADXL345_PCTL_WAKEUP(x) ((x) & 0x3)
130 
131 /* ADXL345_INT_ENABLE / ADXL345_INT_MAP / ADXL345_INT_SOURCE definition */
132 #define ADXL345_DATA_READY (1 << 7)
133 #define ADXL345_SINGLE_TAP (1 << 6)
134 #define ADXL345_DOUBLE_TAP (1 << 5)
135 #define ADXL345_ACTIVITY (1 << 4)
136 #define ADXL345_INACTIVITY (1 << 3)
137 #define ADXL345_FREE_FALL (1 << 2)
138 #define ADXL345_WATERMARK (1 << 1)
139 #define ADXL345_OVERRUN (1 << 0)
140 #define ADXL345_ORIENTATION (1 << 0)
141 
142 /* ADXL345_DATA_FORMAT definition */
143 #define ADXL345_SELF_TEST (1 << 7)
144 #define ADXL345_SPI (1 << 6)
145 #define ADXL345_INT_INVERT (1 << 5)
146 #define ADXL345_FULL_RES (1 << 3)
147 #define ADXL345_JUSTIFY (1 << 2)
148 #define ADXL345_RANGE(x) ((x) & 0x3)
149 
150 /* ADXL345_RANGE(x) options */
151 #define ADXL345_RANGE_PM_2G 0
152 #define ADXL345_RANGE_PM_4G 1
153 #define ADXL345_RANGE_PM_8G 2
154 #define ADXL345_RANGE_PM_16G 3
155 
156 /* ADXL345_FIFO_CTL definition */
157 #define ADXL345_FIFO_MODE(x) (((x) & 0x3) << 6)
158 #define ADXL345_TRIGGER (1 << 5)
159 #define ADXL345_SAMPLES(x) ((x) & 0x1F)
160 
161 /* ADXL345_FIFO_MODE(x) options */
162 #define ADXL345_FIFO_BYPASS 0
163 #define ADXL345_FIFO_FIFO 1
164 #define ADXL345_FIFO_STREAM 2
165 #define ADXL345_FIFO_TRIGGER 3
166 
167 /* ADXL345_FIFO_STATUS definition */
168 #define ADXL345_FIFO_TRIG (1 << 7)
169 #define ADXL345_ENTRIES(x) ((x) & 0x3F)
170 
171 /* ADXL345_ORIENT_CONF definition */
172 #define ADXL345_INT_ORIENT(x) (((x) & 0x1) << 7)
173 #define ADXL345_DEAD_ZONE(x) (((x) & 0x7) << 4)
174 #define ADXL345_INT_3D(x) (((x) & 0x1) << 3)
175 #define ADXL345_DIVISOR(x) ((x) & 7)
176 
177 /* ADXL345 ID */
178 #define ADXL345_ID 0xE5
179 /* ADXL346 ID */
180 #define ADXL346_ID 0xE6
181 
182 /* ADXL345 Full Resolution Scale Factor */
183 #define ADXL345_SCALE_FACTOR 0.0039
184 
185 /******************************************************************************/
186 /*************************** Types Declarations *******************************/
187 /******************************************************************************/
188 
196 };
197 
211 };
212 
226 };
227 
232 struct adxl345_dev {
242  uint8_t selected_range;
245 };
246 
261  uint8_t selected_range;
264 };
265 
266 /******************************************************************************/
267 /************************ Functions Declarations ******************************/
268 /******************************************************************************/
269 
271 uint8_t adxl345_get_register_value(struct adxl345_dev *dev,
272  uint8_t register_address);
273 
275 void adxl345_set_register_value(struct adxl345_dev *dev,
276  uint8_t register_address,
277  uint8_t register_value);
278 
280 int32_t adxl345_init(struct adxl345_dev **device,
282 
284 int32_t adxl345_remove(struct adxl345_dev *dev);
285 
287 void adxl345_set_power_mode(struct adxl345_dev *dev,
288  uint8_t pwr_mode);
289 
291 void adxl345_get_xyz(struct adxl345_dev *dev,
292  int16_t* x,
293  int16_t* y,
294  int16_t* z);
295 
297 void adxl345_get_g_xyz(struct adxl345_dev *dev,
298  float* x,
299  float* y,
300  float* z);
301 
303 void adxl345_set_tap_detection(struct adxl345_dev *dev,
304  uint8_t tap_type,
305  uint8_t tap_axes,
306  uint8_t tap_dur,
307  uint8_t tap_latent,
308  uint8_t tap_window,
309  uint8_t tap_thresh,
310  uint8_t tap_int);
311 
314  uint8_t act_on_off,
315  uint8_t act_axes,
316  uint8_t act_ac_dc,
317  uint8_t act_thresh,
318  uint8_t act_int);
319 
322  uint8_t inact_on_off,
323  uint8_t inact_axes,
324  uint8_t inact_ac_dc,
325  uint8_t inact_thresh,
326  uint8_t inact_time,
327  uint8_t inact_int);
328 
331  uint8_t ff_on_off,
332  uint8_t ff_thresh,
333  uint8_t ff_time,
334  uint8_t ff_int);
335 
338  uint8_t orient_int,
339  uint8_t orient_on_off,
340  uint8_t int_3d,
341  enum adxl345_dead_zone_angle dead_zone,
342  enum adxl345_divisor_bandwidth divisor);
343 
345 void adxl345_set_offset(struct adxl345_dev *dev,
346  uint8_t x_offset,
347  uint8_t y_offset,
348  uint8_t z_offset);
349 
352  uint8_t g_range,
353  uint8_t full_res);
354 
355 #endif /* __ADXL345_H__ */
adxl345_set_orientation_detection
void adxl345_set_orientation_detection(struct adxl345_dev *dev, uint8_t orient_int, uint8_t orient_on_off, uint8_t int_3d, enum adxl345_dead_zone_angle dead_zone, enum adxl345_divisor_bandwidth divisor)
Enables/disables the orientation detection (only for adxl346).
Definition: adxl345.c:579
ADXL345_WINDOW
#define ADXL345_WINDOW
Definition: adxl345.h:67
adxl345_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: adxl345.h:234
no_os_alloc.h
adxl345_get_g_xyz
void adxl345_get_g_xyz(struct adxl345_dev *dev, float *x, float *y, float *z)
Reads the raw output data of each axis and converts it to g.
Definition: adxl345.c:267
adxl345_init_param
Structure holding the parameters for ADXL345 device initialization.
Definition: adxl345.h:251
ADXL345_OFSY
#define ADXL345_OFSY
Definition: adxl345.h:63
DEGREES_20_4
@ DEGREES_20_4
Definition: adxl345.h:206
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
ADXL345_ACT_INACT_CTL
#define ADXL345_ACT_INACT_CTL
Definition: adxl345.h:71
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
adxl345_set_free_fall_detection
void adxl345_set_free_fall_detection(struct adxl345_dev *dev, uint8_t ff_on_off, uint8_t ff_thresh, uint8_t ff_time, uint8_t ff_int)
Enables/disables the free-fall detection.
Definition: adxl345.c:525
ADXL345_INT_ENABLE
#define ADXL345_INT_ENABLE
Definition: adxl345.h:79
adxl345_init_param::full_resolution_set
uint8_t full_resolution_set
Definition: adxl345.h:263
adxl345_set_range_resolution
void adxl345_set_range_resolution(struct adxl345_dev *dev, uint8_t g_range, uint8_t full_res)
Selects the measurement range.
Definition: adxl345.c:659
ODR_DIV_200
@ ODR_DIV_200
Definition: adxl345.h:222
ADXL345_ACT_Y_EN
#define ADXL345_ACT_Y_EN
Definition: adxl345.h:98
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
adxl345_set_free_fall_detection
void adxl345_set_free_fall_detection(struct adxl345_dev *dev, uint8_t ff_on_off, uint8_t ff_thresh, uint8_t ff_time, uint8_t ff_int)
Enables/disables the free-fall detection.
Definition: adxl345.c:525
ADXL345_SPI_MB
#define ADXL345_SPI_MB
Definition: adxl345.h:57
ADXL345_THRESH_INACT
#define ADXL345_THRESH_INACT
Definition: adxl345.h:69
no_os_spi.h
Header file of SPI Interface.
DEGREES_10_2
@ DEGREES_10_2
Definition: adxl345.h:204
adxl345_dev::communication_type
uint8_t communication_type
Definition: adxl345.h:240
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
ADXL345_ID
#define ADXL345_ID
Definition: adxl345.h:178
DEGREES_41_4
@ DEGREES_41_4
Definition: adxl345.h:210
adxl345_init
int32_t adxl345_init(struct adxl345_dev **device, struct adxl345_init_param init_param)
Initializes the communication peripheral and checks if the ADXL345 part is present.
Definition: adxl345.c:133
adxl345_remove
int32_t adxl345_remove(struct adxl345_dev *dev)
Free the resources allocated by adxl345_init().
Definition: adxl345.c:169
adxl345_set_inactivity_detection
void adxl345_set_inactivity_detection(struct adxl345_dev *dev, uint8_t inact_on_off, uint8_t inact_axes, uint8_t inact_ac_dc, uint8_t inact_thresh, uint8_t inact_time, uint8_t inact_int)
Enables/disables the inactivity detection.
Definition: adxl345.c:460
ADXL345_DIVISOR
#define ADXL345_DIVISOR(x)
Definition: adxl345.h:175
device
Definition: ad9361_util.h:69
DEGREES_36_1
@ DEGREES_36_1
Definition: adxl345.h:209
ADXL345_DEAD_ZONE
#define ADXL345_DEAD_ZONE(x)
Definition: adxl345.h:173
adxl345_init_param::selected_range
uint8_t selected_range
Definition: adxl345.h:261
ADXL345_TIME_INACT
#define ADXL345_TIME_INACT
Definition: adxl345.h:70
adxl345_set_register_value
void adxl345_set_register_value(struct adxl345_dev *dev, uint8_t register_address, uint8_t register_value)
Writes data into a register.
Definition: adxl345.c:97
ADXL345_THRESH_FF
#define ADXL345_THRESH_FF
Definition: adxl345.h:73
ADXL345_LATENT
#define ADXL345_LATENT
Definition: adxl345.h:66
ADXL345_INACT_Z_EN
#define ADXL345_INACT_Z_EN
Definition: adxl345.h:103
ADXL345_DATAX0
#define ADXL345_DATAX0
Definition: adxl345.h:83
adxl345_get_register_value
uint8_t adxl345_get_register_value(struct adxl345_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: adxl345.c:61
adxl345_set_activity_detection
void adxl345_set_activity_detection(struct adxl345_dev *dev, uint8_t act_on_off, uint8_t act_axes, uint8_t act_ac_dc, uint8_t act_thresh, uint8_t act_int)
Enables/disables the activity detection.
Definition: adxl345.c:392
ADXL345_PCTL_MEASURE
#define ADXL345_PCTL_MEASURE
Definition: adxl345.h:127
adxl345_set_register_value
void adxl345_set_register_value(struct adxl345_dev *dev, uint8_t register_address, uint8_t register_value)
Writes data into a register.
Definition: adxl345.c:97
adxl345_init
int32_t adxl345_init(struct adxl345_dev **device, struct adxl345_init_param init_param)
Initializes the communication peripheral and checks if the ADXL345 part is present.
Definition: adxl345.c:133
adxl345_divisor_bandwidth
adxl345_divisor_bandwidth
ADXL346 Divisor bandwidth encoding.
Definition: adxl345.h:217
ADXL345_INACT_Y_EN
#define ADXL345_INACT_Y_EN
Definition: adxl345.h:102
ADXL345_TAP_AXES
#define ADXL345_TAP_AXES
Definition: adxl345.h:75
ADXL345_ACT_ACDC
#define ADXL345_ACT_ACDC
Definition: adxl345.h:96
adxl345_set_offset
void adxl345_set_offset(struct adxl345_dev *dev, uint8_t x_offset, uint8_t y_offset, uint8_t z_offset)
Sets an offset value for each axis (Offset Calibration).
Definition: adxl345.c:628
ADXL345_ACTIVITY
#define ADXL345_ACTIVITY
Definition: adxl345.h:135
ADXL345_INT_ORIENT
#define ADXL345_INT_ORIENT(x)
Definition: adxl345.h:172
adxl345_dev::dev_type
enum adxl345_type dev_type
Definition: adxl345.h:238
adxl345.h
Header file of ADXL345 Driver.
ADXL345_SPI_COMM
#define ADXL345_SPI_COMM
Definition: adxl345.h:48
ADXL345_DOUBLE_TAP
#define ADXL345_DOUBLE_TAP
Definition: adxl345.h:134
ADXL345_POWER_CTL
#define ADXL345_POWER_CTL
Definition: adxl345.h:78
ADXL345_DUR
#define ADXL345_DUR
Definition: adxl345.h:65
ODR_DIV_100
@ ODR_DIV_100
Definition: adxl345.h:221
adxl345_set_tap_detection
void adxl345_set_tap_detection(struct adxl345_dev *dev, uint8_t tap_type, uint8_t tap_axes, uint8_t tap_dur, uint8_t tap_latent, uint8_t tap_window, uint8_t tap_thresh, uint8_t tap_int)
Enables/disables the tap detection.
Definition: adxl345.c:313
adxl345_get_xyz
void adxl345_get_xyz(struct adxl345_dev *dev, int16_t *x, int16_t *y, int16_t *z)
Reads the raw output data of each axis.
Definition: adxl345.c:218
adxl345_init_param::communication_type
uint8_t communication_type
Definition: adxl345.h:259
ADXL345_SPI_READ
#define ADXL345_SPI_READ
Definition: adxl345.h:55
ADXL345_DEVID
#define ADXL345_DEVID
Definition: adxl345.h:60
ADXL345_INT_3D
#define ADXL345_INT_3D(x)
Definition: adxl345.h:174
adxl345_dev
ADXL345 Device structure.
Definition: adxl345.h:232
adxl345_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: adxl345.h:255
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
ADXL345_INACT_ACDC
#define ADXL345_INACT_ACDC
Definition: adxl345.h:100
ADXL345_OFSZ
#define ADXL345_OFSZ
Definition: adxl345.h:64
adxl345_set_power_mode
void adxl345_set_power_mode(struct adxl345_dev *dev, uint8_t pwr_mode)
Places the device into standby/measure mode.
Definition: adxl345.c:193
ADXL345_TAP_Y_EN
#define ADXL345_TAP_Y_EN
Definition: adxl345.h:108
ADXL345_FULL_RES
#define ADXL345_FULL_RES
Definition: adxl345.h:146
adxl345_get_xyz
void adxl345_get_xyz(struct adxl345_dev *dev, int16_t *x, int16_t *y, int16_t *z)
Reads the raw output data of each axis.
Definition: adxl345.c:218
DEGREES_25_5
@ DEGREES_25_5
Definition: adxl345.h:207
ODR_DIV_9
@ ODR_DIV_9
Definition: adxl345.h:218
adxl345_set_range_resolution
void adxl345_set_range_resolution(struct adxl345_dev *dev, uint8_t g_range, uint8_t full_res)
Selects the measurement range.
Definition: adxl345.c:659
ODR_DIV_1600
@ ODR_DIV_1600
Definition: adxl345.h:225
ODR_DIV_400
@ ODR_DIV_400
Definition: adxl345.h:223
adxl345_set_power_mode
void adxl345_set_power_mode(struct adxl345_dev *dev, uint8_t pwr_mode)
Places the device into standby/measure mode.
Definition: adxl345.c:193
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
ADXL345_INT_MAP
#define ADXL345_INT_MAP
Definition: adxl345.h:80
DEGREES_30_8
@ DEGREES_30_8
Definition: adxl345.h:208
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
adxl345_set_activity_detection
void adxl345_set_activity_detection(struct adxl345_dev *dev, uint8_t act_on_off, uint8_t act_axes, uint8_t act_ac_dc, uint8_t act_thresh, uint8_t act_int)
Enables/disables the activity detection.
Definition: adxl345.c:392
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
no_os_i2c.h
Header file of I2C Interface.
adxl345_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: adxl345.h:236
DEGREES_15_2
@ DEGREES_15_2
Definition: adxl345.h:205
adxl345_set_orientation_detection
void adxl345_set_orientation_detection(struct adxl345_dev *dev, uint8_t orient_int, uint8_t orient_on_off, uint8_t int_3d, enum adxl345_dead_zone_angle dead_zone, enum adxl345_divisor_bandwidth divisor)
Enables/disables the orientation detection (only for adxl346).
Definition: adxl345.c:579
ODR_DIV_800
@ ODR_DIV_800
Definition: adxl345.h:224
ADXL345_ACT_X_EN
#define ADXL345_ACT_X_EN
Definition: adxl345.h:97
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
ADXL345_ORIENTATION
#define ADXL345_ORIENTATION
Definition: adxl345.h:140
ODR_DIV_22
@ ODR_DIV_22
Definition: adxl345.h:219
ADXL345_TAP_X_EN
#define ADXL345_TAP_X_EN
Definition: adxl345.h:107
ADXL345_THRESH_TAP
#define ADXL345_THRESH_TAP
Definition: adxl345.h:61
adxl345_set_inactivity_detection
void adxl345_set_inactivity_detection(struct adxl345_dev *dev, uint8_t inact_on_off, uint8_t inact_axes, uint8_t inact_ac_dc, uint8_t inact_thresh, uint8_t inact_time, uint8_t inact_int)
Enables/disables the inactivity detection.
Definition: adxl345.c:460
adxl345_remove
int32_t adxl345_remove(struct adxl345_dev *dev)
Free the resources allocated by adxl345_init().
Definition: adxl345.c:169
adxl345_get_g_xyz
void adxl345_get_g_xyz(struct adxl345_dev *dev, float *x, float *y, float *z)
Reads the raw output data of each axis and converts it to g.
Definition: adxl345.c:267
ADXL345_ORIENT_CONF
#define ADXL345_ORIENT_CONF
Definition: adxl345.h:92
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
ADXL345_SPI_WRITE
#define ADXL345_SPI_WRITE
Definition: adxl345.h:56
ADXL346_ID
#define ADXL346_ID
Definition: adxl345.h:180
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
adxl345_dev::selected_range
uint8_t selected_range
Definition: adxl345.h:242
adxl345_get_register_value
uint8_t adxl345_get_register_value(struct adxl345_dev *dev, uint8_t register_address)
Reads the value of a register.
Definition: adxl345.c:61
ADXL345_SINGLE_TAP
#define ADXL345_SINGLE_TAP
Definition: adxl345.h:133
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
DEGREES_5_1
@ DEGREES_5_1
Definition: adxl345.h:203
ADXL345_SCALE_FACTOR
#define ADXL345_SCALE_FACTOR
Definition: adxl345.h:183
ADXL345_RANGE
#define ADXL345_RANGE(x)
Definition: adxl345.h:148
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
adxl345_set_offset
void adxl345_set_offset(struct adxl345_dev *dev, uint8_t x_offset, uint8_t y_offset, uint8_t z_offset)
Sets an offset value for each axis (Offset Calibration).
Definition: adxl345.c:628
ADXL345_THRESH_ACT
#define ADXL345_THRESH_ACT
Definition: adxl345.h:68
ADXL345_INACT_X_EN
#define ADXL345_INACT_X_EN
Definition: adxl345.h:101
ADXL345_DATA_FORMAT
#define ADXL345_DATA_FORMAT
Definition: adxl345.h:82
ADXL345_TAP_Z_EN
#define ADXL345_TAP_Z_EN
Definition: adxl345.h:109
ADXL345_INACTIVITY
#define ADXL345_INACTIVITY
Definition: adxl345.h:136
adxl345_dev::full_resolution_set
uint8_t full_resolution_set
Definition: adxl345.h:244
ADXL345_ACT_Z_EN
#define ADXL345_ACT_Z_EN
Definition: adxl345.h:99
adxl345_init_param::dev_type
enum adxl345_type dev_type
Definition: adxl345.h:257
ADXL345_OFSX
#define ADXL345_OFSX
Definition: adxl345.h:62
ADXL345_FREE_FALL
#define ADXL345_FREE_FALL
Definition: adxl345.h:137
adxl345_set_tap_detection
void adxl345_set_tap_detection(struct adxl345_dev *dev, uint8_t tap_type, uint8_t tap_axes, uint8_t tap_dur, uint8_t tap_latent, uint8_t tap_window, uint8_t tap_thresh, uint8_t tap_int)
Enables/disables the tap detection.
Definition: adxl345.c:313
adxl345_dead_zone_angle
adxl345_dead_zone_angle
ADXL346 Dead zone angle encoding.
Definition: adxl345.h:202
ID_ADXL346
@ ID_ADXL346
Definition: adxl345.h:195
adxl345_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: adxl345.h:253
ID_ADXL345
@ ID_ADXL345
Definition: adxl345.h:194
adxl345_type
adxl345_type
ADXL345 Supported devices.
Definition: adxl345.h:193
ODR_DIV_50
@ ODR_DIV_50
Definition: adxl345.h:220
ADXL345_TIME_FF
#define ADXL345_TIME_FF
Definition: adxl345.h:74
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140