spi

group spi

Wrapper over the NRFX driver to include a leading address sent first.

Defines

SPI_MAX_XFER_LEN

Functions

void spi_init(void)

Configure the SPI peripheral.

void spi_uninit(void)

Reset the SPI peripheral.

void spi_chip_select(uint8_t cs_pin)

Select the CS pin: software control.

Parameters

cs_pin – GPIO pin to use, must be configured as output.

void spi_chip_deselect(uint8_t cs_pin)

Deselect the CS pin: software control.

Parameters

cs_pin – GPIO pin to use, must be configured as output.

void spi_xfer(uint8_t *buf, size_t len)

Write a buffer over SPI, and read the result back to the same buffer.

Parameters
  • cs_pin – Pin to use as chip-select signal, must be configured as output.

  • buf – Data buffer to send, starting one byte just before that pointer (compatibility hack).

  • len – Length of the buffer (buf[-1] excluded).

static inline void spi_set_cs_pin(uint8_t cs_pin)
static inline uint8_t *spi_write_burst(uint8_t addr, uint8_t *buf, size_t len)

Variables

static uint8_t m_cs_pin