Skip to content

Commit

Permalink
BSP optional I2C pull up
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkaliszan committed Jan 18, 2025
1 parent a9620d5 commit 7c69ef1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bsp/esp_bsp_generic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ menu "Board Support Package (generic)"
range -1 ENV_GPIO_OUT_RANGE_MAX
help
The GPIO pin for I2C SDA.
config BSP_I2C_PULLUP
bool "I2C GPIO PULL UP"
default n
help
Enable I2C bus pull up.
endmenu
config BSP_I2C_NUM

config BSP_I2C_NUM
int "I2C peripheral index"
default 1
range 0 1
Expand Down
3 changes: 3 additions & 0 deletions bsp/esp_bsp_generic/src/esp_bsp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ esp_err_t bsp_i2c_init(void)
.sda_io_num = BSP_I2C_SDA,
.scl_io_num = BSP_I2C_SCL,
.clk_source = I2C_CLK_SRC_DEFAULT,
#ifdef CONFIG_BSP_I2C_GPIO_PULLUP
.flags.enable_internal_pullup = 1,
#endif
};
BSP_ERROR_CHECK_RETURN_ERR(i2c_new_master_bus(&i2c_config, &i2c_handle));

Expand Down

0 comments on commit 7c69ef1

Please sign in to comment.