1/*
2 $License:
3   Copyright 2011 InvenSense, Inc.
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16  $
17 */
18/***************************************************************************** *
19 * $Id: mldmp.h 5629 2011-06-11 03:13:08Z mcaramello $
20 ******************************************************************************/
21
22/**
23 * @defgroup MLDMP
24 * @brief
25 *
26 *  These are the top level functions that define how to load the MPL.  In order
27 *  to use most of the features, the DMP must be loaded with some code.  The
28 *  loading procedure takes place when calling inv_dmp_open with a given DMP set
29 *  function, after having open the serial communication with the device via
30 *  inv_serial_start().
31 *  The DMP set function will load the DMP memory and enable a certain
32 *  set of features.
33 *
34 *  First select a DMP version from one of the released DMP sets.
35 *  These could be:
36 *  - DMP default to load and use the default DMP code featuring pedometer,
37 *    gestures, and orientation.  Use inv_dmp_open().
38 *  - DMP pedometer stand-alone to load and use the standalone pedometer
39 *    implementation. Use inv_open_low_power_pedometer().
40 *  <!-- - DMP EIS ... Use inv_eis_open_dmp(). -->
41 *
42 *  After inv_dmp_openXXX any number of appropriate initialization and configuration
43 *  routines can be called. Each one of these routines will return an error code
44 *  and will check to make sure that it is compatible with the the DMP version
45 *  selected during the call to inv_dmp_open.
46 *
47 *  Once the configuration is complete, make a call to inv_dmp_start(). This will
48 *  finally turn on the DMP and run the code previously loaded.
49 *
50 *  While the DMP is running, all data fetching, polling or other functions can
51 *  be called and will return valid data. Some parameteres can be changed while
52 *  the DMP is runing, while others cannot.  Therefore it is important to always
53 *  check the return code of each function.  Check the error code list in mltypes
54 *  to know what each returned error corresponds to.
55 *
56 *  When no more motion processing is required, the library can be shut down and
57 *  the DMP turned off.  We can do that by calling inv_dmp_close().  Note that
58 *  inv_dmp_close() will not close the serial communication automatically, which will
59 *  remain open an active, in case another module needs to be loaded instead.
60 *  If the intention is shutting down the MPL as well, an explicit call to
61 *  inv_serial_stop() following inv_dmp_close() has to be made.
62 *
63 *  The MPL additionally implements a basic state machine, whose purpose is to
64 *  give feedback to the user on whether he is following all the required
65 *  initialization steps.  If an anomalous transition is detected, the user will
66 *  be warned by a terminal message with the format:
67 *
68 *  <tt>"Error : illegal state transition from STATE_1 to STATE_3"</tt>
69 *
70 *  @{
71 *      @file     mldmp.h
72 *      @brief    Top level entry functions to the MPL library with DMP support
73 */
74
75#ifndef MLDMP_H
76#define MLDMP_H
77#ifdef INV_INCLUDE_LEGACY_HEADERS
78#include "mldmp_legacy.h"
79#endif
80
81#ifdef __cplusplus
82extern "C" {
83#endif
84
85    inv_error_t inv_dmp_open(void);
86    inv_error_t inv_dmp_start(void);
87    inv_error_t inv_dmp_stop(void);
88    inv_error_t inv_dmp_close(void);
89
90#ifdef __cplusplus
91}
92#endif
93#endif                          /* MLDMP_H */
94/**
95 * @}
96**/
97