[CC2538-SPI] Implement SPI_FLUSH, spi mode, !CS

Because the CC2538 has a multi-byte SPI RX FIFO, flushing the buffer
requires more than just a single read. This adds a loop that empties the
entire RX buffer on a FLUSH().

Different SPI chips needs different SPI settings. This commit adds a
function that allows chip drivers to configure the SPI peripheral before
using it.

The frame pin the driver was using as a chip select does not work as
most devices expect it to. It toggles after every byte, and most chips
interpret that as end of message. To make drivers more reliable, each
chip driver should setup a GPIO and assert it as needed.
This commit is contained in:
Brad Campbell 2014-03-18 10:11:49 -04:00
parent a96dc90250
commit af27d2d252
4 changed files with 115 additions and 59 deletions

View file

@ -193,8 +193,6 @@
#define SPI_MOSI_PIN 4
#define SPI_MISO_PORT GPIO_A_NUM
#define SPI_MISO_PIN 5
#define SPI_SEL_PORT GPIO_B_NUM
#define SPI_SEL_PIN 5
/** @} */
/*---------------------------------------------------------------------------*/
/**