Added support for STM32F103RB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BurstSPI_STMF103RB.cpp Source File

BurstSPI_STMF103RB.cpp

00001 #if defined(TARGET_STM32F103RB)
00002 #include "BurstSPI.h"
00003 
00004 void BurstSPI::fastWrite(int data)
00005 {
00006     SPI_TypeDef *spi = (SPI_TypeDef *)(_peripheral->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 {
00014     const SPI_TypeDef *spi =
00015         (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
00016     while (spi->SR & SPI_SR_BSY) {
00017         // Check RX buffer readable
00018         while ((spi->SR & SPI_SR_RXNE) == 0)
00019             ;
00020         int dummy = spi->DR;
00021         (void)dummy; // suppress UNUSED warning
00022     }
00023 }
00024 
00025 #endif