mirror of
https://github.com/apache/nuttx.git
synced 2026-05-15 21:19:09 +08:00
esp32-devkitc: Add BMP180 sensor support
This commit is contained in:
committed by
Xiang Xiao
parent
6fb0fd6825
commit
6481eb6523
@@ -66,6 +66,14 @@
|
||||
# include "esp32_board_wlan.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_I2C
|
||||
# include "esp32_board_i2c.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
# include "esp32_bmp180.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_AES_ACCELERATOR
|
||||
# include "esp32_aes.h"
|
||||
#endif
|
||||
@@ -293,6 +301,42 @@ int esp32_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_DRIVER
|
||||
|
||||
#ifdef CONFIG_ESP32_I2C0
|
||||
ret = esp32_i2c_register(0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize I2C Driver for I2C0: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_I2C1
|
||||
ret = esp32_i2c_register(1);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize I2C Driver for I2C1: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
/* Try to register BMP180 device in I2C0 */
|
||||
|
||||
ret = board_bmp180_initialize(0, 0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize BMP180 driver: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user