Spi Code - Renesas RX Series User Manual

Rx23w group. solution starter kit for rx23w smart configurator
Hide thumbs Also See for RX Series:
Table of Contents

Advertisement

Renesas Solution Starter Kit for RX23W
5.2.1

SPI Code

The Okaya LCD display is driven by the SPI Master that was configured using Smart Configurator in §4.5.6. In
the e2 studio Project Tree, expand the 'src\smc_gen\Config_SCI12' folder and open the file 'Config_SCI12.h'
by double-clicking on it. Insert the following code in the user code area at the end of the file:
/* Start user code for function. Do not edit comment generated here */
/* Exported functions used to transmit a number of bytes and wait for completion */
MD_STATUS R_SCI12_SPIMasterTransmit(uint8_t * const tx_buf, const uint16_t tx_num);
/* End user code. Do not edit comment generated here */
Now, open the Config_SCI12_user.c file and insert the following code in the user area for global:
/* Start user code for global. Do not edit comment generated here */
/* Flag used locally to detect transmission complete */
static volatile uint8_t gs_sci12_txdone;
/* End user code. Do not edit comment generated here */
Insert the following code in the transmit end call-back function for SCI12:
static
void r_Config_SCI12_callback_transmitend(void)
{
/* Start user code for r_Config_SCI12_callback_transmitend. Do not edit comment generated here */
gs_sci12_txdone = TRUE;
/* End user code. Do not edit comment generated here */
}
Now insert the following function in the user code area at the end of the file:
/* Start user code for adding. Do not edit comment generated here */
/*******************************************************************************
* Function Name: R_SCI12_SPIMasterTransmit
* Description
: This function sends SPI6 data to slave device.
* Arguments
: tx_buf -
*
transfer buffer pointer
*
tx_num -
*
buffer size
* Return Value : status -
*
MD_OK or MD_ARGERROR
*******************************************************************************/
MD_STATUS R_SCI12_SPIMasterTransmit (uint8_t
{
MD_STATUS status
=
/* Clear the flag before initiating a new transmission */
gs_sci12_txdone
=
/* Send the data using the API */
status
=
R_Config_SCI12_SPI_Master_Send(tx_buf, tx_num);
/* Wait for the transmit end flag */
while
(FALSE
==
gs_sci12_txdone)
{
/* Wait */
}
return
(status);
}
/*******************************************************************************
* End of function R_SCI12_SPIMasterTransmit
*******************************************************************************/
This function uses the transmit end callback function to perform flow control on the SPI transmission to the
LCD, and is used as the main API call in the LCD code module.
R20UT4449EG0100 Rev. 1.00
Aug.30.19
const
MD_OK;
FALSE;
*
const
tx_buf,
uint16_t tx_num)
5. User Code Integration
Page 43 of 64

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rx200 seriesRssk

Table of Contents