Class to be able to send SPI data with almost no overhead, useful at very high speeds.
Dependents:
MakerBotServer
epaper_mbed_130411_KL25Z
epaper_mbed_test
epaper_mbed_test_copy1
... more
2 comments:
Add following "BurstSPI_STMF103C8.cpp" and make according changes in "BurstSPI_Unsupported.cpp"
#if defined(TARGET_STM32F103C8)
#include "BurstSPI.h"
void BurstSPI::fastWrite(int data)
{
SPI_TypeDef *spi = (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
// Check if data is transmitted
while ((spi->SR & SPI_SR_TXE) == 0);
spi->DR = data;
}
void BurstSPI::clearRX( void )
{
const SPI_TypeDef *spi = (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
while (spi->SR & SPI_SR_BSY){
// Check RX buffer readable
while ((spi->SR & SPI_SR_RXNE) == 0);
int dummy = spi->DR;
(void)dummy; // suppress UNUSED warning
}
}
#endif
Add following "BurstSPI_STMF103C8.cpp" and make according changes in "BurstSPI_Unsupported.cpp"