contiki-os/contiki — pull request #598 by bradjc (2014-03-18 19:07:50+00:00)
Title: [SPI + CC2538] Update the SPI driver for CC2538

This PR updates the SPI driver I wrote a couple months ago with changes I've since realized are needed. It also makes a small change to `core/dev/spi.h`.

1. `SPI_FLUSH()` as written is inadequate for the CC2538 (which has a multi word FIFO instead of a single RX buffer). It can now be set by the platform if needed.
2. Using the hardware for the chip select line doesn't work as there is no way to tell the hardware when to toggle the line. This PR reverts any hardware control of the CS line and adds functions to make it easy to use a GPIO as the chip select line.
3. Before I only had one device and so made the SPI mode match that device. I now need to be able to configure the SSI/SPI mode between each device and added a function to do that.
4. I had to add `#include spi-arch.h` to `contiki-conf.h` in order to get `SPI_FLUSH` and `SPI_WAITFORTxREADY` to be defined before `spi.h` was included.

I've tested these changes with two SPI chips (Cypress FRAM and ADE7753) and everything is working so far.