x
Fork of BurstSPI by
Embed:
(wiki syntax)
Show/hide line numbers
BurstSPI_STM32F4.cpp
00001 //#if (defined(TARGET_STM32F4) || defined(TARGET_STM32F7)) 00002 #if defined(TARGET_STM32F4) 00003 #include "BurstSPI.h" 00004 00005 void BurstSPI::fastWrite(int data) { 00006 00007 SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); 00008 // Check if data is transmitted 00009 while ((spi->SR & SPI_SR_TXE) == 0); 00010 spi->DR = data; 00011 } 00012 00013 void BurstSPI::clearRX( void ) { 00014 //Check if the RX buffer is busy 00015 SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); 00016 //While busy, keep checking 00017 while (spi->SR & SPI_SR_BSY){ 00018 // Check RX buffer readable 00019 while ((spi->SR & SPI_SR_RXNE) == 0); 00020 int dummy = spi->DR; 00021 } 00022 } 00023 #endif 00024
Generated on Thu Jul 14 2022 02:09:40 by 1.7.2