1 /*
2  $License:
3     Copyright (C) 2012 InvenSense Corporation, All Rights Reserved.
4  $
5  */
6 
7 /*******************************************************************************
8  *
9  * $Id:$
10  *
11  ******************************************************************************/
12 
13 #ifndef INV_CONSTRUCTOR_H__
14 #define INV_CONSTRUCTOR_H__
15 
16 #include "mltypes.h"
17 #include "data_builder.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define PRECISION 10000.f
24 #define RANGE_FLOAT_TO_FIXEDPOINT(range, x) {               \
25     range.mantissa = (long)x;                               \
26     range.fraction = (long)((float)(x-(long)x)*PRECISION);  \
27 }
28 #define RANGE_FIXEDPOINT_TO_FLOAT(range, x) {   \
29     x = (float)(range.mantissa);                \
30     x += ((float)range.fraction/PRECISION);     \
31 }
32 
33 struct fifo_dmp_config {
34     unsigned char sample_divider;
35     unsigned char fifo_divider;
36     unsigned char mpl_divider;
37 };
38 
39 inv_error_t inv_construct_and_push_data();
40 inv_error_t inv_set_fifo_processed_callback(void (*func_cb)(void));
41 inv_error_t inv_constructor_setup();
42 inv_error_t inv_constructor_start();
43 inv_error_t inv_constructor_init();
44 inv_error_t inv_constructor_default_enable();
45 void inv_set_debug_mode(rd_dbg_mode mode);
46 inv_error_t inv_playback();
47 void inv_set_playback_filename(char *filename, int length);
48 inv_error_t wait_for_and_process_interrupt();
49 
50 inv_error_t inv_set_interrupt_word(unsigned long word);
51 inv_error_t inv_get_interrupt_word(unsigned long *data);
52 inv_error_t inv_set_gesture_enable(int word);
53 int inv_get_gesture_enable(void);
54 inv_error_t inv_set_fifo_rate(unsigned long fifo_rate);
55 inv_error_t inv_get_dmp_sample_divider(unsigned char *data);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif // INVENSENSE_INV_CONSTRUCTOR_H__
62 
63