Added support for STM32F103RB

Committer:
peekpt
Date:
Fri Apr 24 11:09:03 2020 +0000
Revision:
14:8872ab64789c
Added support for STM32F103RB

Who changed what in which revision?

UserRevisionLine numberNew contents of line
peekpt 14:8872ab64789c 1 #if defined(TARGET_STM32F103RB)
peekpt 14:8872ab64789c 2 #include "BurstSPI.h"
peekpt 14:8872ab64789c 3
peekpt 14:8872ab64789c 4 void BurstSPI::fastWrite(int data)
peekpt 14:8872ab64789c 5 {
peekpt 14:8872ab64789c 6 SPI_TypeDef *spi = (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
peekpt 14:8872ab64789c 7 // Check if data is transmitted
peekpt 14:8872ab64789c 8 while ((spi->SR & SPI_SR_TXE) == 0);
peekpt 14:8872ab64789c 9 spi->DR = data;
peekpt 14:8872ab64789c 10 }
peekpt 14:8872ab64789c 11
peekpt 14:8872ab64789c 12 void BurstSPI::clearRX(void)
peekpt 14:8872ab64789c 13 {
peekpt 14:8872ab64789c 14 const SPI_TypeDef *spi =
peekpt 14:8872ab64789c 15 (SPI_TypeDef *)(_peripheral->spi.spi.handle.Instance);
peekpt 14:8872ab64789c 16 while (spi->SR & SPI_SR_BSY) {
peekpt 14:8872ab64789c 17 // Check RX buffer readable
peekpt 14:8872ab64789c 18 while ((spi->SR & SPI_SR_RXNE) == 0)
peekpt 14:8872ab64789c 19 ;
peekpt 14:8872ab64789c 20 int dummy = spi->DR;
peekpt 14:8872ab64789c 21 (void)dummy; // suppress UNUSED warning
peekpt 14:8872ab64789c 22 }
peekpt 14:8872ab64789c 23 }
peekpt 14:8872ab64789c 24
peekpt 14:8872ab64789c 25 #endif