mpu6050.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. #ifndef MPU6050_H
  13. #define MPU6050_H
  14. /*lint ++flb "Enter library region" */
  15. #include <stdbool.h>
  16. #include <stdint.h>
  17. /** @file
  18. * @brief MPU6050 gyro/accelerometer driver.
  19. *
  20. *
  21. * @defgroup nrf_drivers_mpu6050 MPU6050 gyro/accelerometer driver
  22. * @{
  23. * @ingroup nrf_drivers
  24. * @brief MPU6050 gyro/accelerometer driver.
  25. */
  26. /**
  27. * @brief Function for initializing MPU6050 and verifies it's on the bus.
  28. *
  29. * @param device_address Device TWI address in bits [6:0].
  30. * @return
  31. * @retval true MPU6050 found on the bus and ready for operation.
  32. * @retval false MPU6050 not found on the bus or communication failure.
  33. */
  34. bool mpu6050_init(uint8_t device_address);
  35. /**
  36. @brief Function for writing a MPU6050 register contents over TWI.
  37. @param[in] register_address Register address to start writing to
  38. @param[in] value Value to write to register
  39. @retval true Register write succeeded
  40. @retval false Register write failed
  41. */
  42. bool mpu6050_register_write(uint8_t register_address, const uint8_t value);
  43. /**
  44. @brief Function for reading MPU6050 register contents over TWI.
  45. Reads one or more consecutive registers.
  46. @param[in] register_address Register address to start reading from
  47. @param[in] number_of_bytes Number of bytes to read
  48. @param[out] destination Pointer to a data buffer where read data will be stored
  49. @retval true Register read succeeded
  50. @retval false Register read failed
  51. */
  52. bool mpu6050_register_read(uint8_t register_address, uint8_t *destination, uint8_t number_of_bytes);
  53. /**
  54. @brief Function for reading and verifying MPU6050 product ID.
  55. @retval true Product ID is what was expected
  56. @retval false Product ID was not what was expected
  57. */
  58. bool mpu6050_verify_product_id(void);
  59. /**
  60. *@}
  61. **/
  62. /*lint --flb "Leave library region" */
  63. #endif /* MPU6050_H */