Added support for STM32F103RB
BurstSPI_NUCLEO_L152RE.cpp@13:bc069279eb37, 2015-05-16 (annotated)
- Committer:
- Sissors
- Date:
- Sat May 16 11:09:59 2015 +0000
- Revision:
- 13:bc069279eb37
- Parent:
- 4:8585ddebd28b
Added STM F4XX support.
;
; (And seriously STM, it has the same SPI as the already supported L152, but you just had to go ahead and change all your driver files)
Who changed what in which revision?
User | Revision | Line number | New 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 |