File syn_soft_spi.c¶
FileList > drivers > syn_soft_spi.c
Go to the source code of this file
#include "../util/syn_assert.h"#include "syn_gpio.h"#include "syn_soft_spi.h"
Public Functions¶
| Type | Name |
|---|---|
| void | syn_soft_spi_deselect (SYN_SoftSPI * spi) Deassert chip select (drive inactive). |
| void | syn_soft_spi_init (SYN_SoftSPI * spi, SYN_GPIO_Pin sck, SYN_GPIO_Pin mosi, SYN_GPIO_Pin miso, SYN_SPIMode mode, uint32_t delay_loops) Initialize the soft SPI pins. |
| void | syn_soft_spi_select (SYN_SoftSPI * spi) Assert chip select (drive active). |
| void | syn_soft_spi_set_cs (SYN_SoftSPI * spi, SYN_GPIO_Pin cs_pin, bool active_low) Set an optional chip select pin. |
| uint8_t | syn_soft_spi_transfer (const SYN_SoftSPI * spi, uint8_t data) Transfer a single byte (read and write simultaneously). |
| void | syn_soft_spi_transfer_bulk (SYN_SoftSPI * spi, const uint8_t * tx, uint8_t * rx, size_t len) Transfer multiple bytes. |
Public Static Functions¶
| Type | Name |
|---|---|
| void | spi_delay (const SYN_SoftSPI * spi) |
Public Functions Documentation¶
function syn_soft_spi_deselect¶
Deassert chip select (drive inactive).
Parameters:
spiSoft SPI instance.
function syn_soft_spi_init¶
Initialize the soft SPI pins.
void syn_soft_spi_init (
SYN_SoftSPI * spi,
SYN_GPIO_Pin sck,
SYN_GPIO_Pin mosi,
SYN_GPIO_Pin miso,
SYN_SPIMode mode,
uint32_t delay_loops
)
Parameters:
spiPointer to SPI instance.sckSCK pin.mosiMOSI pin.misoMISO pin.modeSPI Mode (0-3).delay_loopsNumber of iterations for a half-clock delay.
function syn_soft_spi_select¶
Assert chip select (drive active).
Parameters:
spiSoft SPI instance.
function syn_soft_spi_set_cs¶
Set an optional chip select pin.
When set, syn_soft_spi_select/deselect can be used to assert/deassert CS.
Parameters:
spiSPI instance.cs_pinChip select GPIO pin.active_lowtrue if CS is active-low (most common).
function syn_soft_spi_transfer¶
Transfer a single byte (read and write simultaneously).
Parameters:
spiPointer to SPI instance.dataByte to write out on MOSI.
Returns:
Byte read in from MISO.
function syn_soft_spi_transfer_bulk¶
Transfer multiple bytes.
Parameters:
spiPointer to SPI instance.txBuffer to transmit (can be NULL if rx-only).rxBuffer to receive into (can be NULL if tx-only).lenNumber of bytes to transfer.
Public Static Functions Documentation¶
function spi_delay¶
The documentation for this class was generated from the following file src/syntropic/drivers/syn_soft_spi.c