DolphinV4 API
1.6.1.0
|
Functions | |
void | spi_init (uint8 *pu8Param) |
void | spi_setCS (bit1 u1Val) |
RETURN_TYPE | spi_getSendBuffer (uint8 *u8SendBuff, uint8 *u8GetBuff, uint8 u8NoBytes, SPI_PACKETSIZE u8PacketSize, DPLX_MODES u8Dplx) |
The SPI module is used for communication between the DOLPHIN IC and a HOST using the SPI protocol. The SPI module supports communication where the DOLPHIN acts as SPI-Master and the HOST acts SPI-Slave.
The SPI module supports packet transmission. The size of one packet can be 1,2,3 or 4 bytes. The CS can't be modified during packet transmission. The maximum speed of one packet transmission is 2Mbit. Between two packets a certain processing delay is needed called interpacket delay. size of the interpacket delay depends on the following factors:
void spi_init | ( | uint8 * | pu8Param | ) |
Initialises the SPI module.
[in] | *pu8Param | Pointer to parameter array |
void spi_setCS | ( | bit1 | u1Val | ) |
Sets the CS bit to the given value
[in] | u1Val | TRUE, the CS line will be HIGH, FALSE, the CS line will be LOW |
Example 1:
This function is for controlling the CS line in SPI interface
RETURN_TYPE spi_getSendBuffer | ( | uint8 * | u8SendBuff, |
uint8 * | u8GetBuff, | ||
uint8 | u8NoBytes, | ||
SPI_PACKETSIZE | u8PacketSize, | ||
DPLX_MODES | u8Dplx | ||
) |
Sends and gets data to/from SPI interface.
[in] | *pu8SendBuff | Pointer to character buffer to send, NULL if no characters to send |
[out] | *pu8GetBuff | Pointer to character buffer to receive, NULL if no characters to get |
[in] | u8NoBytes | Number of characters to send/receive, note that this value has to be aligned to u8PacketSize |
[in] | u8PacketSize | One transmitted packet size which is transmitted at once (can be 1 - 4 bytes) |
[in] | u8Dplx | Duplex mode, full duplex, half duplex rx or half duplex tx can be selected |
Example 1:
Make a full duplex SPI communication, send/receive 12 characters with manual CS and packet size 4
Example 2:
Make a half duplex Tx SPI communication, send/receive 12 characters with auto CS and packet size 1