Added support for STM32F103RB
Revision 5:4437229b0738, committed 2014-07-19
- Comitter:
- kenno
- Date:
- Sat Jul 19 14:47:50 2014 +0000
- Parent:
- 3:7d9b64d67b22
- Child:
- 6:b862ffb6c5e2
- Commit message:
- Add BustSPI_KL46Z
Changed in this revision
BurstSPI_KL46Z.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_KL46Z.cpp Sat Jul 19 14:47:50 2014 +0000 @@ -0,0 +1,24 @@ +#ifdef TARGET_KL46Z +#include "BurstSPI.h" + +void BurstSPI::fastWrite(int data) { + //Wait until FIFO has space + while(((_spi.spi->S) & SPI_S_SPTEF_MASK) == 0); + //transmit data + _spi.spi->DL = data; + } + +void BurstSPI::clearRX( void ) { + //We put in a delay here, this function shouldn't be called very often, so not a huge problem + //Without delay you will rise the CS line before it is finished (been there, done that) + //We use time required to transmit 20 bits (8 bits being transmitted, 8 bits in FIFO, 4 bits safety margin + + float bytetime = 20.0/_hz; + wait(bytetime); + + //Wait until status is flagged that we can read, read: + while (_spi.spi->S & SPI_S_SPRF_MASK == 0); + int dummy = _spi.spi->DL; + +} +#endif \ No newline at end of file