Merge branch 'bugfix/i2c_const_function_signature' into 'master'

I2C: add const to signature of master_write function

Closes IDFGH-3324

See merge request espressif/esp-idf!9306
pull/5688/head
Michael (XIAO Xufeng) 2020-07-27 16:31:20 +08:00
commit 1aabab0160
2 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -900,7 +900,7 @@ esp_err_t i2c_master_stop(i2c_cmd_handle_t cmd_handle)
return i2c_cmd_link_append(cmd_handle, &cmd);
}
esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, uint8_t *data, size_t data_len, bool ack_en)
esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, const uint8_t *data, size_t data_len, bool ack_en)
{
I2C_CHECK((data != NULL), I2C_ADDR_ERROR_STR, ESP_ERR_INVALID_ARG);
I2C_CHECK(cmd_handle != NULL, I2C_CMD_LINK_INIT_ERR_STR, ESP_ERR_INVALID_ARG);
@ -917,7 +917,7 @@ esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, uint8_t *data, size_t da
cmd.hw_cmd.ack_val = 0;
cmd.hw_cmd.op_code = I2C_CMD_WRITE;
cmd.hw_cmd.byte_num = len_tmp;
cmd.data = data + data_offset;
cmd.data = (uint8_t*) data + data_offset;
ret = i2c_cmd_link_append(cmd_handle, &cmd);
data_offset += len_tmp;
if (ret != ESP_OK) {

Wyświetl plik

@ -225,7 +225,7 @@ esp_err_t i2c_master_write_byte(i2c_cmd_handle_t cmd_handle, uint8_t data, bool
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, uint8_t *data, size_t data_len, bool ack_en);
esp_err_t i2c_master_write(i2c_cmd_handle_t cmd_handle, const uint8_t *data, size_t data_len, bool ack_en);
/**
* @brief Queue command for I2C master to read one byte from I2C bus