PebbleOS v4.43.0-108-gde23235b2
Loading...
Searching...
No Matches
nRF5 SPI

SPI bus driver for the nRF5 SPIM peripheral. More...

Data Structures

struct  pbl_spi_nrf5
 nRF5 SPI bus. More...
 

Macros

#define PBL_SPI_NRF5_DEFINE(sym, _name, _idx, _sck, _mosi, _miso, _deps, ...)
 Define a bus on an nRF5 SPIM instance.
 

Functions

void pbl_spi_nrf5_irq_handler (const struct pbl_spi_nrf5 *spi)
 SPIM interrupt handler, to connect with PBL_IRQ_CONNECT().
 

Detailed Description

SPI bus driver for the nRF5 SPIM peripheral.

Transfers run through EasyDMA, so their buffers must be in data RAM, and are at most 65535 bytes. The clock runs at 125 kHz to 8 MHz, or up to 32 MHz on SPIM3.

SCK and MOSI are outputs and MISO an input with its wiring flags, e.g. a pull, and keep that configuration while the bus is disabled; MOSI and MISO may be left unconnected. The SPIM interrupt is connected by the board:

PBL_SPI_NRF5_DEFINE(s_spi3, "spi3", 3, PBL_GPIO(NRF5_GPIO_P0, 6, 0),
PBL_GPIO(NRF5_GPIO_P0, 8, 0), PBL_GPIO(NULL, 0, 0), NULL,
#define NRF5_GPIO_P1
Port P1.
Definition nrf5.h:42
#define NRF5_GPIO_P0
Port P0.
Definition nrf5.h:40
#define PBL_GPIO_ACTIVE_LOW
The pin is active when low.
Definition gpio.h:50
#define PBL_GPIO(_port, _pin, _flags)
Initializer for a struct pbl_gpio.
Definition gpio.h:148
void pbl_spi_nrf5_irq_handler(const struct pbl_spi_nrf5 *spi)
SPIM interrupt handler, to connect with PBL_IRQ_CONNECT().
#define PBL_SPI_NRF5_DEFINE(sym, _name, _idx, _sck, _mosi, _miso, _deps,...)
Define a bus on an nRF5 SPIM instance.
Definition nrf5.h:62
#define PBL_IRQ_CONNECT(line, prio, isr, arg, flags)
Bind a SoC interrupt line to a handler at build time.
Definition irq.h:114

Data Structure Documentation

◆ pbl_spi_nrf5

struct pbl_spi_nrf5

nRF5 SPI bus.

Data Fields
struct pbl_spi_bus bus SPI bus.
uint8_t index SPIM instance index.
struct pbl_gpio miso MISO pin, or unconnected.
struct pbl_gpio mosi MOSI pin, or unconnected.
struct pbl_gpio sck SCK pin.

Macro Definition Documentation

◆ PBL_SPI_NRF5_DEFINE

#define PBL_SPI_NRF5_DEFINE (   sym,
  _name,
  _idx,
  _sck,
  _mosi,
  _miso,
  _deps,
  ... 
)
Value:
PBL_SPI_BUS_STATE_DEFINE(sym, __VA_ARGS__); \
const struct pbl_spi_nrf5 sym = { \
.bus = PBL_SPI_BUS_INIT(sym, _name, &pbl_spi_nrf5_ops, _deps), \
.index = (_idx), \
.sck = _sck, \
.mosi = _mosi, \
.miso = _miso, \
}; \
PBL_DEVICE_REGISTER(sym, &sym.bus.dev)
struct pbl_gpio miso
MISO pin, or unconnected.
Definition nrf5.h:43
struct pbl_gpio mosi
MOSI pin, or unconnected.
Definition nrf5.h:41
struct pbl_gpio sck
SCK pin.
Definition nrf5.h:39
struct pbl_spi_bus bus
SPI bus.
Definition nrf5.h:35
nRF5 SPI bus.
Definition nrf5.h:33
struct pbl_device dev
Device.
Definition spi.h:142
#define PBL_SPI_BUS_STATE_DEFINE(sym,...)
Define the class state of bus sym, for the PBL_SPI_*_DEFINE() macro of a driver.
Definition spi.h:182
#define PBL_SPI_BUS_INIT(sym, _name, _ops, _deps)
Initializer for the struct pbl_spi_bus of bus sym.
Definition spi.h:195

Define a bus on an nRF5 SPIM instance.

Parameters
symSymbol of the bus.
_nameName.
_idxSPIM instance index.
_sckSCK pin, from PBL_GPIO().
_mosiMOSI pin, from PBL_GPIO().
_misoMISO pin, from PBL_GPIO().
_depsDependencies from PBL_DEVICE_DEPS(), or NULL.
...Chip select GPIOs, from PBL_GPIO().

Function Documentation

◆ pbl_spi_nrf5_irq_handler()

void pbl_spi_nrf5_irq_handler ( const struct pbl_spi_nrf5 *  spi)

SPIM interrupt handler, to connect with PBL_IRQ_CONNECT().

Parameters
spiBus.