LibDriver ADXL345  2.0.0
ADXL345 full-featured driver
driver_adxl345_basic.c
Go to the documentation of this file.
1 
38 #include "driver_adxl345_basic.h"
39 
40 static adxl345_handle_t gs_handle;
52 {
53  uint8_t res;
54  int8_t reg;
55 
56  /* link interface function */
69 
70  /* set the interface */
71  res = adxl345_set_interface(&gs_handle, interface);
72  if (res != 0)
73  {
74  adxl345_interface_debug_print("adxl345: set interface failed.\n");
75 
76  return 1;
77  }
78 
79  /* set addr pin */
80  res = adxl345_set_addr_pin(&gs_handle, addr_pin);
81  if (res != 0)
82  {
83  adxl345_interface_debug_print("adxl345: set addr pin failed.\n");
84 
85  return 1;
86  }
87 
88  /* adxl345 initialization */
89  res = adxl345_init(&gs_handle);
90  if (res != 0)
91  {
92  adxl345_interface_debug_print("adxl345: init failed.\n");
93 
94  return 1;
95  }
96 
97  /* set default rate */
99  if (res != 0)
100  {
101  adxl345_interface_debug_print("adxl345: set rate failed.\n");
102  (void)adxl345_deinit(&gs_handle);
103 
104  return 1;
105  }
106 
107  /* set default spi wire */
109  if (res != 0)
110  {
111  adxl345_interface_debug_print("adxl345: set spi wire failed.\n");
112  (void)adxl345_deinit(&gs_handle);
113 
114  return 1;
115  }
116 
117  /* set interrupt pin */
119  if (res != 0)
120  {
121  adxl345_interface_debug_print("adxl345: set adxl345 set interrupt active level failed.\n");
122  (void)adxl345_deinit(&gs_handle);
123 
124  return 1;
125  }
126 
127  /* set full resolution */
129  if (res != 0)
130  {
131  adxl345_interface_debug_print("adxl345: set full resolution failed.\n");
132  (void)adxl345_deinit(&gs_handle);
133 
134  return 1;
135  }
136 
137  /* set auto sleep */
139  if (res != 0)
140  {
141  adxl345_interface_debug_print("adxl345: set auto sleep failed.\n");
142  (void)adxl345_deinit(&gs_handle);
143 
144  return 1;
145  }
146 
147  /* set sleep */
149  if (res != 0)
150  {
151  adxl345_interface_debug_print("adxl345: set sleep failed.\n");
152  (void)adxl345_deinit(&gs_handle);
153 
154  return 1;
155  }
156 
157  /* set sleep frequency */
159  if (res != 0)
160  {
161  adxl345_interface_debug_print("adxl345: set sleep frequency failed.\n");
162  (void)adxl345_deinit(&gs_handle);
163 
164  return 1;
165  }
166 
167  /* set justify */
169  if (res != 0)
170  {
171  adxl345_interface_debug_print("adxl345: set justify failed.\n");
172  (void)adxl345_deinit(&gs_handle);
173 
174  return 1;
175  }
176 
177  /* set range */
179  if (res != 0)
180  {
181  adxl345_interface_debug_print("adxl345: set range failed.\n");
182  (void)adxl345_deinit(&gs_handle);
183 
184  return 1;
185  }
186 
187  /* set mode */
188  res = adxl345_set_mode(&gs_handle, ADXL345_BASIC_DEFAULT_MODE);
189  if (res != 0)
190  {
191  adxl345_interface_debug_print("adxl345: set mode failed.\n");
192  (void)adxl345_deinit(&gs_handle);
193 
194  return 1;
195  }
196 
197  /* set trigger pin */
199  if (res != 0)
200  {
201  adxl345_interface_debug_print("adxl345: set trigger pin failed.\n");
202  (void)adxl345_deinit(&gs_handle);
203 
204  return 1;
205  }
206 
207  /* set watermark level */
209  if (res != 0)
210  {
211  adxl345_interface_debug_print("adxl345: set watermark failed.\n");
212  (void)adxl345_deinit(&gs_handle);
213 
214  return 1;
215  }
216 
217  /* set default offset */
218  res = adxl345_offset_convert_to_register(&gs_handle, ADXL345_BASIC_DEFAULT_OFFSET, (int8_t *)&reg);
219  if (res != 0)
220  {
221  adxl345_interface_debug_print("adxl345: offset convert to register failed.\n");
222  (void)adxl345_deinit(&gs_handle);
223 
224  return 1;
225  }
226  res = adxl345_set_offset(&gs_handle, reg, reg, reg);
227  if (res != 0)
228  {
229  adxl345_interface_debug_print("adxl345: set offset failed.\n");
230  (void)adxl345_deinit(&gs_handle);
231 
232  return 1;
233  }
234 
235  /* set default tap threshold */
237  if (res != 0)
238  {
239  adxl345_interface_debug_print("adxl345: tap threshold convert to register failed.\n");
240  (void)adxl345_deinit(&gs_handle);
241 
242  return 1;
243  }
244  res = adxl345_set_tap_threshold(&gs_handle, reg);
245  if (res != 0)
246  {
247  adxl345_interface_debug_print("adxl345: set tap threshold failed.\n");
248  (void)adxl345_deinit(&gs_handle);
249 
250  return 1;
251  }
252 
253  /* set default duration */
254  res = adxl345_duration_convert_to_register(&gs_handle, ADXL345_BASIC_DEFAULT_DURATION, (uint8_t *)&reg);
255  if (res != 0)
256  {
257  adxl345_interface_debug_print("adxl345: duration convert to register failed.\n");
258  (void)adxl345_deinit(&gs_handle);
259 
260  return 1;
261  }
262  res = adxl345_set_duration(&gs_handle, reg);
263  if (res != 0)
264  {
265  adxl345_interface_debug_print("adxl345: set duration failed.\n");
266  (void)adxl345_deinit(&gs_handle);
267 
268  return 1;
269  }
270 
271  /* set latent time */
272  res = adxl345_latent_convert_to_register(&gs_handle, ADXL345_BASIC_DEFAULT_LATENT, (uint8_t *)&reg);
273  if (res != 0)
274  {
275  adxl345_interface_debug_print("adxl345: latent convert to register failed.\n");
276  (void)adxl345_deinit(&gs_handle);
277 
278  return 1;
279  }
280  res = adxl345_set_latent(&gs_handle, reg);
281  if (res != 0)
282  {
283  adxl345_interface_debug_print("adxl345: set latent failed.\n");
284  (void)adxl345_deinit(&gs_handle);
285 
286  return 1;
287  }
288 
289  /* set window time */
290  res = adxl345_window_convert_to_register(&gs_handle, ADXL345_BASIC_DEFAULT_WINDOW, (uint8_t *)&reg);
291  if (res != 0)
292  {
293  adxl345_interface_debug_print("adxl345: window convert to register failed.\n");
294  (void)adxl345_deinit(&gs_handle);
295 
296  return 1;
297  }
298  res = adxl345_set_window(&gs_handle, reg);
299  if (res != 0)
300  {
301  adxl345_interface_debug_print("adxl345: set window failed.\n");
302  (void)adxl345_deinit(&gs_handle);
303 
304  return 1;
305  }
306 
307  /* disable tap */
309  if (res != 0)
310  {
311  adxl345_interface_debug_print("adxl345: set tap axis failed.\n");
312  (void)adxl345_deinit(&gs_handle);
313 
314  return 1;
315  }
317  if (res != 0)
318  {
319  adxl345_interface_debug_print("adxl345: set tap axis failed.\n");
320  (void)adxl345_deinit(&gs_handle);
321 
322  return 1;
323  }
325  if (res != 0)
326  {
327  adxl345_interface_debug_print("adxl345: set tap axis failed.\n");
328  (void)adxl345_deinit(&gs_handle);
329 
330  return 1;
331  }
332 
333  /* set default suppress */
335  if (res != 0)
336  {
337  adxl345_interface_debug_print("adxl345: set tap suppress failed.\n");
338  (void)adxl345_deinit(&gs_handle);
339 
340  return 1;
341  }
342 
343  /* set default single tap map */
345  if (res != 0)
346  {
347  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
348  (void)adxl345_deinit(&gs_handle);
349 
350  return 1;
351  }
352 
353  /* disable single tap */
355  if (res != 0)
356  {
357  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
358  (void)adxl345_deinit(&gs_handle);
359 
360  return 1;
361  }
362 
363  /* set default double tap map */
365  if (res != 0)
366  {
367  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
368  (void)adxl345_deinit(&gs_handle);
369 
370  return 1;
371  }
372 
373  /* disable double tap */
375  if (res != 0)
376  {
377  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
378  (void)adxl345_deinit(&gs_handle);
379 
380  return 1;
381  }
382 
383  /* set default linking activity and inactivity */
385  if (res != 0)
386  {
387  adxl345_interface_debug_print("adxl345: set link activity inactivity failed.\n");
388  (void)adxl345_deinit(&gs_handle);
389 
390  return 1;
391  }
392 
393  /* set default action threshold */
395  if (res != 0)
396  {
397  adxl345_interface_debug_print("adxl345: action threshold convert to register failed.\n");
398  (void)adxl345_deinit(&gs_handle);
399 
400  return 1;
401  }
402  res = adxl345_set_action_threshold(&gs_handle, reg);
403  if (res != 0)
404  {
405  adxl345_interface_debug_print("adxl345: set action threshold failed.\n");
406  (void)adxl345_deinit(&gs_handle);
407 
408  return 1;
409  }
410 
411  /* set default inaction threshold */
413  if (res != 0)
414  {
415  adxl345_interface_debug_print("adxl345: inaction threshold convert to register failed.\n");
416  (void)adxl345_deinit(&gs_handle);
417 
418  return 1;
419  }
420  res = adxl345_set_inaction_threshold(&gs_handle, reg);
421  if (res != 0)
422  {
423  adxl345_interface_debug_print("adxl345: set inaction threshold failed.\n");
424  (void)adxl345_deinit(&gs_handle);
425 
426  return 1;
427  }
428 
429  /* set default inaction time */
431  if (res != 0)
432  {
433  adxl345_interface_debug_print("adxl345: inaction time convert to register failed.\n");
434  (void)adxl345_deinit(&gs_handle);
435 
436  return 1;
437  }
438  res = adxl345_set_inaction_time(&gs_handle, reg);
439  if (res != 0)
440  {
441  adxl345_interface_debug_print("adxl345: set inaction time failed.\n");
442  (void)adxl345_deinit(&gs_handle);
443 
444  return 1;
445  }
446 
447  /* disable action */
449  if (res != 0)
450  {
451  adxl345_interface_debug_print("adxl345: set action inaction failed.\n");
452  (void)adxl345_deinit(&gs_handle);
453 
454  return 1;
455  }
457  if (res != 0)
458  {
459  adxl345_interface_debug_print("adxl345: set action inaction failed.\n");
460  (void)adxl345_deinit(&gs_handle);
461 
462  return 1;
463  }
465  if (res != 0)
466  {
467  adxl345_interface_debug_print("adxl345: set action inaction failed.\n");
468  (void)adxl345_deinit(&gs_handle);
469 
470  return 1;
471  }
473  if (res != 0)
474  {
475  adxl345_interface_debug_print("adxl345: set action inaction failed.\n");
476  (void)adxl345_deinit(&gs_handle);
477 
478  return 1;
479  }
481  if (res != 0)
482  {
483  adxl345_interface_debug_print("adxl345: set action inaction failed.\n");
484  (void)adxl345_deinit(&gs_handle);
485 
486  return 1;
487  }
489  if (res != 0)
490  {
491  adxl345_interface_debug_print("adxl345: set action inaction failed.\n");
492  (void)adxl345_deinit(&gs_handle);
493 
494  return 1;
495  }
496 
497  /* set default action coupled */
499  if (res != 0)
500  {
501  adxl345_interface_debug_print("adxl345: set action coupled failed.\n");
502  (void)adxl345_deinit(&gs_handle);
503 
504  return 1;
505  }
506 
507  /* set default inaction coupled */
509  if (res != 0)
510  {
511  adxl345_interface_debug_print("adxl345: set inaction coupled failed.\n");
512  (void)adxl345_deinit(&gs_handle);
513 
514  return 1;
515  }
516 
517  /* set default activity map */
519  if (res != 0)
520  {
521  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
522  (void)adxl345_deinit(&gs_handle);
523 
524  return 1;
525  }
526 
527  /* disable activity interrupt */
529  if (res != 0)
530  {
531  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
532  (void)adxl345_deinit(&gs_handle);
533 
534  return 1;
535  }
536 
537  /* set default inactivity map */
539  if (res != 0)
540  {
541  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
542  (void)adxl345_deinit(&gs_handle);
543 
544  return 1;
545  }
546 
547  /* disable inactivity interrupt */
549  if (res != 0)
550  {
551  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
552  (void)adxl345_deinit(&gs_handle);
553 
554  return 1;
555  }
556 
557  /* set free fall threshold */
559  if (res != 0)
560  {
561  adxl345_interface_debug_print("adxl345: free fall threshold convert to register failed.\n");
562  (void)adxl345_deinit(&gs_handle);
563 
564  return 1;
565  }
566  res = adxl345_set_free_fall_threshold(&gs_handle, reg);
567  if (res != 0)
568  {
569  adxl345_interface_debug_print("adxl345: set free fall threshold failed.\n");
570  (void)adxl345_deinit(&gs_handle);
571 
572  return 1;
573  }
574 
575  /* set free fall time */
577  if (res != 0)
578  {
579  adxl345_interface_debug_print("adxl345: free fall time convert to register failed.\n");
580  (void)adxl345_deinit(&gs_handle);
581 
582  return 1;
583  }
584  res = adxl345_set_free_fall_time(&gs_handle, reg);
585  if (res != 0)
586  {
587  adxl345_interface_debug_print("adxl345: set free fall time failed.\n");
588  (void)adxl345_deinit(&gs_handle);
589 
590  return 1;
591  }
592 
593  /* set default free fall map */
595  if (res != 0)
596  {
597  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
598  (void)adxl345_deinit(&gs_handle);
599 
600  return 1;
601  }
602 
603  /* disable free fall interrupt */
605  if (res != 0)
606  {
607  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
608  (void)adxl345_deinit(&gs_handle);
609 
610  return 1;
611  }
612 
613  /* set default data ready map */
615  if (res != 0)
616  {
617  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
618  (void)adxl345_deinit(&gs_handle);
619 
620  return 1;
621  }
623  if (res != 0)
624  {
625  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
626  (void)adxl345_deinit(&gs_handle);
627 
628  return 1;
629  }
630 
631  /* set default watermark map */
633  if (res != 0)
634  {
635  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
636  (void)adxl345_deinit(&gs_handle);
637 
638  return 1;
639  }
641  if (res != 0)
642  {
643  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
644  (void)adxl345_deinit(&gs_handle);
645 
646  return 1;
647  }
648 
649  /* set default overrun map */
651  if (res != 0)
652  {
653  adxl345_interface_debug_print("adxl345: set interrupt map failed.\n");
654  (void)adxl345_deinit(&gs_handle);
655 
656  return 1;
657  }
659  if (res != 0)
660  {
661  adxl345_interface_debug_print("adxl345: set interrupt failed.\n");
662  (void)adxl345_deinit(&gs_handle);
663 
664  return 1;
665  }
666 
667  /* start measure */
668  res = adxl345_set_measure(&gs_handle, ADXL345_BOOL_TRUE);
669  if (res != 0)
670  {
671  adxl345_interface_debug_print("adxl345: set measure failed.\n");
672  (void)adxl345_deinit(&gs_handle);
673 
674  return 1;
675  }
676 
677  return 0;
678 }
679 
688 uint8_t adxl345_basic_read(float g[3])
689 {
690  int16_t r[3];
691  float g_out[3];
692  uint16_t len;
693 
694  len = 1;
695 
696  /* read data */
697  if (adxl345_read(&gs_handle, (int16_t (*)[3])&r, (float (*)[3])&g_out, (uint16_t *)&len) != 0)
698  {
699  return 1;
700  }
701 
702  /* copy data */
703  g[0] = g_out[0];
704  g[1] = g_out[1];
705  g[2] = g_out[2];
706 
707  return 0;
708 }
709 
717 uint8_t adxl345_basic_deinit(void)
718 {
719  if (adxl345_deinit(&gs_handle) != 0)
720  {
721  return 1;
722  }
723  else
724  {
725  return 0;
726  }
727 }
driver adxl345 basic header file
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_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_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_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_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_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_set_link_activity_inactivity(adxl345_handle_t *handle, adxl345_bool_t enable)
enable or disable the activity and inactivity linking
uint8_t adxl345_set_action_threshold(adxl345_handle_t *handle, uint8_t threshold)
set the action 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_read(adxl345_handle_t *handle, int16_t(*raw)[3], float(*g)[3], uint16_t *len)
read the data
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_set_addr_pin(adxl345_handle_t *handle, adxl345_address_t addr_pin)
set the iic address pin
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_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_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_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_set_free_fall_time(adxl345_handle_t *handle, uint8_t t)
set the free fall time
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
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
uint8_t adxl345_set_action_coupled(adxl345_handle_t *handle, adxl345_coupled_t coupled)
set the action coupled
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_set_mode(adxl345_handle_t *handle, adxl345_mode_t mode)
set the chip mode
uint8_t adxl345_set_tap_threshold(adxl345_handle_t *handle, uint8_t threshold)
set the tap threshold
uint8_t adxl345_set_range(adxl345_handle_t *handle, adxl345_range_t range)
set the chip range
@ ADXL345_ACTION_Z
@ ADXL345_INACTION_Z
@ ADXL345_INACTION_X
@ ADXL345_INACTION_Y
@ ADXL345_ACTION_X
@ ADXL345_ACTION_Y
@ ADXL345_TAP_AXIS_Z
@ ADXL345_TAP_AXIS_Y
@ ADXL345_TAP_AXIS_X
@ ADXL345_BOOL_FALSE
@ ADXL345_BOOL_TRUE
#define ADXL345_BASIC_DEFAULT_INTERRUPT_DATA_READY
#define ADXL345_BASIC_DEFAULT_FREE_FALL_THRESHOLD
#define ADXL345_BASIC_DEFAULT_INTERRUPT_ACTIVITY_MAP
#define ADXL345_BASIC_DEFAULT_INTERRUPT_WATERMARK_MAP
#define ADXL345_BASIC_DEFAULT_INTERRUPT_SINGLE_TAP_MAP
#define ADXL345_BASIC_DEFAULT_INACTION_TIME
#define ADXL345_BASIC_DEFAULT_JUSTIFY
#define ADXL345_BASIC_DEFAULT_INTERRUPT_OVERRUN_MAP
#define ADXL345_BASIC_DEFAULT_INTERRUPT_WATERMARK
#define ADXL345_BASIC_DEFAULT_SLEEP_FREQUENCY
#define ADXL345_BASIC_DEFAULT_INTERRUPT_INACTIVITY_MAP
#define ADXL345_BASIC_DEFAULT_RANGE
#define ADXL345_BASIC_DEFAULT_INTERRUPT_FREE_FALL_MAP
#define ADXL345_BASIC_DEFAULT_INACTION_COUPLED
#define ADXL345_BASIC_DEFAULT_TAP_SUPPRESS
#define ADXL345_BASIC_DEFAULT_INTERRUPT_DOUBLE_TAP_MAP
uint8_t adxl345_basic_read(float g[3])
basic example read
#define ADXL345_BASIC_DEFAULT_FREE_FALL_TIME
#define ADXL345_BASIC_DEFAULT_AUTO_SLEEP
#define ADXL345_BASIC_DEFAULT_LATENT
#define ADXL345_BASIC_DEFAULT_MODE
#define ADXL345_BASIC_DEFAULT_INACTION_THRESHOLD
#define ADXL345_BASIC_DEFAULT_INTERRUPT_OVERRUN
#define ADXL345_BASIC_DEFAULT_SLEEP
#define ADXL345_BASIC_DEFAULT_FULL_RESOLUTION
#define ADXL345_BASIC_DEFAULT_ACTION_COUPLED
#define ADXL345_BASIC_DEFAULT_LINK_ACTIVITY_INACTIVITY
#define ADXL345_BASIC_DEFAULT_SPI_WIRE
#define ADXL345_BASIC_DEFAULT_TRIGGER_PIN
uint8_t adxl345_basic_deinit(void)
basic example deinit
#define ADXL345_BASIC_DEFAULT_OFFSET
#define ADXL345_BASIC_DEFAULT_RATE
adxl345 basic example default definition
#define ADXL345_BASIC_DEFAULT_ACTION_THRESHOLD
#define ADXL345_BASIC_DEFAULT_INTERRUPT_ACTIVE_LEVEL
#define ADXL345_BASIC_DEFAULT_INTERRUPT_DATA_READY_MAP
#define ADXL345_BASIC_DEFAULT_WINDOW
#define ADXL345_BASIC_DEFAULT_TAP_THRESHOLD
uint8_t adxl345_basic_init(adxl345_interface_t interface, adxl345_address_t addr_pin)
basic example init
#define ADXL345_BASIC_DEFAULT_DURATION
#define ADXL345_BASIC_DEFAULT_WATERMARK
uint8_t adxl345_set_watermark(adxl345_handle_t *handle, uint8_t level)
set the fifo watermark
uint8_t adxl345_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t adxl345_interface_spi_deinit(void)
interface spi bus deinit
uint8_t adxl345_interface_iic_deinit(void)
interface iic bus deinit
uint8_t adxl345_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
void adxl345_interface_receive_callback(uint8_t type)
interface receive callback
uint8_t adxl345_interface_iic_init(void)
interface iic bus init
uint8_t adxl345_interface_spi_init(void)
interface spi bus init
uint8_t adxl345_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
void adxl345_interface_delay_ms(uint32_t ms)
interface delay ms
void adxl345_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t adxl345_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
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_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
@ 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