I’m trying to wrap my head around using Nerves and ElixirAle to interface with an I2C device. I’m using a Rpi3 with an Adafruit BMP085 temperature + pressure sensor (the i2C device).
- BMP085 datasheet: https://cdn-shop.adafruit.com/datasheets/BST-BMP085-DS000-06.pdf
- Adafruit BMP085: BMP085 Barometric Pressure/Temperature/Altitude Sensor- 5V ready : ID 391 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits
- Adafruit C library for BMP085: GitHub - adafruit/Adafruit-BMP085-Library: A powerful but easy to use BMP085/BMP180 Arduino library
I’m new to this and not used to messing with bits at this level so bear with me…
I can connect to the device
iex(1)> alias ElixirALE.I2C
ElixirALE.I2C
iex(2)> {:ok, tpid} = I2C.start_link("i2c-1", 0x77)
{:ok, #PID<0.503.0>}
And can read…
iex(3)> I2C.read(tpid, 22)
<<10, 0, 118, 98, 0, 181, 148, 60, 25, 18, 39, 37, 34, 115, 157, 32, 143, 251,
107, 199, 244, 130>>
But I have no idea what I’m getting here
Looking at the Adafruit library and the datasheet, there are 11 registers to read to get calibration data to be used in the measurement calculations. No idea how to get that i.e. how do I read 16 bits out of register 0xAA?
Is this possible with ElixirALEs I2C module?