Add support for KL46Z
Fork of BurstSPI by
BurstSPI.cpp
- Committer:
- Sissors
- Date:
- 2013-01-03
- Revision:
- 0:600eecd89a78
File content as of revision 0:600eecd89a78:
#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; } }