Home | History | Annotate | Download | only in mllite
      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 #include "message_layer.h"
     25 
     26 /**
     27  * @brief  Initializes the MPL. Should be called first and once
     28  * @return Returns INV_SUCCESS if successful or an error code if not.
     29  */
     30 inv_error_t inv_init_mpl(void)
     31 {
     32     inv_init_storage_manager();
     33 
     34     /* initialize the start callback manager */
     35     INV_ERROR_CHECK(inv_init_start_manager());
     36 
     37     /* initialize the data builder */
     38     INV_ERROR_CHECK(inv_init_data_builder());
     39 
     40     INV_ERROR_CHECK(inv_enable_results_holder());
     41 
     42     // Get any left over messages and clear them. Throw message away as it is not
     43     // initialized.
     44     (void)inv_get_message_level_0(1);
     45 
     46     return INV_SUCCESS;
     47 }
     48 
     49 const char ml_ver[] = "InvenSense MA 5.1.6 RC54";
     50 
     51 /**
     52  *  @brief  used to get the MPL version.
     53  *  @param  version     a string where the MPL version gets stored.
     54  *  @return INV_SUCCESS if successful or a non-zero error code otherwise.
     55  */
     56 inv_error_t inv_get_version(char **version)
     57 {
     58     INVENSENSE_FUNC_START;
     59     /* cast out the const */
     60     *version = (char *)&ml_ver;
     61     return INV_SUCCESS;
     62 }
     63 
     64 /**
     65  *  @brief  Starts the MPL. Typically called after inv_init_mpl() or after a
     66  *          inv_stop_mpl() to start the MPL back up an running.
     67  *  @return INV_SUCCESS if successful or a non-zero error code otherwise.
     68  */
     69 inv_error_t inv_start_mpl(void)
     70 {
     71     INV_ERROR_CHECK(inv_execute_mpl_start_notification());
     72     return INV_SUCCESS;
     73 }
     74 
     75 /**
     76  * @}
     77  */
     78