diff --git a/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_bringup.c b/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_bringup.c index 6a89f265fa..2dda24b34e 100644 --- a/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_bringup.c +++ b/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_bringup.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -245,6 +246,44 @@ static int tm4c_mpu60x0_setup(int bus) } #endif +/**************************************************************************** + * Name: tm4c_bmp280_setup + * + * Description: + * Initialize and register the bmp280 sensor. + * + * Input Parameters: + * bus - A number identifying the I2C bus. + * + * Returned Value: + * On success, zero (OK) is returned. On failure, a negated errno value + * is returned to indicate the nature of the failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_BMP280 +int tm4c_bmp280_setup(int bus) +{ + int ret; + struct i2c_master_s *i2c; + + i2c = tiva_i2cbus_initialize(bus); + if (!i2c) + { + syslog(LOG_ERR, "ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bmp280_register(0, i2c); + if (ret < 0) + { + snerr("ERROR: Error registering BMP280\n"); + } + + return ret; +} +#endif + /**************************************************************************** * Name: tm4c_pwm_register * @@ -427,6 +466,14 @@ int tm4c_bringup(void) } #endif +#ifdef CONFIG_SENSORS_BMP280 + ret = tm4c_bmp280_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: BMP280 on I2C0 failed %d\n", ret); + } +#endif + #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */