Fork for fixing STM32

Dependents:   SSD1351

Fork of BurstSPI by Erik -

Committer:
EricWieser
Date:
Sat Oct 15 16:01:12 2016 +0000
Revision:
14:98658a80a698
Parent:
13:bc069279eb37
Fix compilation errors on the STM32Nucleo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Alamalione 4:8585ddebd28b 1 /* BurstSPI_NUCLEO_L152RE.cpp */
Alamalione 4:8585ddebd28b 2 #ifdef TARGET_NUCLEO_L152RE
Alamalione 4:8585ddebd28b 3 #include "BurstSPI.h"
Alamalione 4:8585ddebd28b 4
Alamalione 4:8585ddebd28b 5 void BurstSPI::fastWrite(int data) {
Alamalione 4:8585ddebd28b 6
Alamalione 4:8585ddebd28b 7 SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi);
Alamalione 4:8585ddebd28b 8 // Check if data is transmitted
Alamalione 4:8585ddebd28b 9 while (!((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_TXE) != RESET) ? 1 : 0));
Alamalione 4:8585ddebd28b 10 SPI_I2S_SendData(spi, (uint16_t)data);
Alamalione 4:8585ddebd28b 11 }
Alamalione 4:8585ddebd28b 12
Alamalione 4:8585ddebd28b 13 void BurstSPI::clearRX( void ) {
Alamalione 4:8585ddebd28b 14 int status;
Alamalione 4:8585ddebd28b 15 //Check if the RX buffer is busy
Alamalione 4:8585ddebd28b 16 SPI_TypeDef *spi = (SPI_TypeDef *)(_spi.spi);
Alamalione 4:8585ddebd28b 17 status = ((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_BSY) != RESET) ? 1 : 0);
Alamalione 4:8585ddebd28b 18 if (status){
Alamalione 4:8585ddebd28b 19 // Check RX buffer readable
Alamalione 4:8585ddebd28b 20 while (!((SPI_I2S_GetFlagStatus(spi, SPI_I2S_FLAG_RXNE) != RESET) ? 1 : 0));
Alamalione 4:8585ddebd28b 21 int dummy = (int)SPI_I2S_ReceiveData(spi);
Alamalione 4:8585ddebd28b 22 }
Alamalione 4:8585ddebd28b 23 }
Alamalione 4:8585ddebd28b 24 #endif
Alamalione 4:8585ddebd28b 25