Fork for fixing STM32

Dependents:   SSD1351

Fork of BurstSPI by Erik -

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BurstSPI_STM32F4.cpp Source File

BurstSPI_STM32F4.cpp

00001 #if defined(TARGET_STM32F4)
00002 #include "BurstSPI.h"
00003  
00004 void BurstSPI::fastWrite(int data) {
00005     
00006     SPI_TypeDef *spi = _spi.spi.handle.Instance;
00007     // Check if data is transmitted
00008     while ((spi->SR & SPI_SR_TXE) == 0);
00009     spi->DR = data;
00010 }
00011     
00012 void BurstSPI::clearRX( void ) {
00013     //Check if the RX buffer is busy
00014     SPI_TypeDef *spi = _spi.spi.handle.Instance;
00015     //While busy, keep checking
00016     while (spi->SR & SPI_SR_BSY){   
00017         // Check RX buffer readable
00018         while ((spi->SR & SPI_SR_RXNE) == 0);
00019         int dummy = spi->DR;
00020     }
00021 }
00022 #endif
00023