Added SPI driver for CC2538

This uses the core/dev/spi.h header and implements the spi_init()
function and the various macros for SPI operation. ssi.h contains all of
the register locations and information.

This implementation is not very versatile, mostly because I don't how to
make it flexible in the contiki system. It supports pin muxing for the
four spi pins, but other than that picks sensible defaults.

The SPI macros (like SPI_READ()) are defined in
cpu/cc2538/spi-arch.h. In order to use the SPI driver, add the following
includes to your project:

    #include "spi-arch.h
    #include "dev/spi.h"
This commit is contained in:
Brad Campbell 2013-09-05 14:59:56 -04:00
parent 55686d7ca2
commit e2af903d05
6 changed files with 364 additions and 1 deletions

View file

@ -178,6 +178,22 @@
#define PLATFORM_HAS_BUTTON 1
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name SPI configuration
*
* These values configure which CC2538 pins to use for the SPI lines.
* @{
*/
#define CC2538_SPI_CLK_PORT_NUM GPIO_A_NUM
#define CC2538_SPI_CLK_PIN_NUM 2
#define CC2538_SPI_MOSI_PORT_NUM GPIO_A_NUM
#define CC2538_SPI_MOSI_PIN_NUM 4
#define CC2538_SPI_MISO_PORT_NUM GPIO_A_NUM
#define CC2538_SPI_MISO_PIN_NUM 5
#define CC2538_SPI_SEL_PORT_NUM GPIO_B_NUM
#define CC2538_SPI_SEL_PIN_NUM 5
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name Device string used on startup
* @{