Software SPI port descriptor definition. More...
Software SPI port descriptor definition.
Definition in file soft_spi.h.
Go to the source code of this file.
Data Structures | |
struct | soft_spi_conf_t |
Software SPI port descriptor. More... | |
Macros | |
#define | SOFT_SPI_DEV(x) (x) |
Default SPI device access macro. | |
#define | SOFT_SPI_UNDEF (UINT_MAX) |
Define global value for undefined SPI device. | |
#define | SOFT_SPI_CS_UNDEF (GPIO_UNDEF) |
Define value for unused CS line. | |
Typedefs | |
typedef unsigned int | soft_spi_t |
Default type for SPI devices. | |
typedef gpio_t | soft_spi_cs_t |
Chip select pin type overlaps with gpio_t so it can be casted to this. | |
Enumerations | |
enum | { SOFT_SPI_OK = 0, SOFT_SPI_NODEV = -1, SOFT_SPI_NOCS = -2, SOFT_SPI_NOMODE = -3, SOFT_SPI_NOCLK = -4 } |
Status codes used by the SPI driver interface. More... | |
enum | soft_spi_mode_t { SOFT_SPI_MODE_0 = 0, SOFT_SPI_MODE_1, SOFT_SPI_MODE_2, SOFT_SPI_MODE_3 } |
Available SPI modes, defining the configuration of clock polarity and clock phase. More... | |
enum | soft_spi_clk_t { SOFT_SPI_CLK_100KHZ = 5000, SOFT_SPI_CLK_400KHZ = 1250, SOFT_SPI_CLK_DEFAULT = 0 } |
Available SPI clock speeds. More... | |
Functions | |
void | soft_spi_init (soft_spi_t bus) |
Basic initialization of the given SPI bus. More... | |
void | soft_spi_init_pins (soft_spi_t bus) |
Initialize the used SPI bus pins, i.e. More... | |
int | soft_spi_init_cs (soft_spi_t bus, soft_spi_cs_t cs) |
Initialize the given chip select pin. More... | |
int | soft_spi_acquire (soft_spi_t bus, soft_spi_cs_t cs, soft_spi_mode_t mode, soft_spi_clk_t clk) |
Start a new SPI transaction. More... | |
void | soft_spi_release (soft_spi_t bus) |
Finish an ongoing SPI transaction by releasing the given SPI bus. More... | |
uint8_t | soft_spi_transfer_byte (soft_spi_t bus, soft_spi_cs_t cs, bool cont, uint8_t out) |
Transfer one byte on the given SPI bus Currently only the use of MOSI in master mode is implemented. More... | |
void | soft_spi_transfer_bytes (soft_spi_t bus, soft_spi_cs_t cs, bool cont, const void *out, void *in, size_t len) |
Transfer a number bytes using the given SPI bus. More... | |
uint8_t | soft_spi_transfer_reg (soft_spi_t bus, soft_spi_cs_t cs, uint8_t reg, uint8_t out) |
Transfer one byte to/from a given register address. More... | |
void | soft_spi_transfer_regs (soft_spi_t bus, soft_spi_cs_t cs, uint8_t reg, const void *out, void *in, size_t len) |
Transfer a number of bytes to/from a given register address. More... | |