BME280 I2C integration fixes

This commit is contained in:
Robert Olsson 2016-09-16 14:34:39 +02:00 committed by Antonio Lignan
parent 5c25ec4d11
commit dcbb5f6271
4 changed files with 13 additions and 1 deletions

View File

@ -49,7 +49,11 @@
void bme280_init(uint8_t mode); void bme280_init(uint8_t mode);
void bme280_read(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 */ #define BME280_ADDR (0x77 << 1) /* Alternative 0x76 */
#endif
/* Diffrent BOSCH chip id's */ /* Diffrent BOSCH chip id's */
#define BMP085_CHIP_ID 0x55 /* And also BMP180 */ #define BMP085_CHIP_ID 0x55 /* And also BMP180 */

View File

@ -43,5 +43,6 @@
* Robert Olsson * Robert Olsson
*/ */
#include "i2c.h"
#endif #endif

View File

@ -224,5 +224,11 @@ i2c_probe(void)
probed |= I2C_CO2SA; probed |= I2C_CO2SA;
print_delim(p++, "CO2SA", del); 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; return probed;
} }

View File

@ -40,12 +40,13 @@
/* Here we define the i2c address for dev we support */ /* Here we define the i2c address for dev we support */
#define I2C_AT24MAC_ADDR 0xB0 /* EUI64 ADDR */ #define I2C_AT24MAC_ADDR 0xB0 /* EUI64 ADDR */
#define I2C_SHT2X_ADDR (0x40 << 1) /* SHT2X ADDR */ #define I2C_SHT2X_ADDR (0x40 << 1) /* SHT2X ADDR */
#define I2C_BME280_ADDR (0x77 << 1) /* Alternative 0x76 */
/* Here we define a enumration for devices */ /* Here we define a enumration for devices */
#define I2C_AT24MAC (1<<0) #define I2C_AT24MAC (1<<0)
#define I2C_SHT2X (1<<1) #define I2C_SHT2X (1<<1)
#define I2C_CO2SA (1<<2) /* Sense-Air CO2 */ #define I2C_CO2SA (1<<2) /* Sense-Air CO2 */
#define I2C_BME280 (1<<3)
#define I2C_READ 1 #define I2C_READ 1
#define I2C_WRITE 0 #define I2C_WRITE 0