Test Program for SoftwareI2C, Gets Calibration data from BMP085

Dependencies:   mbed SoftwareI2C

Files at this revision

API Documentation at this revision

Comitter:
p3p
Date:
Sun Apr 01 22:54:21 2012 +0000
Commit message:

Changed in this revision

SoftwareI2C.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SoftwareI2C.lib	Sun Apr 01 22:54:21 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/p3p/code/SoftwareI2C/#8670e78c4b63
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 01 22:54:21 2012 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "SoftwareI2C.h"
+
+#define BMP085_ADDRESS 0xee
+
+Serial debug(USBTX, USBRX);
+
+SoftwareI2C::SoftwareI2C i2c_device(p18, p17);
+
+int main() {
+    debug.baud(115200);
+    debug.printf("AC1 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xaa));
+    debug.printf("AC2 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xac));
+    debug.printf("AC3 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xae));
+    debug.printf("AC4 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb0));
+    debug.printf("AC5 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb2));
+    debug.printf("AC6 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb4));
+    debug.printf("B1 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xb6));
+    debug.printf("B2 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xb8));
+    debug.printf("MB = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xba));
+    debug.printf("MC = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xbc));
+    debug.printf("MD = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xbe));
+    
+    while(1) {
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 01 22:54:21 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479