nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

SPI Master Loopback Example Application main file. More...

Macros

#define DELAY_MS   100
 

Functions

static bool test_spi_tx_rx (SPIModuleNumber mod_num, uint8_t lsb_first)
 Function for testing the SPI master. More...
 
int main (void)
 Function for main application entry. More...
 

Variables

static uint8_t tx_data [TX_RX_MSG_LENGTH]
 
static uint8_t rx_data [TX_RX_MSG_LENGTH]
 

Detailed Description

This file contains the source code for a sample application using SPI.

Macro Definition Documentation

#define DELAY_MS   100

Timer Delay in milli-seconds.

Function Documentation

static bool test_spi_tx_rx ( SPIModuleNumber  mod_num,
uint8_t  lsb_first 
)
static
Parameters
lsb_first[in]If true, the least significant bits are transferred first.
mod_num[in]spi module to be used, either SPI0 or SPI1 from enumeration SPIModuleNumber.
Return values
true
falseError occurred
Note
If debug is enabled DEBUG, then this function will configure DEBUG_EVENT_READY_PIN to toggle (using GPIOTE) everytime READY_EVENTS are generated in the SPI
This flag will configure GPIOTE CONFIG0 and PPI channel 0, do not enable DEBUG while using two spi modules in parallel
int main ( void  )

Test with shift Lsb first mode 0.

Delay for the events ready signal to be visually seen DEBUG flag is enabled.

test with shift Lsb first mode 0

Delay for the events ready signal to be visually seen DEBUG flag is enabled.

Variable Documentation

uint8_t tx_data[TX_RX_MSG_LENGTH]
static

SPI TX buffer.

uint8_t rx_data[TX_RX_MSG_LENGTH]
static

SPI RX buffer.