LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
spi.c File Reference
#include "board.h"
#include "stdio.h"

Go to the source code of this file.

Macros

#define BUFFER_SIZE   (0x100)
 
#define SPI_MASTER_MODE_SEL   (0x31)
 
#define SPI_SLAVE_MODE_SEL   (0x32)
 
#define SPI_MODE_SEL   (SPI_MASTER_MODE_SEL)
 
#define SPI_POLLING_SEL   (0x31)
 
#define SPI_INTERRUPT_SEL   (0x32)
 
#define SPI_TRANSFER_MODE_SEL   (SPI_POLLING_SEL)
 
#define LPC_SSP   LPC_SSP1
 
#define LPC_GPDMA_SSP_TX   GPDMA_CONN_SSP1_Tx
 
#define LPC_GPDMA_SSP_RX   GPDMA_CONN_SSP1_Rx
 

Functions

static void bufferInit (uint8_t *tx_buf, uint8_t *rx_buf)
 
static uint8_t bufferVerify (uint8_t *tx_buf, uint8_t *rx_buf)
 
void DMA_IRQHandler (void)
 DMA interrupt handler sub-routine. Set the waiting flag when transfer is successful.
 
static void appSSPRun (void)
 
static void appSPIRun (void)
 
int main (void)
 Main routine for SPI example.
 

Variables

static uint8_t spi_tx_buf [BUFFER_SIZE]
 
static uint8_t spi_rx_buf [BUFFER_SIZE]
 
static CHIP_SPI_CONFIG_FORMAT_T spi_format
 
static CHIP_SPI_DATA_SETUP_T spi_xf
 
static volatile uint8_t spi_xfer_completed = 0
 
static uint8_t ssp_tx_buf [BUFFER_SIZE]
 
static uint8_t ssp_rx_buf [BUFFER_SIZE]
 
static SSP_ConfigFormat ssp_format
 
static uint8_t ssp_dma_tx_ch
 
static uint8_t ssp_dma_rx_ch
 
static volatile uint8_t ssp_dma_txf_completed = 0
 
static volatile uint8_t ssp_dma_rxf_completed = 0