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 5:c9c9ef0a40b9, committed 2014-06-25
- Comitter:
- Alamalione
- Date:
- Wed Jun 25 14:11:39 2014 +0000
- Parent:
- 4:8585ddebd28b
- Commit message:
- Add Nucleo F030R8.cpp
Changed in this revision
BurstSPI_NUCLEO_F030R8.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BurstSPI_NUCLEO_F030R8.cpp Wed Jun 25 14:11:39 2014 +0000 @@ -0,0 +1,27 @@ + + +/* BurstSPI_NUCLEO_F030R8.cpp */ +#ifdef TARGET_NUCLEO_F030R8 +#include "BurstSPI.h" + +void BurstSPI::fastWrite(int data) { + + SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); + // Check if data is transmitted + while (!((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_TXE) != RESET) ? 1 : 0)); + SPI_I2S_SendData16(spi, (uint16_t)data); + } + +void BurstSPI::clearRX( void ) { + int status; + //Check if the RX buffer is busy + SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); + status = ((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_BSY) != RESET) ? 1 : 0); + if (status){ + // Check RX buffer readable + while (!((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_RXNE) != RESET) ? 1 : 0)); + int dummy = (int)SPI_I2S_ReceiveData16(spi); + } +} +#endif +