mpl.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #include "storage_manager.h"
  17. #include "log.h"
  18. #include "mpl.h"
  19. #include "start_manager.h"
  20. #include "data_builder.h"
  21. #include "results_holder.h"
  22. #include "mlinclude.h"
  23. /**
  24. * @brief Initializes the MPL. Should be called first and once
  25. * @return Returns INV_SUCCESS if successful or an error code if not.
  26. */
  27. inv_error_t inv_init_mpl(void)
  28. {
  29. inv_init_storage_manager();
  30. /* initialize the start callback manager */
  31. INV_ERROR_CHECK(inv_init_start_manager());
  32. /* initialize the data builder */
  33. INV_ERROR_CHECK(inv_init_data_builder());
  34. INV_ERROR_CHECK(inv_enable_results_holder());
  35. return INV_SUCCESS;
  36. }
  37. const char ml_ver[] = "InvenSense MA 5.1.2";
  38. /**
  39. * @brief used to get the MPL version.
  40. * @param version a string where the MPL version gets stored.
  41. * @return INV_SUCCESS if successful or a non-zero error code otherwise.
  42. */
  43. inv_error_t inv_get_version(char **version)
  44. {
  45. INVENSENSE_FUNC_START;
  46. /* cast out the const */
  47. *version = (char *)&ml_ver;
  48. return INV_SUCCESS;
  49. }
  50. /**
  51. * @brief Starts the MPL. Typically called after inv_init_mpl() or after a
  52. * inv_stop_mpl() to start the MPL back up an running.
  53. * @return INV_SUCCESS if successful or a non-zero error code otherwise.
  54. */
  55. inv_error_t inv_start_mpl(void)
  56. {
  57. INV_ERROR_CHECK(inv_execute_mpl_start_notification());
  58. return INV_SUCCESS;
  59. }
  60. /**
  61. * @}
  62. */