refactor(i2c_master): Change member type of i2c_operation_job_t

Closes https://github.com/espressif/esp-idf/issues/17585
This commit is contained in:
Chen Chen
2025-09-19 15:14:48 +08:00
parent c8bbe90e26
commit 3d73884ae8
3 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -1436,7 +1436,7 @@ esp_err_t i2c_master_execute_defined_operations(i2c_master_dev_handle_t i2c_dev,
case I2C_MASTER_CMD_WRITE:
i2c_ops[i].hw_cmd.op_code = I2C_LL_CMD_WRITE;
i2c_ops[i].hw_cmd.ack_en = i2c_operation[i].write.ack_check;
i2c_ops[i].data = i2c_operation[i].write.data;
i2c_ops[i].data = (uint8_t *)i2c_operation[i].write.data;
i2c_ops[i].total_bytes = i2c_operation[i].write.total_bytes;
break;
case I2C_MASTER_CMD_READ:
@@ -59,6 +59,10 @@ typedef struct {
*
* This structure is used to define individual I2C operations (write or read)
* within a sequence of I2C master transactions.
*
* @note The union contains either write or read operation parameters.
* - For write operations: use `.write.data` (const uint8_t *) to provide data to be written
* - For read operations: use `.read.data` (uint8_t *) to provide buffer for storing read data
*/
typedef struct {
i2c_master_command_t command; /**< I2C command indicating the type of operation (START, WRITE, READ, or STOP) */
@@ -70,7 +74,7 @@ typedef struct {
*/
struct {
bool ack_check; /**< Whether to enable ACK check during WRITE operation */
uint8_t *data; /**< Pointer to the data to be written */
const uint8_t *data; /**< Pointer to the data to be written */
size_t total_bytes; /**< Total number of bytes to write */
} write;
/**
+2
View File
@@ -193,6 +193,8 @@ If declarator-id:
struct esp_cam_ctlr_csi_config_t
--------------------------------^
i2c_master.inc:line: WARNING: Duplicate C++ declaration, also defined at api-reference/peripherals/i2c:line.
Declaration is '.. cpp:member:: uint8_t * data'.
isp_types.inc:line: WARNING: Error in declarator or parameters-and-qualifiers
If pointer to member declarator:
Invalid C++ declaration: Expected identifier in nested name. [error at 32]