parameter set but not used error (SPI driver)
Posted: Fri Nov 12, 2021 12:22 pm
Hello. I am writing EEPROM SPI driver and noticed an issue.
in my .c file I have a function:
In my .h file I have prototype:
And in my main.c I call this function:
The error message when trying to build the code:
Could someone help me understand what this issue means? As you can see from my function, I am clearly using the data_bufer parameter, why does it say that I am not using it? I am trying to read 10 bytes and assing the rx_buffer to my array that I pass as a parameter.
in my .c file I have a function:
Code: Select all
void EEPROM_read_10_byte_chunks(spi_device_handle_t spi,uint32_t address,uint8_t* data_bufer){
while(EEPROM_check_if_busy(spi) != true){ // return true if flash is not busy
vTaskDelay(10/portTICK_PERIOD_MS);
printf("waiting for busy flag to clear \n");
}
spi_transaction_ext_t trans = {
.base = {
.flags = SPI_TRANS_VARIABLE_ADDR,
.cmd = 0b00000011,
.addr = address,
.rxlength = 10*8,
},
.address_bits = 24,
};
spi_device_polling_transmit(spi, (spi_transaction_t*)&trans);
printf("read data = %p \n",(uint8_t*)&trans.base.rx_buffer);
printf("read data = %p \n",(uint8_t*)trans.base.rx_buffer);
data_bufer = (uint8_t*)trans.base.rx_buffer;
}
Code: Select all
void EEPROM_read_10_byte_chunks(spi_device_handle_t spi,uint32_t address,uint8_t* data_bufer);
And in my main.c I call this function:
Code: Select all
uint8_t data[10];
EEPROM_read_10_byte_chunks(external_eeprom,0,data);
The error message when trying to build the code:
Code: Select all
mponents/M95M04/M95M04.cpp:182:83: error: parameter 'data_bufer' set but not used [-Werror=unused-but-set-parameter]
void EEPROM_read_10_byte_chunks(spi_device_handle_t spi,uint32_t address,uint8_t* data_bufer){
Could someone help me understand what this issue means? As you can see from my function, I am clearly using the data_bufer parameter, why does it say that I am not using it? I am trying to read 10 bytes and assing the rx_buffer to my array that I pass as a parameter.