Renesas Solution Starter Kit for RX23W
R20UT4449EG0100 Rev. 1.00
Page 44 of 64
Aug.30.19
5.2.2
CMT Code
The LCD code needs to insert delays to meet the timing requirements of the display module. This is achieved
using the dedicated timer which was configured using Smart Configurator in §4.5.2. Open the file
‘src\smc_gen\Config_CMT0\Config_CMT0.h’ and insert the following code in the user area for function at the
end of the file:
/* Start user code for function. Do not edit comment generated here */
void
R_CMT_MsDelay(
const
uint16_t millisec);
/* End user code. Do not edit comment generated here */
Open the file ‘Config_CMT0_user.c’ and insert the following code in the user area for global at the beginning
of the file:
/* Start user code for global. Do not edit comment generated here */
static
volatile
uint8_t gs_one_ms_delay_complete
=
FALSE;
/* End user code. Do not edit comment generated here */
Scroll down to the r_Config_CMT0_cmi0_interrupt function and insert the following line in the user code area:
static
void
r_Config_CMT0_cmi0_interrupt(
void
)
{
/* Start user code for r_Config_CMT0_cmi0_interrupt. Do not edit comment generated here */
gs_one_ms_delay_complete
=
TRUE;
/* End user code. Do not edit comment generated here */
}
Then 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_CMT_MsDelay
* Description : Uses CMT0 to wait for a specified number of milliseconds
* Arguments : uint16_t millisecs, number of milliseconds to wait
* Return Value : None
*******************************************************************************/
void
R_CMT_MsDelay (
const
uint16_t millisec)
{
uint16_t ms_count
=
0;
do
{
R_Config_CMT0_Start();
while
(FALSE
==
gs_one_ms_delay_complete)
{
/* Wait */
}
R_Config_CMT0_Stop();
gs_one_ms_delay_complete
=
FALSE;
ms_count
++
;
}
while
(ms_count
<
millisec);
}
/*******************************************************************************
End of function R_CMT_MsDelay
*******************************************************************************/
Содержание RSSK
Страница 64: ...R20UT4449EG0100 RX23W Group ...