![]() |
Dataflow Runtime API
3.1.1.0
|
Enumerations | |
enum | SpiModuleAddress { SpiModuleAddress_Spi0 = SOC_SPI_0_REGS , SpiModuleAddress_Spi1 = SOC_SPI_1_REGS } |
Multichannel Serial Port Interface (McSPI). More... | |
enum | SpiChannel { SpiChannel_0 = 0U , SpiChannel_1 = 1U , SpiChannel_2 = 2U , SpiChannel_3 = 3U } |
Id's of the available SPI channels (do not change the value, they are required for internal address calculation) More... | |
enum | SpiMode { SpiMode_0 , SpiMode_1 , SpiMode_2 , SpiMode_3 } |
Id's of the supported SPI modes. More... | |
enum | SpiDataLineDirection { SpiDataLineDirection_MOSI , SpiDataLineDirection_MISO , SpiDataLineDirection_NotUsed } |
Id's of the supported SPI data line directions. More... | |
Functions | |
void | SPI_InitModuleAsMaster (const SpiModuleAddress moduleBaseAddress) |
Initializes the SPI module as master. More... | |
void | SPI_InitChannel (const SpiModuleAddress moduleBaseAddress, const SpiChannel channel, const SpiMode mode, const SpiDataLineDirection directionLine0, const SpiDataLineDirection directionLine1, const uint32_t spiFrequencykHz, const bool chipSelectActiveLow) |
Initializes the channel of the given SPI module. More... | |
void | SPI_WriteRead (const SpiModuleAddress moduleBaseAddress, const SpiChannel channel, const uint16_t *const pTxData, uint16_t *pRxData, const uint8_t bufferSize) |
Writes and reads data simultaneously with 16bit word length (blocking) More... | |
enum SpiChannel |
enum SpiDataLineDirection |
enum SpiMode |
enum SpiModuleAddress |
Multichannel Serial Port Interface (McSPI).
McSPI is a general-purpose receive/transmit master/slave controller that can interface with up to four slave external devices. It allows a duplex, synchronous, serial communication between a CPU and SPI compliant external devices (Slaves and Masters). Enumeration of the available SPI modules
Enumerator | |
---|---|
SpiModuleAddress_Spi0 | |
SpiModuleAddress_Spi1 |
void SPI_InitChannel | ( | const SpiModuleAddress | moduleBaseAddress, |
const SpiChannel | channel, | ||
const SpiMode | mode, | ||
const SpiDataLineDirection | directionLine0, | ||
const SpiDataLineDirection | directionLine1, | ||
const uint32_t | spiFrequencykHz, | ||
const bool | chipSelectActiveLow | ||
) |
Initializes the channel of the given SPI module.
moduleBaseAddress | The SPI module to use |
channel | The SPI channel to use |
mode | The SPI communication mode |
directionLine0 | Direction of SPI data line 0 (SPIDAT0) |
directionLine1 | Direction of SPI data line 1 (SPIDAT1) |
spiFrequencykHz | Frequency of the SPI clock |
chipSelectActiveLow | True to set the level of chip select active to low, false otherwise |
void SPI_InitModuleAsMaster | ( | const SpiModuleAddress | moduleBaseAddress | ) |
Initializes the SPI module as master.
moduleBaseAddress | - The SPI module to use |
void SPI_WriteRead | ( | const SpiModuleAddress | moduleBaseAddress, |
const SpiChannel | channel, | ||
const uint16_t *const | pTxData, | ||
uint16_t * | pRxData, | ||
const uint8_t | bufferSize | ||
) |
Writes and reads data simultaneously with 16bit word length (blocking)
moduleBaseAddress | The SPI module to use |
channel | The SPI channel to use |
pTxData | Buffer containing the data to transmit |
pRxData | Buffer containing the data received after function returned |
bufferSize | The number of elements in the send/receive buffer |