fix(i2c): remove unused but set variables

This commit is contained in:
morris
2026-07-03 18:10:15 +08:00
parent 81180373f9
commit d3b252d8ce
5 changed files with 0 additions and 16 deletions

View File

@@ -28,5 +28,3 @@ idf_component_register(SRCS ${srcs}
PRIV_REQUIRES "${priv_requires}"
LDFRAGMENTS "linker.lf"
)
set_source_files_properties("i2c_master.c"
PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")

View File

@@ -922,10 +922,6 @@ static esp_err_t i2c_master_bus_destroy(i2c_master_bus_handle_t bus_handle)
vQueueDeleteWithCaps(i2c_master->event_queue);
i2c_master->event_queue = NULL;
}
if (i2c_master->queues_storage) {
free(i2c_master->queues_storage);
i2c_master->queues_storage = NULL;
}
free(i2c_master->i2c_async_ops);
i2c_master->i2c_async_ops = NULL;
for (int i = 0; i < I2C_TRANS_QUEUE_MAX; i++) {
@@ -1134,13 +1130,8 @@ esp_err_t i2c_new_master_bus(const i2c_master_bus_config_t *bus_config, i2c_mast
i2c_master->trans_finish = true;
i2c_master->new_queue = true;
i2c_master->queue_size = bus_config->trans_queue_depth;
i2c_master->queues_storage = (uint8_t*)heap_caps_calloc(bus_config->trans_queue_depth * I2C_TRANS_QUEUE_MAX, sizeof(i2c_transaction_t), I2C_MEM_ALLOC_CAPS);
ESP_GOTO_ON_FALSE(i2c_master->queues_storage, ESP_ERR_NO_MEM, err, TAG, "no mem for queue storage");
i2c_transaction_t **pp_trans_desc = (i2c_transaction_t **)i2c_master->queues_storage;
for (int i = 0; i < I2C_TRANS_QUEUE_MAX; i++) {
i2c_master->trans_queues[i] = xQueueCreateWithCaps(bus_config->trans_queue_depth, sizeof(i2c_transaction_t), I2C_MEM_ALLOC_CAPS);
pp_trans_desc += bus_config->trans_queue_depth;
// sanity check
assert(i2c_master->trans_queues[i]);
}

View File

@@ -140,7 +140,6 @@ struct i2c_master_bus_t {
size_t queue_size; // I2C transaction queue size.
size_t num_trans_inflight; // Indicates the number of transactions that are undergoing but not recycled to ready_queue
size_t num_trans_inqueue; // Indicates the number of transaction in queue transaction.
void* queues_storage; // storage of transaction queues
bool sent_all; // true if the queue transaction is sent
bool in_progress; // true if current transaction is in progress
bool trans_finish; // true if current command has been sent out.

View File

@@ -8,8 +8,6 @@
#define DAC_GPIO25_CHANNEL DAC_CHAN_0
#define DAC_CHAN0_GPIO_NUM 25
#define DAC_CHANNEL_1_GPIO_NUM DAC_CHAN0_GPIO_NUM //`DAC_CHANNEL_1_GPIO_NUM` is defined for DAC legacy driver, indicating the first DAC channel.
#define DAC_GPIO26_CHANNEL DAC_CHAN_1
#define DAC_CHAN1_GPIO_NUM 26
#define DAC_CHANNEL_2_GPIO_NUM DAC_CHAN1_GPIO_NUM //`DAC_CHANNEL_2_GPIO_NUM` is defined for DAC legacy driver, indicating the second DAC channel.

View File

@@ -8,8 +8,6 @@
#define DAC_GPIO17_CHANNEL DAC_CHAN_0
#define DAC_CHAN0_GPIO_NUM 17
#define DAC_CHANNEL_1_GPIO_NUM DAC_CHAN0_GPIO_NUM //`DAC_CHANNEL_1_GPIO_NUM` is defined for DAC legacy driver, indicating the first DAC channel.
#define DAC_GPIO18_CHANNEL DAC_CHAN_1
#define DAC_CHAN1_GPIO_NUM 18
#define DAC_CHANNEL_2_GPIO_NUM DAC_CHAN1_GPIO_NUM //`DAC_CHANNEL_2_GPIO_NUM` is defined for DAC legacy driver, indicating the second DAC channel.