test(i2c): Support test for esp32p4 lp i2c

This commit is contained in:
C.S.M 2024-09-02 19:05:55 +08:00
parent 53b7d63ba5
commit f3eec83421
2 changed files with 9 additions and 4 deletions

View File

@ -351,8 +351,8 @@ static esp_err_t s_lp_i2c_pins_config(i2c_bus_handle_t handle)
#if !SOC_LP_GPIO_MATRIX_SUPPORTED #if !SOC_LP_GPIO_MATRIX_SUPPORTED
rtc_gpio_iomux_func_sel(handle->sda_num, i2c_periph_signal[port_id].iomux_func); rtc_gpio_iomux_func_sel(handle->sda_num, i2c_periph_signal[port_id].iomux_func);
#else #else
lp_gpio_connect_out_signal(handle->sda_num, i2c_periph_signal[port_id].scl_out_sig, 0, 0); lp_gpio_connect_out_signal(handle->sda_num, i2c_periph_signal[port_id].sda_out_sig, 0, 0);
lp_gpio_connect_in_signal(handle->sda_num, i2c_periph_signal[port_id].scl_in_sig, 0); lp_gpio_connect_in_signal(handle->sda_num, i2c_periph_signal[port_id].sda_in_sig, 0);
#endif #endif
rtc_gpio_init(handle->scl_num); rtc_gpio_init(handle->scl_num);
@ -366,8 +366,8 @@ static esp_err_t s_lp_i2c_pins_config(i2c_bus_handle_t handle)
#if !SOC_LP_GPIO_MATRIX_SUPPORTED #if !SOC_LP_GPIO_MATRIX_SUPPORTED
rtc_gpio_iomux_func_sel(handle->scl_num, i2c_periph_signal[port_id].iomux_func); rtc_gpio_iomux_func_sel(handle->scl_num, i2c_periph_signal[port_id].iomux_func);
#else #else
lp_gpio_connect_out_signal(handle->scl_num, i2c_periph_signal[port_id].sda_out_sig, 0, 0); lp_gpio_connect_out_signal(handle->scl_num, i2c_periph_signal[port_id].scl_out_sig, 0, 0);
lp_gpio_connect_in_signal(handle->scl_num, i2c_periph_signal[port_id].sda_in_sig, 0); lp_gpio_connect_in_signal(handle->scl_num, i2c_periph_signal[port_id].scl_in_sig, 0);
#endif #endif
return ESP_OK; return ESP_OK;

View File

@ -26,9 +26,14 @@ extern "C" {
#endif #endif
#if SOC_LP_I2C_SUPPORTED #if SOC_LP_I2C_SUPPORTED
#if CONFIG_IDF_TARGET_ESP32P4
#define LP_I2C_SCL_IO 4
#define LP_I2C_SDA_IO 5
#else
#define LP_I2C_SCL_IO 7 #define LP_I2C_SCL_IO 7
#define LP_I2C_SDA_IO 6 #define LP_I2C_SDA_IO 6
#endif #endif
#endif
#define ESP_SLAVE_ADDR 0x28 /*!< ESP_I2C slave address, you can set any 7bit value */ #define ESP_SLAVE_ADDR 0x28 /*!< ESP_I2C slave address, you can set any 7bit value */
#define TEST_I2C_PORT 0 #define TEST_I2C_PORT 0