nRF51 SDK - S110 SoftDevice
|
Software controlled SPI Slave driver. More...
Data Structures | |
struct | spi_slave_config_t |
SPI peripheral device configuration data. More... | |
struct | spi_slave_evt_t |
Struct containing event context from the SPI slave driver. More... | |
Typedefs | |
typedef void(* | spi_slave_event_handler_t )(spi_slave_evt_t event) |
SPI slave event callback function type. More... | |
Enumerations | |
enum | spi_slave_endian_t { SPIM_LSB_FIRST, SPIM_MSB_FIRST } |
SPI transaction bit order definitions. More... | |
enum | spi_slave_mode_t { SPI_MODE_0, SPI_MODE_1, SPI_MODE_2, SPI_MODE_3 } |
SPI mode definitions for clock polarity and phase. More... | |
enum | spi_slave_evt_type_t { SPI_SLAVE_BUFFERS_SET_DONE, SPI_SLAVE_XFER_DONE, SPI_SLAVE_EVT_TYPE_MAX } |
Event callback function event definitions. More... | |
Functions | |
uint32_t | spi_slave_evt_handler_register (spi_slave_event_handler_t event_handler) |
Function for registering a handler for SPI slave driver event. More... | |
uint32_t | spi_slave_init (const spi_slave_config_t *p_spi_slave_config) |
Function for initializing the SPI slave device. More... | |
uint32_t | spi_slave_buffers_set (uint8_t *p_tx_buf, uint8_t *p_rx_buf, uint8_t tx_buf_length, uint8_t rx_buf_length) |
Function for preparing the SPI slave device ready for a single SPI transaction. More... | |
void | spi_slave_set_cs_pull_up_config (uint32_t alternate_config) |
Function for changing defult pull-up configuration for CSN pin. More... | |
Software controlled SPI Slave driver.
typedef void(* spi_slave_event_handler_t)(spi_slave_evt_t event) |
SPI slave event callback function type.
[in] | event | SPI slave driver event. |
enum spi_slave_endian_t |
enum spi_slave_evt_type_t |
Event callback function event definitions.
enum spi_slave_mode_t |
uint32_t spi_slave_buffers_set | ( | uint8_t * | p_tx_buf, |
uint8_t * | p_rx_buf, | ||
uint8_t | tx_buf_length, | ||
uint8_t | rx_buf_length | ||
) |
Function for preparing the SPI slave device ready for a single SPI transaction.
Function prepares the SPI slave device to be ready for a single SPI transaction. It configures the SPI slave device to use the memory, supplied with the function call, in SPI transactions.
The spi_slave_event_handler_t will be called with appropriate event spi_slave_evt_type_t when either the memory buffer configuration or SPI transaction has been completed.
[in] | p_tx_buf | Pointer to the TX buffer. |
[in] | p_rx_buf | Pointer to the RX buffer. |
[in] | tx_buf_length | Length of the TX buffer in bytes. |
[in] | rx_buf_length | Length of the RX buffer in bytes. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
NRF_ERROR_INVALID_STATE | Operation failure. SPI slave device in incorrect state. |
NRF_ERROR_INTERNAL | Operation failure. Internal error ocurred. |
uint32_t spi_slave_evt_handler_register | ( | spi_slave_event_handler_t | event_handler | ) |
Function for registering a handler for SPI slave driver event.
[in] | event_handler | The function to be called by the SPI slave driver upon event. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | Operation success. NULL handler registered. |
uint32_t spi_slave_init | ( | const spi_slave_config_t * | p_spi_slave_config | ) |
Function for initializing the SPI slave device.
[in] | p_spi_slave_config | SPI peripheral device configuration data. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
NRF_ERROR_INVALID_PARAM | Operation failure. Invalid parameter supplied. |
void spi_slave_set_cs_pull_up_config | ( | uint32_t | alternate_config | ) |
Function for changing defult pull-up configuration for CSN pin.
Function for changing defult drive for MISO pin.
In default configuration pull-up at CSN pin disabled. If alternate configuration is required this function might be called before spi_slave_init() to change default settings for CSN pin
In default configuration pin drive is set to S0S1. If alternate configuration is required this function might be called before spi_slave_init() to change default settings for MISO pin