PebbleOS v4.47.0-1075-g013613c8a
Loading...
Searching...
No Matches
SPI memory on a SPI bus

Runs single-line memory operations as transfers on a SPI controller. More...

Data Structures

struct  pbl_spi_mem_spi
 SPI memory on a SPI bus. More...
 

Macros

#define PBL_SPI_MEM_SPI_BUF_SIZE   256U
 Largest data phase, and the size of the buffer data to write goes through.
 
#define PBL_SPI_MEM_SPI_DEFINE(sym, _name, _bus, _cs, _max_hz)
 Define a SPI memory on a SPI bus.
 

Detailed Description

Runs single-line memory operations as transfers on a SPI controller.

A memory on a SPI controller with no memory operations of its own gets one of these: the command, address and dummy bytes go out in a first transfer, and the data in a second, with the chip select asserted throughout.


Data Structure Documentation

◆ pbl_spi_mem_spi

struct pbl_spi_mem_spi

SPI memory on a SPI bus.

Data Fields
struct pbl_spi_mem_spi_data * data Driver state.
struct pbl_spi_dev dev The memory on the bus.
struct pbl_spi_mem mem Controller.

Macro Definition Documentation

◆ PBL_SPI_MEM_SPI_BUF_SIZE

#define PBL_SPI_MEM_SPI_BUF_SIZE   256U

Largest data phase, and the size of the buffer data to write goes through.

◆ PBL_SPI_MEM_SPI_DEFINE

#define PBL_SPI_MEM_SPI_DEFINE (   sym,
  _name,
  _bus,
  _cs,
  _max_hz 
)
Value:
static struct pbl_spi_mem_spi_data sym##_data = {.lock = PBL_MUTEX_INITIALIZER}; \
PBL_DEVICE_INSTANCE(sym, struct pbl_spi_mem_spi, struct pbl_spi_mem, mem) { \
.mem = PBL_SPI_MEM_INIT(sym, _name, nullptr, &pbl_spi_mem_spi_ops, 0U), \
.dev = PBL_SPI_DEV(_bus, _cs, _max_hz, PBL_SPI_MODE_0), .data = &sym##_data, \
}
SPI memory on a SPI bus.
Definition spi.h:35
A SPI memory controller.
Definition spi_mem.h:239
#define PBL_SPI_MEM_STATE_DEFINE(sym)
Define the class state of controller sym, for the PBL_SPI_MEM_*_DEFINE() macro of a driver.
Definition spi_mem.h:256
#define PBL_SPI_MEM_INIT(sym, _name, _parent, _ops, _flags)
Initializer for the struct pbl_spi_mem of controller sym.
Definition spi_mem.h:270
#define PBL_SPI_DEV(_bus, _cs, _max_hz, _mode)
Initializer for a struct pbl_spi_dev.
Definition spi.h:173
#define PBL_SPI_MODE_0
Mode 0: clock idles low, sample on the leading edge.
Definition spi.h:62
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50

Define a SPI memory on a SPI bus.

Parameters
symSymbol of the device.
_nameName.
_busSPI bus.
_csChip select of the memory.
_max_hzHighest SCK frequency of the memory, in Hz.