File syn_port_spi.h¶
FileList > port > syn_port_spi.h
Go to the source code of this file
SPI port interface — implement these for your platform. More...
#include "../common/syn_defs.h"#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_SPI_Config SPI bus configuration. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_SPI_Mode SPI clock polarity/phase mode. |
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_port_spi_cs_assert (uint8_t bus, SYN_GPIO_Pin cs_pin) Assert (pull low) an SPI chip-select pin. |
| SYN_Status | syn_port_spi_cs_deassert (uint8_t bus, SYN_GPIO_Pin cs_pin) Deassert (release high) an SPI chip-select pin. |
| SYN_Status | syn_port_spi_deinit (uint8_t bus) Deinitialize an SPI bus. |
| SYN_Status | syn_port_spi_init (const SYN_SPI_Config * cfg) Initialize an SPI bus. |
| SYN_Status | syn_port_spi_transfer (uint8_t bus, const uint8_t * tx_buf, uint8_t * rx_buf, size_t len) Full-duplex SPI transfer. |
Detailed Description¶
The user provides implementations of these functions to connect SyntropicOS to their MCU's SPI peripheral.
Public Types Documentation¶
enum SYN_SPI_Mode¶
SPI clock polarity/phase mode.
enum SYN_SPI_Mode {
SYN_SPI_MODE_0 = 0,
SYN_SPI_MODE_1 = 1,
SYN_SPI_MODE_2 = 2,
SYN_SPI_MODE_3 = 3
};
Public Functions Documentation¶
function syn_port_spi_cs_assert¶
Assert (pull low) an SPI chip-select pin.
Parameters:
busSPI bus index.cs_pinChip-select GPIO pin.
Returns:
SYN_OK on success.
function syn_port_spi_cs_deassert¶
Deassert (release high) an SPI chip-select pin.
Parameters:
busSPI bus index.cs_pinChip-select GPIO pin.
Returns:
SYN_OK on success.
function syn_port_spi_deinit¶
Deinitialize an SPI bus.
Parameters:
busSPI bus index.
Returns:
SYN_OK on success.
function syn_port_spi_init¶
Initialize an SPI bus.
Parameters:
cfgSPI configuration.
Returns:
SYN_OK on success.
function syn_port_spi_transfer¶
Full-duplex SPI transfer.
SYN_Status syn_port_spi_transfer (
uint8_t bus,
const uint8_t * tx_buf,
uint8_t * rx_buf,
size_t len
)
Simultaneously transmits from tx_buf and receives into rx_buf. Either buffer can be NULL for half-duplex operation.
Parameters:
busSPI bus index.tx_bufTransmit buffer (NULL to send 0x00/0xFF).rx_bufReceive buffer (NULL to discard received data).lenNumber of bytes to transfer.
Returns:
SYN_OK on success.
The documentation for this class was generated from the following file src/syntropic/port/syn_port_spi.h