-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Description of defect
while examing problems with the current SPI implementation in #15115, I found that SPI::transfer is defined twice. Is this intended or is just not removed during compiling?
The transfer function is declared as template including code:
mbed-os/drivers/include/drivers/SPI.h
Lines 258 to 266 in 07e119b
template<typename Type> | |
int transfer(const Type *tx_buffer, int tx_length, Type *rx_buffer, int rx_length, const event_callback_t &callback, int event = SPI_EVENT_COMPLETE) | |
{ | |
if (spi_active(&_peripheral->spi)) { | |
return queue_transfer(tx_buffer, tx_length, rx_buffer, rx_length, sizeof(Type) * 8, callback, event); | |
} | |
start_transfer(tx_buffer, tx_length, rx_buffer, rx_length, sizeof(Type) * 8, callback, event); | |
return 0; | |
} |
And also as code in :
mbed-os/drivers/source/SPI.cpp
Lines 281 to 288 in 07e119b
int SPI::transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t &callback, int event) | |
{ | |
if (spi_active(&_peripheral->spi)) { | |
return queue_transfer(tx_buffer, tx_length, rx_buffer, rx_length, bit_width, callback, event); | |
} | |
start_transfer(tx_buffer, tx_length, rx_buffer, rx_length, bit_width, callback, event); | |
return 0; | |
} |
I can remove the code from SPI.cpp and it still compiles fine because its created from the header.
Target(s) affected by this defect ?
Targets with ASYNC_SPI
Toolchain(s) (name and version) displaying this defect ?
gcc 10.2.1
What version of Mbed-os are you using (tag or sha) ?
mbed-os-6.15.0
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed-tools 7.44.0
How is this defect reproduced ?
with code that uses SPI.transfer()