mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Added const for pointer in master_write method, so that a const array can be passed to this fcn.
Signed-off-by: wubowen <wubowen@espressif.com> Merges https://github.com/espressif/esp-idf/pull/5307 explicitly convert a const ptr to non-const because we actually don't modify it.
This commit is contained in:
parent
dafe5df3ac
commit
f08743e452
@ -899,7 +899,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);
|
||||
@ -916,7 +916,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) {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user