This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BMP180 Barometer Driver programming example

Other Parts Discussed in Thread: TM4C123GH6PM

Hi guys!

Need some help on the programming BMP180 Barometer Driver.example.
Can't get any readings on the fTemperature and fPressure variables.

Anybody find some mistakes in the code under?

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "sensorlib/hw_mpu9150.h"
#include "sensorlib/hw_ak8975.h"
#include "sensorlib/i2cm_drv.h"
#include "sensorlib/ak8975.h"
#include "sensorlib/mpu9150.h"
#include "sensorlib/comp_dcm.h"
#include "drivers/rgb.h"
#include "sensorlib/hw_bmp180.h"
#include "sensorlib/bmp180.h"

//
// A boolean that is set when a BMP180 command has completed.
//
volatile bool g_bBMP180Done;
//
// The function that is provided by this example as a callback when BMP180
// transactions have completed.
//
void BMP180Callback(void *pvCallbackData, uint_fast8_t ui8Status) {
//
// See if an error occurred.
//
if (ui8Status != I2CM_STATUS_SUCCESS) {
//
// An error occurred, so handle it here if required.
//
}
//
// Indicate that the BMP180 transaction has completed.
//
g_bBMP180Done = true;
}
//
// The BMP180 example.
//
float fTemperature, fPressure;

void main(void) {

tI2CMInstance sI2CInst;
tBMP180 sBMP180;
//
// Initialize the BMP180. This code assumes that the I2C master instance
// has already been initialized.
//
g_bBMP180Done = false;
BMP180Init(&sBMP180, &sI2CInst, 0x77, BMP180Callback, 0);
while (!g_bBMP180Done) {
}
//
// Configure the BMP180 for 2x oversampling.
//
g_bBMP180Done = false;
BMP180ReadModifyWrite(&sBMP180, BMP180_O_CTRL_MEAS, ~BMP180_CTRL_MEAS_OSS_M,
BMP180_CTRL_MEAS_OSS_2, BMP180Callback, 0);
while (!g_bBMP180Done) {
}
//
// Loop forever reading data from the BMP180. Typically, this process
// would be done in the background, but for the purposes of this example,
// it is shown in an infinite loop.
//
while (1) {
//
// Request another reading from the BMP180.
//
g_bBMP180Done = false;
BMP180DataRead(&sBMP180, BMP180Callback, 0);
while (!g_bBMP180Done) {
}
//
// Get the new pressure and temperature reading.
//
BMP180DataPressureGetFloat(&sBMP180, &fPressure);
BMP180DataTemperatureGetFloat(&sBMP180, &fTemperature);
//
// Do something with the new pressure and temperature readings.
//
}
}