Fork for fixing STM32
Fork of BurstSPI by
Embed:
(wiki syntax)
Show/hide line numbers
BurstSPI_NUCLEO_L152RE.cpp
00001 /* BurstSPI_NUCLEO_L152RE.cpp */ 00002 #ifdef TARGET_NUCLEO_L152RE 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_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_TXE) != RESET) ? 1 : 0)); 00010 SPI_I2S_SendData(spi, (uint16_t)data); 00011 } 00012 00013 void BurstSPI::clearRX( void ) { 00014 int status; 00015 //Check if the RX buffer is busy 00016 SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi); 00017 status = ((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_BSY) != RESET) ? 1 : 0); 00018 if (status){ 00019 // Check RX buffer readable 00020 while (!((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_RXNE) != RESET) ? 1 : 0)); 00021 int dummy = (int)SPI_I2S_ReceiveData(spi); 00022 } 00023 } 00024 #endif 00025
Generated on Wed Jul 13 2022 02:27:36 by 1.7.2