Test Program for SoftwareI2C, Gets Calibration data from BMP085

Dependencies:   mbed SoftwareI2C

Committer:
p3p
Date:
Sun Apr 01 22:54:21 2012 +0000
Revision:
0:aedfc88731e2

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
p3p 0:aedfc88731e2 1 #include "mbed.h"
p3p 0:aedfc88731e2 2 #include "SoftwareI2C.h"
p3p 0:aedfc88731e2 3
p3p 0:aedfc88731e2 4 #define BMP085_ADDRESS 0xee
p3p 0:aedfc88731e2 5
p3p 0:aedfc88731e2 6 Serial debug(USBTX, USBRX);
p3p 0:aedfc88731e2 7
p3p 0:aedfc88731e2 8 SoftwareI2C::SoftwareI2C i2c_device(p18, p17);
p3p 0:aedfc88731e2 9
p3p 0:aedfc88731e2 10 int main() {
p3p 0:aedfc88731e2 11 debug.baud(115200);
p3p 0:aedfc88731e2 12 debug.printf("AC1 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xaa));
p3p 0:aedfc88731e2 13 debug.printf("AC2 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xac));
p3p 0:aedfc88731e2 14 debug.printf("AC3 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xae));
p3p 0:aedfc88731e2 15 debug.printf("AC4 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb0));
p3p 0:aedfc88731e2 16 debug.printf("AC5 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb2));
p3p 0:aedfc88731e2 17 debug.printf("AC6 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb4));
p3p 0:aedfc88731e2 18 debug.printf("B1 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xb6));
p3p 0:aedfc88731e2 19 debug.printf("B2 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xb8));
p3p 0:aedfc88731e2 20 debug.printf("MB = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xba));
p3p 0:aedfc88731e2 21 debug.printf("MC = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xbc));
p3p 0:aedfc88731e2 22 debug.printf("MD = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xbe));
p3p 0:aedfc88731e2 23
p3p 0:aedfc88731e2 24 while(1) {
p3p 0:aedfc88731e2 25
p3p 0:aedfc88731e2 26 }
p3p 0:aedfc88731e2 27 }