24 #include <sol-common-buildopts.h>
80 #define SOL_SPI_DATA_BITS_DEFAULT 8
90 #ifndef SOL_NO_API_VERSION
91 #define SOL_SPI_CONFIG_API_VERSION (1)
130 SOL_ATTR_WARN_UNUSED_RESULT
154 int sol_spi_transfer(
struct sol_spi *spi,
const uint8_t *tx, uint8_t *rx,
size_t count,
void (*transfer_cb)(
void *cb_data,
struct sol_spi *spi,
const uint8_t *tx, uint8_t *rx, ssize_t status),
const void *cb_data);
void sol_spi_close(struct sol_spi *spi)
Close an SPI bus.
struct sol_spi_config sol_spi_config
SPI configuration struct.
CPOL = 1 and CPHA = 0.
Definition: sol-spi.h:74
CPOL = 0 and CPHA = 1.
Definition: sol-spi.h:73
enum sol_spi_mode sol_spi_mode_from_str(const char *spi_mode)
Converts a string SPI mode name to sol_spi_mode.
struct sol_spi * sol_spi_open(unsigned int bus, const struct sol_spi_config *config)
Open an SPI bus.
CPOL = 0 and CPHA = 0.
Definition: sol-spi.h:72
SPI configuration struct.
Definition: sol-spi.h:89
These are common Soletta macros.
const char * sol_spi_mode_to_str(enum sol_spi_mode spi_mode)
Converts sol_spi_mode to a string name.
enum sol_spi_mode mode
The SPI operation mode.
Definition: sol-spi.h:95
#define SOL_ATTR_WARN_UNUSED_RESULT
Causes a warning to be emitted if a caller of the function with this attribute does not use its retur...
Definition: sol-macros.h:187
uint16_t api_version
The API version.
Definition: sol-spi.h:92
unsigned int chip_select
Also know as slave select.
Definition: sol-spi.h:94
sol_spi_mode
SPI Transfer Modes.
Definition: sol-spi.h:70
uint32_t frequency
Clock frequency in Hz.
Definition: sol-spi.h:96
struct sol_spi sol_spi
A handle to a SPI bus.
Definition: sol-spi.h:53
uint8_t bits_per_word
Number of bits per word.
Definition: sol-spi.h:97
int sol_spi_transfer(struct sol_spi *spi, const uint8_t *tx, uint8_t *rx, size_t count, void(*transfer_cb)(void *cb_data, struct sol_spi *spi, const uint8_t *tx, uint8_t *rx, ssize_t status), const void *cb_data)
Perform a SPI asynchronous transfer.