0

I am trying to write some code for SPI communication between an ESP32 microcontroller and a sensor. I am also using an external library for that. The IDE is VScode Version 1.59.1 and the ESP-IDF Explorer extension is being used to compile the code.

The following warning is being treated as an error as given by the logs:

C:/Documents/XYZ/JKL/paths/esp-idf/components/SPIbus/src/SPIbus.cpp:209:12: error: '*((void*)& transaction +32)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     rxdata = *(uint32_t*)transaction.rx_data;
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here, transaction.rx_data is an uint8_t array. I can initialize the array to make the error go away, but then the SPI communication produces invalid values.

Can someone please tell me how can I remove the warning be read as an error? Any help will be greatly appreciated.

0 Answers0