bmp180.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* BOSCH Pressure Sensor Driver
  2. *
  3. * This software is licensed under the terms of the GNU General Public
  4. * License version 2, as published by the Free Software Foundation, and
  5. * may be copied, distributed, and modified under those terms.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef BOSCH_BARO_H
  14. #define BOSCH_BARO_H
  15. #include <linux/ioctl.h>
  16. /*****************************************************
  17. | sensor | chip id | 7-bit i2c address |
  18. -----------------------------------------------------|
  19. | bmp180 | 0x55 | 0x77 |
  20. *****************************************************/
  21. /* apply low pass filter on output */
  22. #define CONFIG_BMP_LOWPASS
  23. /*#define CONFIG_ID_TEMPERATURE*/
  24. /*#define CONFIG_I2C_BASIC_FUNCTION*/
  25. #define BMP_DRIVER_VERSION "V1.5"
  26. #define BMP_DEV_NAME "bmp180"
  27. #define C_MAX_FIR_LENGTH (32)
  28. #define MAX_SENSOR_NAME (32)
  29. #define BMP_DATA_NUM 1
  30. #define BMP_PRESSURE 0
  31. #define BMP_BUFSIZE 128
  32. /* common definition */
  33. #define BMP_GET_BITSLICE(regvar, bitname)\
  34. ((regvar & bitname##__MSK) >> bitname##__POS)
  35. #define BMP_SET_BITSLICE(regvar, bitname, val)\
  36. ((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
  37. #define BMP_CHIP_ID_REG 0xD0
  38. /*********************************[BMP180]*************************************/
  39. /* chip id */
  40. #define BMP180_CHIP_ID 0x55
  41. /* i2c address */
  42. #define BMP180_I2C_ADDRESS 0x77
  43. /* calibration data */
  44. #define BMP180_CALIBRATION_DATA_START 0xAA
  45. #define BMP180_CALIBRATION_DATA_LENGTH 11 /* 16 bit values */
  46. /* oversampling */
  47. #define BMP180_OVERSAMPLING_1X 0x00
  48. #define BMP180_OVERSAMPLING_2X 0x01
  49. #define BMP180_OVERSAMPLING_4X 0x02
  50. #define BMP180_OVERSAMPLING_8X 0x03
  51. #define BMP180_CTRLMEAS_REG 0xF4 /* Ctrl Measure Register */
  52. #define BMP180_CTRLMEAS_REG_OSRSP__POS 6
  53. #define BMP180_CTRLMEAS_REG_OSRSP__MSK 0xC0
  54. #define BMP180_CTRLMEAS_REG_OSRSP__LEN 2
  55. #define BMP180_CTRLMEAS_REG_OSRSP__REG BMP180_CTRLMEAS_REG
  56. /* data */
  57. #define BMP180_TEMP_MEASUREMENT 0x2E
  58. #define BMP180_PRESSURE_MEASUREMENT 0x34
  59. #define BMP180_TEMP_CONVERSION_TIME (5)
  60. #define BMP180_CONVERSION_REGISTER_MSB 0xF6
  61. #define BMP180_CTRLMEAS_REG_MC__POS 0
  62. #define BMP180_CTRLMEAS_REG_MC__MSK 0x3F
  63. #define BMP180_CTRLMEAS_REG_MC__LEN 6
  64. #define BMP180_CTRLMEAS_REG_MC__REG BMP180_CTRLMEAS_REG
  65. #endif /* BOSCH_BARO_H */