Test Program for SoftwareI2C, Gets Calibration data from BMP085
Dependencies: mbed SoftwareI2C
main.cpp
00001 #include "mbed.h" 00002 #include "SoftwareI2C.h" 00003 00004 #define BMP085_ADDRESS 0xee 00005 00006 Serial debug(USBTX, USBRX); 00007 00008 SoftwareI2C::SoftwareI2C i2c_device(p18, p17); 00009 00010 int main() { 00011 debug.baud(115200); 00012 debug.printf("AC1 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xaa)); 00013 debug.printf("AC2 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xac)); 00014 debug.printf("AC3 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xae)); 00015 debug.printf("AC4 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb0)); 00016 debug.printf("AC5 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb2)); 00017 debug.printf("AC6 = %d\r\n", i2c_device.read16(BMP085_ADDRESS, 0xb4)); 00018 debug.printf("B1 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xb6)); 00019 debug.printf("B2 = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xb8)); 00020 debug.printf("MB = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xba)); 00021 debug.printf("MC = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xbc)); 00022 debug.printf("MD = %d\r\n", (short)i2c_device.read16(BMP085_ADDRESS, 0xbe)); 00023 00024 while(1) { 00025 00026 } 00027 }
Generated on Wed Jul 13 2022 17:18:34 by 1.7.2