bmp180: give sda,scl param in constructor

This commit is contained in:
Mathieu Maret 2016-03-26 15:30:18 +01:00
parent 55beced1f8
commit ce1f4fc3b2
3 changed files with 5 additions and 5 deletions

View File

@ -9,12 +9,12 @@ int bmp180Connected = 0;
int BMP180GetTemperature(double &t); int BMP180GetTemperature(double &t);
int BMP180GetTempAndPressure(double &t, double &p); int BMP180GetTempAndPressure(double &t, double &p);
int BMP180Setup(); int BMP180Setup(int sda, int scl);
bool BMP180IsConnected(); bool BMP180IsConnected();
#else //ENABLE_BMP80 #else //ENABLE_BMP80
int BMP180GetTemperature(double &t){return 0;}; int BMP180GetTemperature(double &t){return 0;};
int BMP180GetTempAndPressure(double &t, double &p){return 0;}; int BMP180GetTempAndPressure(double &t, double &p){return 0;};
int BMP180Setup(){return 0;}; int BMP180Setup(int , int ){return 0;};
bool BMP180IsConnected(){return 0;}; bool BMP180IsConnected(){return 0;};
#endif #endif

View File

@ -1,7 +1,7 @@
#ifdef ENABLE_BMP180 #ifdef ENABLE_BMP180
#include "BMP180.h" #include "BMP180.h"
int BMP180Setup() { int BMP180Setup(int sda, int scl) {
bmp180Connected = bmp180.begin(SDA, SCL); bmp180Connected = bmp180.begin(sda, scl);
return bmp180Connected; return bmp180Connected;
} }

View File

@ -197,7 +197,7 @@ void setup() {
if (mode == BOOTMODE_OTA) { if (mode == BOOTMODE_OTA) {
OTASetup(); OTASetup();
} else { } else {
if (BMP180Setup()) if (BMP180Setup(SDA, SCL))
SKETCH_DEBUG_PRINTLN("BMP180 init success"); SKETCH_DEBUG_PRINTLN("BMP180 init success");
WebSetupServer(mode); WebSetupServer(mode);
} }