User`s manual

RX62N Group, RX621 Group 5. Usage Examples
/* Transfer all the data once */
R_SPI_Transfer(
MASTER_CHANNEL,
PDL_NO_DATA,
master_0_tx_data,
master_0_rx_data,
1,
PDL_NO_FUNC,
0
);
while (slave_transfer_complete == false);
for (i = 0; i < 4; i++)
{
/* Did the Master output match the Slave input? */
if (master_0_tx_data[i] != slave_0_rx_data[i])
{
/* Handle the error */
}
/* Did the Master input match the Slave output? */
if (master_0_rx_data[i] != slave_0_tx_data[i])
{
/* Handle the error */
}
}
}
void spi_slave_callback(void)
{
uint16_t StatusValue = 0;
uint16_t Sequence_count;
/* Read the slave channel status */
R_SPI_GetStatus(
SLAVE_CHANNEL,
&StatusValue,
&Sequence_count
);
/* No errors? */
if ((StatusValue & 0x000Du) == 0x0u)
{
slave_transfer_complete = true;
}
else
{
/* Handle the error */
}
}
Figure 5-35: Example of Serial Peripheral Interface use
R20UT0084EE0112 Rev.1.12 Page 5-64
July. 16, 2014