Icm20948Setup.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * ________________________________________________________________________________________________________
  3. * Copyright (c) 2015-2015 InvenSense Inc. All rights reserved.
  4. *
  5. * This software, related documentation and any modifications thereto (collectively “Software”) is subject
  6. * to InvenSense and its licensors' intellectual property rights under U.S. and international copyright
  7. * and other intellectual property rights laws.
  8. *
  9. * InvenSense and its licensors retain all intellectual property and proprietary rights in and to the Software
  10. * and any use, reproduction, disclosure or distribution of the Software without an express license agreement
  11. * from InvenSense is strictly prohibited.
  12. *
  13. * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
  14. * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  15. * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  16. * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
  17. * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
  18. * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  19. * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  20. * OF THE SOFTWARE.
  21. * ________________________________________________________________________________________________________
  22. */
  23. /** @defgroup DriverIcm20948Setup Icm20948 driver setup
  24. * @brief Low-level function to setup an Icm20948 device
  25. * @ingroup DriverIcm20948
  26. * @{
  27. */
  28. #ifndef _INV_ICM20948_SETUP_H_
  29. #define _INV_ICM20948_SETUP_H_
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include <stdint.h>
  34. #include "InvExport.h"
  35. #include "InvBool.h"
  36. /* forward declaration */
  37. struct inv_icm20948;
  38. /** @brief Sensor identifier for control function
  39. */
  40. enum inv_icm20948_sensor {
  41. INV_ICM20948_SENSOR_ACCELEROMETER,
  42. INV_ICM20948_SENSOR_GYROSCOPE,
  43. INV_ICM20948_SENSOR_RAW_ACCELEROMETER,
  44. INV_ICM20948_SENSOR_RAW_GYROSCOPE,
  45. INV_ICM20948_SENSOR_MAGNETIC_FIELD_UNCALIBRATED,
  46. INV_ICM20948_SENSOR_GYROSCOPE_UNCALIBRATED,
  47. INV_ICM20948_SENSOR_ACTIVITY_CLASSIFICATON,
  48. INV_ICM20948_SENSOR_STEP_DETECTOR,
  49. INV_ICM20948_SENSOR_STEP_COUNTER,
  50. INV_ICM20948_SENSOR_GAME_ROTATION_VECTOR,
  51. INV_ICM20948_SENSOR_ROTATION_VECTOR,
  52. INV_ICM20948_SENSOR_GEOMAGNETIC_ROTATION_VECTOR,
  53. INV_ICM20948_SENSOR_GEOMAGNETIC_FIELD,
  54. INV_ICM20948_SENSOR_WAKEUP_SIGNIFICANT_MOTION,
  55. INV_ICM20948_SENSOR_FLIP_PICKUP,
  56. INV_ICM20948_SENSOR_WAKEUP_TILT_DETECTOR,
  57. INV_ICM20948_SENSOR_GRAVITY,
  58. INV_ICM20948_SENSOR_LINEAR_ACCELERATION,
  59. INV_ICM20948_SENSOR_ORIENTATION,
  60. INV_ICM20948_SENSOR_B2S,
  61. INV_ICM20948_SENSOR_MAX,
  62. };
  63. int INV_EXPORT inv_icm20948_get_whoami(struct inv_icm20948 * s, uint8_t * whoami);
  64. void INV_EXPORT inv_icm20948_init_matrix(struct inv_icm20948 * s);
  65. int INV_EXPORT inv_icm20948_set_matrix(struct inv_icm20948 * s, const float matrix[9], enum inv_icm20948_sensor sensor);
  66. int INV_EXPORT inv_icm20948_initialize(struct inv_icm20948 * s, const uint8_t *dmp3_image, uint32_t dmp3_image_size);
  67. int INV_EXPORT inv_icm20948_init_scale(struct inv_icm20948 * s);
  68. // int INV_EXPORT inv_icm20948_set_wom_threshold(struct inv_icm20948 * s, uint8_t threshold);
  69. int INV_EXPORT inv_icm20948_set_fsr(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, const void * fsr);
  70. int INV_EXPORT inv_icm20948_get_fsr(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, const void * fsr);
  71. int INV_EXPORT inv_icm20948_set_bias(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, const void * bias);
  72. int INV_EXPORT inv_icm20948_get_bias(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, void * bias);
  73. int INV_EXPORT inv_icm20948_initialize_auxiliary(struct inv_icm20948 * s);
  74. int INV_EXPORT inv_icm20948_soft_reset(struct inv_icm20948 * s);
  75. int INV_EXPORT inv_icm20948_enable_sensor(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, inv_bool_t state);
  76. int INV_EXPORT inv_icm20948_set_sensor_period(struct inv_icm20948 * s, enum inv_icm20948_sensor sensor, uint32_t period);
  77. int INV_EXPORT inv_icm20948_enable_batch_timeout(struct inv_icm20948 * s, unsigned short batchTimeoutMs);
  78. int INV_EXPORT inv_icm20948_poll_sensor(struct inv_icm20948 * s, void * context,
  79. void (*handler)(void * context, enum inv_icm20948_sensor sensor, uint64_t timestamp, const void * data, const void *arg));
  80. int INV_EXPORT inv_icm20948_load(struct inv_icm20948 * s, const uint8_t * image, unsigned short size);
  81. int INV_EXPORT inv_icm20948_init_structure(struct inv_icm20948 * s);
  82. enum inv_icm20948_sensor INV_EXPORT inv_icm20948_sensor_android_2_sensor_type(int sensor);
  83. /** @brief Have the chip to enter low-power or low-noise mode
  84. * @param[in] lowpower_or_highperformance 0=low-power, 1=low-noise
  85. */
  86. int INV_EXPORT inv_icm20948_set_lowpower_or_highperformance(struct inv_icm20948 * s, uint8_t lowpower_or_highperformance);
  87. int INV_EXPORT inv_icm20948_get_lowpower_or_highperformance(struct inv_icm20948 * s, uint8_t * lowpower_or_highperformance);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* _INV_ICM20948_SETUP_H_ */
  92. /** @} */