Fork for fixing STM32
Fork of BurstSPI by
Embed:
(wiki syntax)
Show/hide line numbers
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
Generated on Wed Jul 13 2022 02:27:36 by 1.7.2