1/*
2 $License:
3    Copyright (C) 2011-2012 InvenSense Corporation, All Rights Reserved.
4    See included License.txt for License information.
5 $
6 */
7/**
8 *   @defgroup  MPL mpl
9 *   @brief     Motion Library - Start Point
10 *              Initializes MPL.
11 *
12 *   @{
13 *       @file  mpl.c
14 *       @brief MPL start point.
15 */
16
17#include "storage_manager.h"
18#include "log.h"
19#include "mpl.h"
20#include "start_manager.h"
21#include "data_builder.h"
22#include "results_holder.h"
23#include "mlinclude.h"
24
25/**
26 * @brief  Initializes the MPL. Should be called first and once
27 * @return Returns INV_SUCCESS if successful or an error code if not.
28 */
29inv_error_t inv_init_mpl(void)
30{
31    inv_init_storage_manager();
32
33    /* initialize the start callback manager */
34    INV_ERROR_CHECK(inv_init_start_manager());
35
36    /* initialize the data builder */
37    INV_ERROR_CHECK(inv_init_data_builder());
38
39    INV_ERROR_CHECK(inv_enable_results_holder());
40
41    return INV_SUCCESS;
42}
43
44const char ml_ver[] = "InvenSense MPL 5.1.2 beta RC9";
45
46/**
47 *  @brief  used to get the MPL version.
48 *  @param  version     a string where the MPL version gets stored.
49 *  @return INV_SUCCESS if successful or a non-zero error code otherwise.
50 */
51inv_error_t inv_get_version(char **version)
52{
53    INVENSENSE_FUNC_START;
54    /* cast out the const */
55    *version = (char *)&ml_ver;
56    return INV_SUCCESS;
57}
58
59/**
60 *  @brief  Starts the MPL. Typically called after inv_init_mpl() or after a
61 *          inv_stop_mpl() to start the MPL back up an running.
62 *  @return INV_SUCCESS if successful or a non-zero error code otherwise.
63 */
64inv_error_t inv_start_mpl(void)
65{
66    INV_ERROR_CHECK(inv_execute_mpl_start_notification());
67    return INV_SUCCESS;
68}
69
70/**
71 * @}
72 */
73