|
uint | spi_init (spi_inst_t *spi, uint baudrate) |
| Initialise SPI instancesPuts the SPI into a known state, and enable it. Must be called before other functions. More...
|
|
void | spi_deinit (spi_inst_t *spi) |
| Deinitialise SPI instancesPuts the SPI into a disabled state. Init will need to be called to reenable the device functions. More...
|
|
uint | spi_set_baudrate (spi_inst_t *spi, uint baudrate) |
| Set SPI baudrateSet SPI frequency as close as possible to baudrate, and return the actual achieved rate. More...
|
|
uint | spi_get_baudrate (const spi_inst_t *spi) |
| Get SPI baudrateGet SPI baudrate which was set by. More...
|
|
static uint | spi_get_index (const spi_inst_t *spi) |
| Convert SPI instance to hardware instance number. More...
|
|
static spi_hw_t * | spi_get_hw (spi_inst_t *spi) |
|
static const spi_hw_t * | spi_get_const_hw (const spi_inst_t *spi) |
|
static void | spi_set_format (spi_inst_t *spi, uint data_bits, spi_cpol_t cpol, spi_cpha_t cpha, __unused spi_order_t order) |
| Configure SPIConfigure how the SPI serialises and deserialises data on the wire. More...
|
|
static void | spi_set_slave (spi_inst_t *spi, bool slave) |
| Set SPI master/slaveConfigure the SPI for master- or slave-mode operation. By default, spi_init() sets master-mode. More...
|
|
static bool | spi_is_writable (const spi_inst_t *spi) |
| Check whether a write can be done on SPI device. More...
|
|
static bool | spi_is_readable (const spi_inst_t *spi) |
| Check whether a read can be done on SPI device. More...
|
|
static bool | spi_is_busy (const spi_inst_t *spi) |
| Check whether SPI is busy. More...
|
|
int | spi_write_read_blocking (spi_inst_t *spi, const uint8_t *src, uint8_t *dst, size_t len) |
| Write/Read to/from an SPI deviceWrite len bytes from src to SPI. Simultaneously read len bytes from SPI to dst . Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate. More...
|
|
int | spi_write_blocking (spi_inst_t *spi, const uint8_t *src, size_t len) |
| Write to an SPI device, blockingWrite len bytes from src to SPI, and discard any data received back Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate. More...
|
|
int | spi_read_blocking (spi_inst_t *spi, uint8_t repeated_tx_data, uint8_t *dst, size_t len) |
| Read from an SPI deviceRead len bytes from SPI to dst . Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate. repeated_tx_data is output repeatedly on TX as data is read in from RX. Generally this can be 0, but some devices require a specific value here, e.g. SD cards expect 0xff. More...
|
|
int | spi_write16_read16_blocking (spi_inst_t *spi, const uint16_t *src, uint16_t *dst, size_t len) |
| Write/Read half words to/from an SPI deviceWrite len halfwords from src to SPI. Simultaneously read len halfwords from SPI to dst . Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate. More...
|
|
int | spi_write16_blocking (spi_inst_t *spi, const uint16_t *src, size_t len) |
| Write to an SPI deviceWrite len halfwords from src to SPI. Discard any data received back. Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate. More...
|
|
int | spi_read16_blocking (spi_inst_t *spi, uint16_t repeated_tx_data, uint16_t *dst, size_t len) |
| Read from an SPI deviceRead len halfwords from SPI to dst . Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate. repeated_tx_data is output repeatedly on TX as data is read in from RX. Generally this can be 0, but some devices require a specific value here, e.g. SD cards expect 0xff. More...
|
|
static uint | spi_get_dreq (spi_inst_t *spi, bool is_tx) |
| Return the DREQ to use for pacing transfers to/from a particular SPI instance. More...
|
|