Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BurstSPI by
Revision 15:8241b7d84ad2, committed 2016-12-10
- Comitter:
- JojoS
- Date:
- Sat Dec 10 14:30:26 2016 +0000
- Parent:
- 14:83e3b8ba3f43
- Commit message:
- support for STM32F4
Changed in this revision
BurstSPI_STM32F4.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BurstSPI_STM32F4.cpp Sun Oct 09 16:48:17 2016 +0000 +++ b/BurstSPI_STM32F4.cpp Sat Dec 10 14:30:26 2016 +0000 @@ -1,9 +1,14 @@ #if defined(TARGET_STM32F4) #include "BurstSPI.h" - + +#if DEVICE_SPI_ASYNCH + #define SPI_INST(obj) ((SPI_TypeDef *)((obj)->spi.spi)) +#else + #define SPI_INST(obj) ((SPI_TypeDef *)((obj)->spi)) +#endif + void BurstSPI::fastWrite(int data) { - - SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); + SPI_TypeDef *spi = SPI_INST(&_spi); // Check if data is transmitted while ((spi->SR & SPI_SR_TXE) == 0); spi->DR = data; @@ -11,7 +16,7 @@ void BurstSPI::clearRX( void ) { //Check if the RX buffer is busy - SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); + SPI_TypeDef *spi = SPI_INST(&_spi); //While busy, keep checking while (spi->SR & SPI_SR_BSY){ // Check RX buffer readable