Add support for KL46Z
Fork of BurstSPI by
Revision 6:b862ffb6c5e2, committed 2014-07-25
- Comitter:
- kenno
- Date:
- Fri Jul 25 15:09:45 2014 +0000
- Parent:
- 5:4437229b0738
- Parent:
- 4:8585ddebd28b
- Commit message:
- Merge with version 2.0
Changed in this revision
diff -r 4437229b0738 -r b862ffb6c5e2 BurstSPI_NUCLEO_L152RE.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BurstSPI_NUCLEO_L152RE.cpp Fri Jul 25 15:09:45 2014 +0000 @@ -0,0 +1,27 @@ + + +/* BurstSPI_NUCLEO_L152RE.cpp */ +#ifdef TARGET_NUCLEO_L152RE +#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_SendData(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_ReceiveData(spi); + } +} +#endif +