Hello,
If you open the Help of the SPIMaster_LDD component (open the context menu of the SPIMaster_LDD component in the Components windows and select the Help on Component command), you can find code examples on the Typical Usage page of the component's help. For example (SPIMaster_LDD without interrupts):
#define BLOCK_SIZE 4
uint8_t OutData[BLOCK_SIZE] = "0123";
uint8_t InpData[BLOCK_SIZE];
volatile LDD_SPIMASTER_TError ComError = 0U;
LDD_TError Error;
LDD_TDeviceData *MySPIPtr;
void main(void)
{
...
MySPIPtr = SM1_Init(NULL); /* Initialization of SM1 component */
SM1_SelectConfiguration(MySPIPtr, 1U, 1U); /* Select chip select 1 and attribute set 1 */
Error = SM1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */
Error = SM1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */
while (!SM1_GetBlockReceivedStatus(MySPIPtr)) { /* Wait until data block is transmitted/received */
SM1_Main(MySPIPtr);
}
SM1_SelectConfiguration(MySPIPtr, 0U, 0U); /* Select chip select 0 and attribute set 0 */
Error = SM1_ReceiveBlock(MySPIPtr, InpData, BLOCK_SIZE); /* Request data block reception */
Error = SM1_SendBlock(MySPIPtr, OutData, BLOCK_SIZE); /* Start transmission/reception */
while (!SM1_GetBlockReceivedStatus(MySPIPtr)) { /* Wait until data block is transmitted/received */
SM1_Main(MySPIPtr);
}
}
Best Regards,
Marek Neuzil