Fork of BurstSPI with Nucleo F411RE support
Fork of BurstSPI by
Revision 11:9d43f61b3184, committed 2014-12-05
- Comitter:
- infotech1
- Date:
- Fri Dec 05 06:35:12 2014 +0000
- Parent:
- 10:6ed1d9f1ef37
- Commit message:
- Added F411RE support
Changed in this revision
BurstSPI_Nucleo_F411RE.cpp | Show annotated file Show diff for this revision Revisions of this file |
BurstSPI_Unsupported.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BurstSPI_Nucleo_F411RE.cpp Fri Dec 05 06:35:12 2014 +0000 @@ -0,0 +1,27 @@ +/* + Only tested with a Ili9341 TFT on a Nucleo F411RE board. + -James Kidd +*/ + +/* BurstSPI_NUCLEO_F411RE.cpp */ +#ifdef TARGET_NUCLEO_F411RE +#include "BurstSPI.h" + +static SPI_HandleTypeDef SpiHandle; + +void BurstSPI::fastWrite(int data) { + SpiHandle.Instance = (SPI_TypeDef *)(_spi.spi); + while (!((__HAL_SPI_GET_FLAG(&SpiHandle, SPI_FLAG_TXE) != RESET) ? 1 : 0)); + SpiHandle.Instance->DR =(uint16_t)data; + } + +void BurstSPI::clearRX( void ) { + SpiHandle.Instance = (SPI_TypeDef *)(_spi.spi); + //wait till SPI is not busy + while(__HAL_SPI_GET_FLAG(&SpiHandle, SPI_FLAG_BSY) != RESET); + //Loop while data in RX, may not be needed + while(__HAL_SPI_GET_FLAG(&SpiHandle, SPI_FLAG_RXNE) != RESET){ + int dummy = SpiHandle.Instance->DR; + } +} +#endif
--- a/BurstSPI_Unsupported.cpp Tue Oct 07 10:55:42 2014 +0000 +++ b/BurstSPI_Unsupported.cpp Fri Dec 05 06:35:12 2014 +0000 @@ -1,6 +1,7 @@ #if !(defined(TARGET_KL25Z) || defined(TARGET_KL46Z)) #if !(defined(TARGET_LPC1768) || defined(TARGET_LPC1114) || defined(TARGET_LPC11U24) || defined(TARGET_LPC13XX)) -#if !(defined(TARGET_NUCLEO_L152RE)) +#if !(defined(TARGET_NUCLEO_L152RE) || defined(TARGET_NUCLEO_F411RE)) + #warning BurstSPI target not supported, reverting to regular SPI