|
|
|
@ -126,17 +126,13 @@ uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
@@ -126,17 +126,13 @@ uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
|
|
|
|
|
|
|
|
|
|
i2c_config_t conf; |
|
|
|
|
conf.mode = I2C_MODE_MASTER; |
|
|
|
|
ESP_LOGD(TAG, "sda_io_num %d", u8g2_esp32_hal.sda); |
|
|
|
|
conf.sda_io_num = u8g2_esp32_hal.sda; |
|
|
|
|
conf.sda_pullup_en = GPIO_PULLUP_ENABLE; |
|
|
|
|
ESP_LOGD(TAG, "scl_io_num %d", u8g2_esp32_hal.scl); |
|
|
|
|
conf.scl_io_num = u8g2_esp32_hal.scl; |
|
|
|
|
conf.scl_pullup_en = GPIO_PULLUP_ENABLE; |
|
|
|
|
ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); |
|
|
|
|
ESP_LOGV(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ); |
|
|
|
|
conf.master.clk_speed = I2C_MASTER_FREQ_HZ; |
|
|
|
|
ESP_LOGD(TAG, "i2c_param_config %d", conf.mode); |
|
|
|
|
ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf)); |
|
|
|
|
ESP_LOGD(TAG, "i2c_driver_install %d", I2C_MASTER_NUM); |
|
|
|
|
ESP_ERROR_CHECK(i2c_driver_install(I2C_MASTER_NUM, |
|
|
|
|
conf.mode, |
|
|
|
|
I2C_MASTER_RX_BUF_DISABLE, |
|
|
|
@ -171,7 +167,7 @@ uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
@@ -171,7 +167,7 @@ uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case U8X8_MSG_BYTE_END_TRANSFER: { |
|
|
|
|
ESP_LOGV(TAG, "End I2C transfer. txbuf len: %d", txbuf_ptr - txbuf); |
|
|
|
|
ESP_LOGV(TAG, "end I2C transfer. txbuf len: %d", txbuf_ptr - txbuf); |
|
|
|
|
// ESP_LOG_BUFFER_HEXDUMP(TAG, txbuf, txbuf_ptr - txbuf, ESP_LOG_VERBOSE);
|
|
|
|
|
ESP_ERROR_CHECK(i2c_master_write(handle_i2c, txbuf, txbuf_ptr - txbuf, ACK_CHECK_EN)); |
|
|
|
|
ESP_ERROR_CHECK(i2c_master_stop(handle_i2c)); |
|
|
|
|