Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 5 months ago.
Which Platform supports which function of asynchronous api?
Hello all! At the moment i am trying to set up i2c to work on a callback-scheme ( "asynchronous" operation). Board is bluepill/nucleo f103rb. Whatever i try wont compile. So is this not supported yet on all plattforms or is it my fault? Before i put more days into this subject:are there any examples apart from the sparse documentation? What is the status on this important frature?
Thanks!
1 Answer
7 years, 5 months ago.
Which board supports what is declared in targets.json. You're looking for SPI_ASYNCH feature. That should be supported on all STM32 boards.
Are you on the latest version of Mbed OS?
This also compiles fine for me against Mbed OS 5.6:
#include "mbed.h" SPI device(SPI_MOSI, SPI_MISO, SPI_SCK); uint8_t rxbuff[100]; void done(int) { printf("done\n"); } // main() runs in its own thread in the OS int main() { const uint8_t txbuff[] = { 0x13, 0x24 }; device.transfer(txbuff, sizeof(txbuff), rxbuff, sizeof(rxbuff), callback(done), SPI_EVENT_COMPLETE); wait(osWaitForever); }
(there does seem to be an issue with pins and SPI on F103RB, see here, but probably does not apply on Bluepill board)