ITG1010.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef ITG1010_H
  2. #define ITG1010_H
  3. #include <linux/ioctl.h>
  4. #define ITG1010_I2C_SLAVE_ADDR 0xD0
  5. /* ITG1010 Register Map (Please refer to ITG1010 Specifications) */
  6. #define ITG1010_REG_DEVID 0x75
  7. #define ITG1010_REG_FIFO_EN 0x23
  8. #define ITG1010_REG_AUX_VDD 0x01
  9. #define ITG1010_REG_SAMRT_DIV 0x19
  10. /* set external sync, full-scale range and sample rate, low pass filter bandwidth */
  11. #define ITG1010_REG_CFG 0x1A
  12. #define ITG1010_REG_GYRO_CFG 0x1B /* full-scale range and sample rate, */
  13. #define ITG1010_REG_GYRO_XH 0x43
  14. #define ITG1010_REG_TEMPH 0x41
  15. #define ITG1010_REG_FIFO_CNTH 0x72
  16. #define ITG1010_REG_FIFO_CNTL 0x73
  17. #define ITG1010_REG_FIFO_DATA 0x74
  18. #define ITG1010_REG_FIFO_CTL 0x6A
  19. #define ITG1010_REG_PWR_CTL 0x6B
  20. #define ITG1010_REG_PWR_CTL2 0x6C
  21. /*ITG1010 Register Bit definitions*/
  22. #define ITG1010_FIFO_GYROX_EN 0x40 /* insert the X Gyro data into FIFO */
  23. #define ITG1010_FIFO_GYROY_EN 0x20 /* insert the Y Gyro data into FIFO */
  24. #define ITG1010_FIFO_GYROZ_EN 0x10 /* insert the Z Gyro data into FIFO */
  25. #define ITG1010_AUX_VDDIO_DIS 0x00 /* disable VDD level for the secondary I2C bus clock and data lines */
  26. /* for ITG1010_REG_CFG */
  27. /* 0x05 //captue the state of external frame sync input pin to insert into LSB of registers */
  28. #define ITG1010_EXT_SYNC 0x03
  29. #define ITG1010_SYNC_GYROX 0x02
  30. /* for ITG1010_REG_GYRO_CFG */
  31. #define ITG1010_FS_RANGE 0x03 /* set the full-scale range of the gyro sensors */
  32. #define ITG1010_FS_1000 0x02
  33. #define ITG1010_FS_1000_LSB 33
  34. #define ITG1010_FS_MAX_LSB 131
  35. #define ITG1010_RATE_1K_LPFB_188HZ 0x01
  36. #define ITG1010_RATE_1K_LPFB_256HZ 0x00
  37. #define ITG1010_FIFO_EN 0x40 /* enable FIFO operation for sensor data */
  38. #define ITG1010_FIFO_RST 0x40 /* reset FIFO function */
  39. #define ITG1010_SLEEP 0x40 /* enable low power sleep mode */
  40. #define ITG1010_SUCCESS 0
  41. #define ITG1010_ERR_I2C -1
  42. #define ITG1010_ERR_STATUS -3
  43. #define ITG1010_ERR_SETUP_FAILURE -4
  44. #define ITG1010_ERR_GETGSENSORDATA -5
  45. #define ITG1010_ERR_IDENTIFICATION -6
  46. #define ITG1010_BUFSIZE 60
  47. /* 1 rad = 180/PI degree, MAX_LSB = 131, */
  48. /* 180*131/PI = 7506 */
  49. #define DEGREE_TO_RAD 7506
  50. #endif /* ITG1010_H */