Skip to content

Commit ae27344

Browse files
committed
BSP optional I2C pull up
1 parent a9620d5 commit ae27344

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

bsp/esp_bsp_generic/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ menu "Board Support Package (generic)"
2020
range -1 ENV_GPIO_OUT_RANGE_MAX
2121
help
2222
The GPIO pin for I2C SDA.
23+
config BSP_I2C_GPIO_PULLUP
24+
bool "I2C GPIO PULL UP"
25+
default n
26+
help
27+
Enable I2C bus pull up.
2328
endmenu
2429
config BSP_I2C_NUM
2530
int "I2C peripheral index"

bsp/esp_bsp_generic/include/bsp/esp_bsp_generic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
/* I2C */
5151
#define BSP_I2C_SCL (CONFIG_BSP_I2C_GPIO_SCL)
5252
#define BSP_I2C_SDA (CONFIG_BSP_I2C_GPIO_SDA)
53+
#define BSP_I2C_PULLUP (CONFIG_BSP_I2C_GPIO_PULLUP)
54+
5355

5456
/* SD card */
5557
#define BSP_SD_CMD (CONFIG_BSP_SD_CMD)

bsp/esp_bsp_generic/src/esp_bsp_generic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ esp_err_t bsp_i2c_init(void)
324324
.sda_io_num = BSP_I2C_SDA,
325325
.scl_io_num = BSP_I2C_SCL,
326326
.clk_source = I2C_CLK_SRC_DEFAULT,
327+
.flags.enable_internal_pullup = BSP_I2C_PULLUP,
327328
};
328329
BSP_ERROR_CHECK_RETURN_ERR(i2c_new_master_bus(&i2c_config, &i2c_handle));
329330

0 commit comments

Comments
 (0)