port for ece459
Fork of BurstSPI by
Diff: BurstSPI.cpp
- Revision:
- 3:7d9b64d67b22
- Parent:
- 2:a8e55f7cbfee
- Child:
- 4:8585ddebd28b
- Child:
- 5:4437229b0738
--- a/BurstSPI.cpp Fri Jan 04 09:51:42 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#include "BurstSPI.h" - -BurstSPI::BurstSPI(PinName mosi, PinName miso, PinName sclk) : SPI(mosi, miso, sclk){ - -} - - -void BurstSPI::fastWrite(int data) { - //Wait until FIFO has space - while(((_spi.spi->SR) & 0x02) == 0); - - //transmit data - _spi.spi->DR = data; - } - -void BurstSPI::setFormat( void ) { - format(_bits, _mode); - frequency(_hz); - } - -void BurstSPI::clearRX( void ) { - //Do it while either data in RX buffer, or while it is busy - while(((_spi.spi->SR) & ((1<<4) + (1<<2))) != 0) { - //Wait until data in RX buffer - while(((_spi.spi->SR) & (1<<2)) == 0); - int dummy = _spi.spi->DR; - } -} \ No newline at end of file