overview="This part of the platform interface groups functions related to the SPI interface(s) of the MCU.",
-- Data structures, constants and types
structures=
{
{text=[[//SPImode
#definePLATFORM_SPI_MASTER1
#definePLATFORM_SPI_SLAVE0]],
name="Chip select",
desc="Constants used to select/deselect the SPI SS pin (if applicable)."
},
{text=[[//SSvalues
#definePLATFORM_SPI_SELECT_ON1
#definePLATFORM_SPI_SELECT_OFF0]],
name="SPI mode",
desc="Constants used to select/deselect the SPI SS pin (if applicable)."
},
{text="typedef u32 spi_data_type;",
name="SPI data type",
desc="This is the type of a SPI data word, thus limiting the maximum size of a SPI data work to 32 bits (which should be enough for all practical purposes)."
desc=[[This function is used to initialize the parameters of the SPI interface. <span class="warning">NOTE</span>: currently, only master SPI mode is implemented in eLua.]],
args=
{
"$id$ - SPI interface ID",
"$mode$ - SPI port mode ($PLATFORM_SPI_MASTER$ or $PLATFORM_SPI_SLAVE$, see @#spi_mode@here@.",
"$clock$ - clock speed for the SPI interface in master mode.",
"$cpol$ - SPI clock polarity",
"$cpha$ - SPI clock phase",
"$databits$ - length of the SPI data word in bits (usually 8, but configurable on some platforms)."
},
ret="the actual clock set for the SPI interface. Depending on the hardware, this may have a different value than the $clock$ argument."
},
{sig="spi_data_type #platform_spi_send_recv#( unsigned id, spi_data_type data );",
desc="Executes a SPI read/write cycle",
args=
{
"$id$ - SPI interface ID",
"$data$ - data to be sent to the SPI interface",
},
ret="data read from the SPI interface"
},
{sig="void #platform_spi_select#( unsigned id, int is_select );",