[
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "Thank you for opening an issue on an Adafruit Arduino library repository.  To\nimprove the speed of resolution please review the following guidelines and\ncommon troubleshooting steps below before creating the issue:\n\n- **Do not use GitHub issues for troubleshooting projects and issues.**  Instead use\n  the forums at http://forums.adafruit.com to ask questions and troubleshoot why\n  something isn't working as expected.  In many cases the problem is a common issue\n  that you will more quickly receive help from the forum community.  GitHub issues\n  are meant for known defects in the code.  If you don't know if there is a defect\n  in the code then start with troubleshooting on the forum first.\n\n- **If following a tutorial or guide be sure you didn't miss a step.** Carefully\n  check all of the steps and commands to run have been followed.  Consult the\n  forum if you're unsure or have questions about steps in a guide/tutorial.\n\n- **For Arduino projects check these very common issues to ensure they don't apply**:\n\n  - For uploading sketches or communicating with the board make sure you're using\n    a **USB data cable** and **not** a **USB charge-only cable**.  It is sometimes\n    very hard to tell the difference between a data and charge cable!  Try using the\n    cable with other devices or swapping to another cable to confirm it is not\n    the problem.\n\n  - **Be sure you are supplying adequate power to the board.**  Check the specs of\n    your board and plug in an external power supply.  In many cases just\n    plugging a board into your computer is not enough to power it and other\n    peripherals.\n\n  - **Double check all soldering joints and connections.**  Flakey connections\n    cause many mysterious problems.  See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints.\n\n  - **Ensure you are using an official Arduino or Adafruit board.** We can't\n    guarantee a clone board will have the same functionality and work as expected\n    with this code and don't support them.\n\nIf you're sure this issue is a defect in the code and checked the steps above\nplease fill in the following fields to provide enough troubleshooting information.\nYou may delete the guideline and text above to just leave the following details:\n\n- Arduino board:  **INSERT ARDUINO BOARD NAME/TYPE HERE**\n\n- Arduino IDE version (found in Arduino -> About Arduino menu):  **INSERT ARDUINO\n  VERSION HERE**\n\n- List the steps to reproduce the problem below (if possible attach a sketch or\n  copy the sketch code in too): **LIST REPRO STEPS BELOW**\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "Thank you for creating a pull request to contribute to Adafruit's GitHub code!\nBefore you open the request please review the following guidelines and tips to\nhelp it be more easily integrated:\n\n- **Describe the scope of your change--i.e. what the change does and what parts\n  of the code were modified.**  This will help us understand any risks of integrating\n  the code.\n\n- **Describe any known limitations with your change.**  For example if the change\n  doesn't apply to a supported platform of the library please mention it.\n\n- **Please run any tests or examples that can exercise your modified code.**  We\n  strive to not break users of the code and running tests/examples helps with this\n  process.\n\nThank you again for contributing!  We will try to test and integrate the change\nas soon as we can, but be aware we have many GitHub repositories to manage and\ncan't immediately respond to every request.  There is no need to bump or check in\non a pull request (it will clutter the discussion of the request).\n\nAlso don't be worried if the request is closed or not integrated--sometimes the\npriorities of Adafruit's GitHub code (education, ease of use) might not match the\npriorities of the pull request.  Don't fret, the open source community thrives on\nforks and GitHub makes it easy to keep your changes in a forked repo.\n\nAfter reviewing the guidelines above you can delete this text from the pull request.\n"
  },
  {
    "path": ".github/workflows/githubci.yml",
    "content": "name: Arduino Library CI\n\non: [pull_request, push, repository_dispatch]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    \n    steps:\n    - uses: actions/setup-python@v4\n      with:\n        python-version: '3.x'\n    - uses: actions/checkout@v3\n    - uses: actions/checkout@v3\n      with:\n         repository: adafruit/ci-arduino\n         path: ci\n\n    - name: pre-install\n      run: bash ci/actions_install.sh\n\n    - name: test platforms\n      run: python3 ci/build_platform.py main_platforms\n\n    - name: clang\n      run: python3 ci/run-clang-format.py -e \"ci/*\" -e \"bin/*\" -r . \n\n    - name: doxygen\n      env:\n        GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}\n        PRETTYNAME : \"Adafruit BMP085 Library\"\n      run: bash ci/doxy_gen_and_deploy.sh\n"
  },
  {
    "path": "Adafruit_BMP085.cpp",
    "content": "/*!\n * @file Adafruit_BMP085.cpp\n *\n * @mainpage Adafruit BMP085 Library\n *\n * @section intro_sec Introduction\n *\n * This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp\n * sensor\n *\n * Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout\n * ----> http://www.adafruit.com/products/391\n * ----> http://www.adafruit.com/products/1603\n *\n * These displays use I2C to communicate, 2 pins are required to\n * interface\n * Adafruit invests time and resources providing this open source code,\n * please support Adafruit and open-source hardware by purchasing\n * products from Adafruit!\n *\n * @section author Author\n *\n * Written by Limor Fried/Ladyada for Adafruit Industries.\n * Updated by Samy Kamkar for cross-platform support.\n *\n * @section license License\n *\n * BSD license, all text above must be included in any redistribution\n */\n\n#include \"Adafruit_BMP085.h\"\n#include <Adafruit_I2CDevice.h>\n\nAdafruit_BMP085::Adafruit_BMP085() { i2c_dev = nullptr; }\n\nbool Adafruit_BMP085::begin(uint8_t mode, TwoWire *wire) {\n  if (mode > BMP085_ULTRAHIGHRES)\n    mode = BMP085_ULTRAHIGHRES;\n  oversampling = mode;\n\n  if (i2c_dev) {\n    delete i2c_dev; // remove old interface\n  }\n\n  i2c_dev = new Adafruit_I2CDevice(BMP085_I2CADDR, wire);\n\n  if (!i2c_dev->begin()) {\n    return false;\n  }\n\n  if (read8(0xD0) != 0x55)\n    return false;\n\n  /* read calibration data */\n  ac1 = read16(BMP085_CAL_AC1);\n  ac2 = read16(BMP085_CAL_AC2);\n  ac3 = read16(BMP085_CAL_AC3);\n  ac4 = read16(BMP085_CAL_AC4);\n  ac5 = read16(BMP085_CAL_AC5);\n  ac6 = read16(BMP085_CAL_AC6);\n\n  b1 = read16(BMP085_CAL_B1);\n  b2 = read16(BMP085_CAL_B2);\n\n  mb = read16(BMP085_CAL_MB);\n  mc = read16(BMP085_CAL_MC);\n  md = read16(BMP085_CAL_MD);\n#if (BMP085_DEBUG == 1)\n  Serial.print(\"ac1 = \");\n  Serial.println(ac1, DEC);\n  Serial.print(\"ac2 = \");\n  Serial.println(ac2, DEC);\n  Serial.print(\"ac3 = \");\n  Serial.println(ac3, DEC);\n  Serial.print(\"ac4 = \");\n  Serial.println(ac4, DEC);\n  Serial.print(\"ac5 = \");\n  Serial.println(ac5, DEC);\n  Serial.print(\"ac6 = \");\n  Serial.println(ac6, DEC);\n\n  Serial.print(\"b1 = \");\n  Serial.println(b1, DEC);\n  Serial.print(\"b2 = \");\n  Serial.println(b2, DEC);\n\n  Serial.print(\"mb = \");\n  Serial.println(mb, DEC);\n  Serial.print(\"mc = \");\n  Serial.println(mc, DEC);\n  Serial.print(\"md = \");\n  Serial.println(md, DEC);\n#endif\n\n  return true;\n}\n\nint32_t Adafruit_BMP085::computeB5(int32_t UT) {\n  int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15;\n  int32_t X2 = ((int32_t)mc << 11) / (X1 + (int32_t)md);\n  return X1 + X2;\n}\n\nuint16_t Adafruit_BMP085::readRawTemperature(void) {\n  write8(BMP085_CONTROL, BMP085_READTEMPCMD);\n  delay(5);\n#if BMP085_DEBUG == 1\n  Serial.print(\"Raw temp: \");\n  Serial.println(read16(BMP085_TEMPDATA));\n#endif\n  return read16(BMP085_TEMPDATA);\n}\n\nuint32_t Adafruit_BMP085::readRawPressure(void) {\n  uint32_t raw;\n\n  write8(BMP085_CONTROL, BMP085_READPRESSURECMD + (oversampling << 6));\n\n  if (oversampling == BMP085_ULTRALOWPOWER)\n    delay(5);\n  else if (oversampling == BMP085_STANDARD)\n    delay(8);\n  else if (oversampling == BMP085_HIGHRES)\n    delay(14);\n  else\n    delay(26);\n\n  raw = read16(BMP085_PRESSUREDATA);\n\n  raw <<= 8;\n  raw |= read8(BMP085_PRESSUREDATA + 2);\n  raw >>= (8 - oversampling);\n\n  /* this pull broke stuff, look at it later?\n   if (oversampling==0) {\n     raw <<= 8;\n     raw |= read8(BMP085_PRESSUREDATA+2);\n     raw >>= (8 - oversampling);\n   }\n  */\n\n#if BMP085_DEBUG == 1\n  Serial.print(\"Raw pressure: \");\n  Serial.println(raw);\n#endif\n  return raw;\n}\n\nint32_t Adafruit_BMP085::readPressure(void) {\n  int32_t UT, UP, B3, B5, B6, X1, X2, X3, p;\n  uint32_t B4, B7;\n\n  UT = readRawTemperature();\n  UP = readRawPressure();\n\n#if BMP085_DEBUG == 1\n  // use datasheet numbers!\n  UT = 27898;\n  UP = 23843;\n  ac6 = 23153;\n  ac5 = 32757;\n  mc = -8711;\n  md = 2868;\n  b1 = 6190;\n  b2 = 4;\n  ac3 = -14383;\n  ac2 = -72;\n  ac1 = 408;\n  ac4 = 32741;\n  oversampling = 0;\n#endif\n\n  B5 = computeB5(UT);\n\n#if BMP085_DEBUG == 1\n  Serial.print(\"X1 = \");\n  Serial.println(X1);\n  Serial.print(\"X2 = \");\n  Serial.println(X2);\n  Serial.print(\"B5 = \");\n  Serial.println(B5);\n#endif\n\n  // do pressure calcs\n  B6 = B5 - 4000;\n  X1 = ((int32_t)b2 * ((B6 * B6) >> 12)) >> 11;\n  X2 = ((int32_t)ac2 * B6) >> 11;\n  X3 = X1 + X2;\n  B3 = ((((int32_t)ac1 * 4 + X3) << oversampling) + 2) / 4;\n\n#if BMP085_DEBUG == 1\n  Serial.print(\"B6 = \");\n  Serial.println(B6);\n  Serial.print(\"X1 = \");\n  Serial.println(X1);\n  Serial.print(\"X2 = \");\n  Serial.println(X2);\n  Serial.print(\"B3 = \");\n  Serial.println(B3);\n#endif\n\n  X1 = ((int32_t)ac3 * B6) >> 13;\n  X2 = ((int32_t)b1 * ((B6 * B6) >> 12)) >> 16;\n  X3 = ((X1 + X2) + 2) >> 2;\n  B4 = ((uint32_t)ac4 * (uint32_t)(X3 + 32768)) >> 15;\n  B7 = ((uint32_t)UP - B3) * (uint32_t)(50000UL >> oversampling);\n\n#if BMP085_DEBUG == 1\n  Serial.print(\"X1 = \");\n  Serial.println(X1);\n  Serial.print(\"X2 = \");\n  Serial.println(X2);\n  Serial.print(\"B4 = \");\n  Serial.println(B4);\n  Serial.print(\"B7 = \");\n  Serial.println(B7);\n#endif\n\n  if (B7 < 0x80000000) {\n    p = (B7 * 2) / B4;\n  } else {\n    p = (B7 / B4) * 2;\n  }\n  X1 = (p >> 8) * (p >> 8);\n  X1 = (X1 * 3038) >> 16;\n  X2 = (-7357 * p) >> 16;\n\n#if BMP085_DEBUG == 1\n  Serial.print(\"p = \");\n  Serial.println(p);\n  Serial.print(\"X1 = \");\n  Serial.println(X1);\n  Serial.print(\"X2 = \");\n  Serial.println(X2);\n#endif\n\n  p = p + ((X1 + X2 + (int32_t)3791) >> 4);\n#if BMP085_DEBUG == 1\n  Serial.print(\"p = \");\n  Serial.println(p);\n#endif\n  return p;\n}\n\nint32_t Adafruit_BMP085::readSealevelPressure(float altitude_meters) {\n  float pressure = readPressure();\n  return (int32_t)(pressure / pow(1.0 - altitude_meters / 44330, 5.255));\n}\n\nfloat Adafruit_BMP085::readTemperature(void) {\n  int32_t UT, B5; // following ds convention\n  float temp;\n\n  UT = readRawTemperature();\n\n#if BMP085_DEBUG == 1\n  // use datasheet numbers!\n  UT = 27898;\n  ac6 = 23153;\n  ac5 = 32757;\n  mc = -8711;\n  md = 2868;\n#endif\n\n  B5 = computeB5(UT);\n  temp = (B5 + 8) >> 4;\n  temp /= 10;\n\n  return temp;\n}\n\nfloat Adafruit_BMP085::readAltitude(float sealevelPressure) {\n  float altitude;\n\n  float pressure = readPressure();\n\n  altitude = 44330 * (1.0 - pow(pressure / sealevelPressure, 0.1903));\n\n  return altitude;\n}\n\n/*********************************************************************/\n\nuint8_t Adafruit_BMP085::read8(uint8_t a) {\n  uint8_t ret;\n\n  // send 1 byte, reset i2c, read 1 byte\n  i2c_dev->write_then_read(&a, 1, &ret, 1, true);\n\n  return ret;\n}\n\nuint16_t Adafruit_BMP085::read16(uint8_t a) {\n  uint8_t retbuf[2];\n  uint16_t ret;\n\n  // send 1 byte, reset i2c, read 2 bytes\n  // we could typecast uint16_t as uint8_t array but would need to ensure proper\n  // endianness\n  i2c_dev->write_then_read(&a, 1, retbuf, 2, true);\n\n  // write_then_read uses uint8_t array\n  ret = retbuf[1] | (retbuf[0] << 8);\n\n  return ret;\n}\n\nvoid Adafruit_BMP085::write8(uint8_t a, uint8_t d) {\n  // send d prefixed with a (a d [stop])\n  i2c_dev->write(&d, 1, true, &a, 1);\n}\n"
  },
  {
    "path": "Adafruit_BMP085.h",
    "content": "/*!\n * @file Adafruit_BMP085.h\n *\n * This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp\n * sensor\n *\n * Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout\n * ----> http://www.adafruit.com/products/391\n * ----> http://www.adafruit.com/products/1603\n *\n * These displays use I2C to communicate, 2 pins are required to\n * interface\n * Adafruit invests time and resources providing this open source code,\n * please support Adafruit and open-source hardware by purchasing\n * products from Adafruit!\n *\n * Written by Limor Fried/Ladyada for Adafruit Industries.\n * BSD license, all text above must be included in any redistribution\n */\n\n#ifndef ADAFRUIT_BMP085_H\n#define ADAFRUIT_BMP085_H\n\n#include <Adafruit_I2CDevice.h>\n#include <Arduino.h>\n\n#define BMP085_DEBUG 0 //!< Debug mode\n\n#define BMP085_I2CADDR 0x77 //!< BMP085 I2C address\n\n#define BMP085_ULTRALOWPOWER 0 //!< Ultra low power mode\n#define BMP085_STANDARD 1      //!< Standard mode\n#define BMP085_HIGHRES 2       //!< High-res mode\n#define BMP085_ULTRAHIGHRES 3  //!< Ultra high-res mode\n#define BMP085_CAL_AC1 0xAA    //!< R   Calibration data (16 bits)\n#define BMP085_CAL_AC2 0xAC    //!< R   Calibration data (16 bits)\n#define BMP085_CAL_AC3 0xAE    //!< R   Calibration data (16 bits)\n#define BMP085_CAL_AC4 0xB0    //!< R   Calibration data (16 bits)\n#define BMP085_CAL_AC5 0xB2    //!< R   Calibration data (16 bits)\n#define BMP085_CAL_AC6 0xB4    //!< R   Calibration data (16 bits)\n#define BMP085_CAL_B1 0xB6     //!< R   Calibration data (16 bits)\n#define BMP085_CAL_B2 0xB8     //!< R   Calibration data (16 bits)\n#define BMP085_CAL_MB 0xBA     //!< R   Calibration data (16 bits)\n#define BMP085_CAL_MC 0xBC     //!< R   Calibration data (16 bits)\n#define BMP085_CAL_MD 0xBE     //!< R   Calibration data (16 bits)\n\n#define BMP085_CONTROL 0xF4         //!< Control register\n#define BMP085_TEMPDATA 0xF6        //!< Temperature data register\n#define BMP085_PRESSUREDATA 0xF6    //!< Pressure data register\n#define BMP085_READTEMPCMD 0x2E     //!< Read temperature control register value\n#define BMP085_READPRESSURECMD 0x34 //!< Read pressure control register value\n\n/*!\n * @brief Main BMP085 class\n */\nclass Adafruit_BMP085 {\npublic:\n  Adafruit_BMP085();\n  /*!\n   * @brief Starts I2C connection\n   * @param mode Mode to set, ultra high-res by default\n   * @param wire The I2C interface to use, defaults to Wire\n   * @return Returns true if successful\n   */\n  bool begin(uint8_t mode = BMP085_ULTRAHIGHRES, TwoWire *wire = &Wire);\n  /*!\n   * @brief Gets the temperature over I2C from the BMP085\n   * @return Returns the temperature\n   */\n  float readTemperature(void);\n  /*!\n   * @brief Gets the pressure over I2C from the BMP085\n   * @return Returns the pressure\n   */\n  int32_t readPressure(void);\n  /*!\n   * @brief Calculates the pressure at sea level\n   * @param altitude_meters Current altitude (in meters)\n   * @return Returns the calculated pressure at sea level\n   */\n  int32_t readSealevelPressure(float altitude_meters = 0);\n  /*!\n   * @brief Reads the altitude\n   * @param sealevelPressure Pressure at sea level, measured in pascals\n   * @return Returns the altitude\n   */\n  float readAltitude(float sealevelPressure = 101325); // std atmosphere\n  /*!\n   * @brief Reads the raw temperature\n   * @return Returns the raw temperature\n   */\n  uint16_t readRawTemperature(void);\n  /*!\n   * @brief Reads the raw pressure\n   * @return Returns the raw pressure\n   */\n  uint32_t readRawPressure(void);\n\nprivate:\n  int32_t computeB5(int32_t UT);\n  uint8_t read8(uint8_t addr);\n  uint16_t read16(uint8_t addr);\n  void write8(uint8_t addr, uint8_t data);\n\n  Adafruit_I2CDevice *i2c_dev;\n  uint8_t oversampling;\n\n  int16_t ac1, ac2, ac3, b1, b2, mb, mc, md;\n  uint16_t ac4, ac5, ac6;\n};\n\n#endif //  ADAFRUIT_BMP085_H\n"
  },
  {
    "path": "README.md",
    "content": "# Adafruit BMP085 Library [![Build Status](https://github.com/adafruit/Adafruit-BMP085-Library/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/Adafruit-BMP085-Library/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/Adafruit-BMP085-Library/html/index.html)\n\nThis is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor\n\nDesigned specifically to work with the Adafruit BMP085 or BMP180 Breakout\n  ----> http://www.adafruit.com/products/391\n  ----> http://www.adafruit.com/products/1603\n\nThese displays use I2C to communicate, 2 pins are required to interface\nAdafruit invests time and resources providing this open source code,\nplease support Adafruit and open-source hardware by purchasing\nproducts from Adafruit!\n\nCheck out the links above for our tutorials and wiring diagrams\n\nRequires the https://github.com/adafruit/Adafruit_BusIO library for I2C abstraction\n\nAdafruit invests time and resources providing this open source code,\nplease support Adafruit and open-source hardware by purchasing\nproducts from Adafruit!\n\nWritten by Limor Fried/Ladyada for Adafruit Industries.\nBSD license, all text above must be included in any redistribution\n\nTo download. click the DOWNLOAD ZIP button, rename the uncompressed folder Adafruit_BMP085.\nCheck that the Adafruit_BMP085 folder contains Adafruit_BMP085.cpp and Adafruit_BMP085.h\n\nPlace the Adafruit_BMP085 library folder your arduinosketchfolder/libraries/ folder.\nYou may need to create the libraries subfolder if its your first library. Restart the IDE.\n\nWe also have a great tutorial on Arduino library installation at:\nhttp://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use\n"
  },
  {
    "path": "examples/BMP085test/BMP085test.ino",
    "content": "#include <Adafruit_BMP085.h>\n\n/*************************************************** \n  This is an example for the BMP085 Barometric Pressure & Temp Sensor\n\n  Designed specifically to work with the Adafruit BMP085 Breakout \n  ----> https://www.adafruit.com/products/391\n\n  These pressure and temperature sensors use I2C to communicate, 2 pins\n  are required to interface\n  Adafruit invests time and resources providing this open source code, \n  please support Adafruit and open-source hardware by purchasing \n  products from Adafruit!\n\n  Written by Limor Fried/Ladyada for Adafruit Industries.  \n  BSD license, all text above must be included in any redistribution\n ****************************************************/\n\n// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)\n// Connect GND to Ground\n// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5\n// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4\n// EOC is not used, it signifies an end of conversion\n// XCLR is a reset pin, also not used here\n\nAdafruit_BMP085 bmp;\n  \nvoid setup() {\n  Serial.begin(9600);\n  if (!bmp.begin()) {\n\tSerial.println(\"Could not find a valid BMP085 sensor, check wiring!\");\n\twhile (1) {}\n  }\n}\n  \nvoid loop() {\n    Serial.print(\"Temperature = \");\n    Serial.print(bmp.readTemperature());\n    Serial.println(\" *C\");\n    \n    Serial.print(\"Pressure = \");\n    Serial.print(bmp.readPressure());\n    Serial.println(\" Pa\");\n    \n    // Calculate altitude assuming 'standard' barometric\n    // pressure of 1013.25 millibar = 101325 Pascal\n    Serial.print(\"Altitude = \");\n    Serial.print(bmp.readAltitude());\n    Serial.println(\" meters\");\n\n    Serial.print(\"Pressure at sealevel (calculated) = \");\n    Serial.print(bmp.readSealevelPressure());\n    Serial.println(\" Pa\");\n\n  // you can get a more precise measurement of altitude\n  // if you know the current sea level pressure which will\n  // vary with weather and such. If it is 1015 millibars\n  // that is equal to 101500 Pascals.\n    Serial.print(\"Real altitude = \");\n    Serial.print(bmp.readAltitude(101500));\n    Serial.println(\" meters\");\n    \n    Serial.println();\n    delay(500);\n}\n"
  },
  {
    "path": "library.properties",
    "content": "name=Adafruit BMP085 Library\nversion=1.2.4\nauthor=Adafruit\nmaintainer=Adafruit <info@adafruit.com>\nsentence=A powerful but easy to use BMP085/BMP180 Library\nparagraph=A powerful but easy to use BMP085/BMP180 Library\ncategory=Sensors\nurl=https://github.com/adafruit/Adafruit-BMP085-Library\narchitectures=*\ndepends=Adafruit Unified Sensor, Adafruit BusIO\n"
  }
]