45 #define SPI_CLK_PORT_BASE GPIO_PORT_TO_BASE(SPI_CLK_PORT)
46 #define SPI_CLK_PIN_MASK GPIO_PIN_MASK(SPI_CLK_PIN)
47 #define SPI_MOSI_PORT_BASE GPIO_PORT_TO_BASE(SPI_MOSI_PORT)
48 #define SPI_MOSI_PIN_MASK GPIO_PIN_MASK(SPI_MOSI_PIN)
49 #define SPI_MISO_PORT_BASE GPIO_PORT_TO_BASE(SPI_MISO_PORT)
50 #define SPI_MISO_PIN_MASK GPIO_PIN_MASK(SPI_MISO_PIN)
77 ioc_set_sel(SPI_CLK_PORT, SPI_CLK_PIN, IOC_PXX_SEL_SSI0_CLKOUT);
78 ioc_set_sel(SPI_MOSI_PORT, SPI_MOSI_PIN, IOC_PXX_SEL_SSI0_TXD);
129 void spi_set_mode(uint32_t frame_format, uint32_t clock_polarity, uint32_t clock_phase, uint32_t data_size)
135 REG(
SSI0_BASE +
SSI_CR0) = clock_phase | clock_polarity | frame_format | (data_size - 1);
#define GPIO_PORT_TO_BASE(PORT)
Converts a port number to the port base address.
Header file for the cc2538 SPI commands.
void spi_cs_init(uint8_t port, uint8_t pin)
Configure a GPIO to be the chip select pin.
Header file with register and macro declarations for the cc2538 GPIO module.
#define SYS_CTRL_RCGCSSI
SSI[1:0] clocks - active mode.
#define SSI_CPSR
Clock divider.
Header file for the cc2538 Synchronous Serial Interface.
void ioc_set_over(uint8_t port, uint8_t pin, uint8_t over)
Set Port:Pin override function.
Header file with declarations for the I/O Control module.
void spi_enable(void)
Enables the SPI peripheral.
#define GPIO_PERIPHERAL_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be under peripheral control with PIN_MASK of port with PORT_BASE.
#define IOC_SSIRXD_SSI0
SSI0 RX.
#define SSI_CC
Clock configuration.
#define IOC_OVERRIDE_DIS
Override Disabled.
#define SSI_CR0
Control register 0.
Header file with register manipulation macro definitions.
#define SSI0_BASE
Base address for SSI0.
void ioc_set_sel(uint8_t port, uint8_t pin, uint8_t sel)
Function select for Port:Pin.
void spi_set_mode(uint32_t frame_format, uint32_t clock_polarity, uint32_t clock_phase, uint32_t data_size)
Configure the SPI data and clock polarity and the data size.
Header file for the cc2538 System Control driver.
#define SSI_CR1
Control register 1.
#define GPIO_SOFTWARE_CONTROL(PORT_BASE, PIN_MASK)
Configure the pin to be software controlled with PIN_MASK of port with PORT_BASE. ...
#define GPIO_SET_OUTPUT(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE to output.
#define SSI_CR0_SPH
Serial clock phase (H)
#define SSI_CR0_SPO
Serial clock phase (O)
#define SSI_CR1_SSE
Synchronous serial port enable.
#define GPIO_PIN_MASK(PIN)
Converts a pin number to a pin mask.
#define GPIO_SET_PIN(PORT_BASE, PIN_MASK)
Set pins with PIN_MASK of port with PORT_BASE high.
void spi_init(void)
Initialize the SPI bus.
void spi_disable(void)
Disables the SPI peripheral.