diff --git a/dev/bme280/bme280.h b/dev/bme280/bme280.h index 9486738c3..787186fda 100644 --- a/dev/bme280/bme280.h +++ b/dev/bme280/bme280.h @@ -49,7 +49,11 @@ void bme280_init(uint8_t mode); void bme280_read(uint8_t mode); +#ifdef I2C_BME280_ADDR +#define BME280_ADDR I2C_BME280_ADDR +#else #define BME280_ADDR (0x77 << 1) /* Alternative 0x76 */ +#endif /* Diffrent BOSCH chip id's */ #define BMP085_CHIP_ID 0x55 /* And also BMP180 */ diff --git a/platform/avr-rss2/dev/bme280-arch.h b/platform/avr-rss2/dev/bme280-arch.h index 7c84e93ba..3fbc83ccd 100644 --- a/platform/avr-rss2/dev/bme280-arch.h +++ b/platform/avr-rss2/dev/bme280-arch.h @@ -43,5 +43,6 @@ * Robert Olsson */ +#include "i2c.h" #endif diff --git a/platform/avr-rss2/dev/i2c.c b/platform/avr-rss2/dev/i2c.c index 2668aad58..ee0d29125 100644 --- a/platform/avr-rss2/dev/i2c.c +++ b/platform/avr-rss2/dev/i2c.c @@ -224,5 +224,11 @@ i2c_probe(void) probed |= I2C_CO2SA; print_delim(p++, "CO2SA", del); } + watchdog_periodic(); + if(!i2c_start(I2C_BME280_ADDR)) { + i2c_stop(); + probed |= I2C_BME280; + print_delim(p++, "BME280", del); + } return probed; } diff --git a/platform/avr-rss2/dev/i2c.h b/platform/avr-rss2/dev/i2c.h index 3aa124953..e380cda52 100644 --- a/platform/avr-rss2/dev/i2c.h +++ b/platform/avr-rss2/dev/i2c.h @@ -40,12 +40,13 @@ /* Here we define the i2c address for dev we support */ #define I2C_AT24MAC_ADDR 0xB0 /* EUI64 ADDR */ #define I2C_SHT2X_ADDR (0x40 << 1) /* SHT2X ADDR */ - +#define I2C_BME280_ADDR (0x77 << 1) /* Alternative 0x76 */ /* Here we define a enumration for devices */ #define I2C_AT24MAC (1<<0) #define I2C_SHT2X (1<<1) #define I2C_CO2SA (1<<2) /* Sense-Air CO2 */ +#define I2C_BME280 (1<<3) #define I2C_READ 1 #define I2C_WRITE 0