📄 rtc_test_misc.c
字号:
LCD_WriteString( 2, 0, "SetAlarm PASSED", NORMAL);
}
else
if(ResultFunction==RVF_INTERNAL_ERR)
{
LCD_WriteString( 2, 0, "SetAlarm FAILED INT", NORMAL);
rtc_test_verdict=TEST_FAILED;
return;
}
else
if(ResultFunction==RVF_INVALID_PARAMETER)
{
LCD_WriteString( 2, 0, "SetAlarm FAILED PAR", NORMAL);
rtc_test_verdict=TEST_FAILED;
return;
}
else
LCD_WriteString( 2, 0, "SetAlarm PASSED", NORMAL);
}
}
else
{
rvf_delay(RVF_SECS_TO_TICKS(1)); /* Tempo */
sprintf((char*)s_resultInfo.test_ref,"%s",RTC_006_REF);
sprintf((char*)s_resultInfo.test_name,"%s",RTC_006_NAME);
sprintf((char*)s_resultInfo.test_comment,"%s",RTC_006_COMMENT);
gen_display_header (&s_resultInfo);
uc_id_obtained[0]=ResultFunction;
uc_id_obtained[1]=uc_Alarm;
sprintf((char*)s_resultInfo.var_name,"%s",RTC_006_RESULT_FONCTION);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[0], sizeof(uc_id_waited[0]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_006_ALARM);
b_resultMsg = gen_display_table_result(&uc_id_waited[1], &uc_id_obtained[1], sizeof(uc_id_waited[1]),&s_resultInfo);
gen_display_report (b_resultMsg);
LCD_WriteString( 2, 0, " ", NORMAL);
uc_id_waited[0]=RVF_INVALID_PARAMETER;
date_time.second = -1;
uc_id_obtained[0] = RTC_SetAlarm(date_time,return_path);
date_time.second = 60;
uc_id_obtained[1] = RTC_SetAlarm(date_time,return_path);
date_time.minute = -1;
uc_id_obtained[2] = RTC_SetAlarm(date_time,return_path);
date_time.minute = 60;
uc_id_obtained[3] = RTC_SetAlarm(date_time,return_path);
date_time.hour = -1;
uc_id_obtained[4] = RTC_SetAlarm(date_time,return_path);
date_time.hour = 25;
uc_id_obtained[5] = RTC_SetAlarm(date_time,return_path);
date_time.day = 0;
uc_id_obtained[6] = RTC_SetAlarm(date_time,return_path);
date_time.day = 32;
uc_id_obtained[7] = RTC_SetAlarm(date_time,return_path);
date_time.month = 0;
uc_id_obtained[8] = RTC_SetAlarm(date_time,return_path);
date_time.month = 13;
uc_id_obtained[9] = RTC_SetAlarm(date_time,return_path);
date_time.year = -1;
uc_id_obtained[10] = RTC_SetAlarm(date_time,return_path);
date_time.year = 100;
uc_id_obtained[11] = RTC_SetAlarm(date_time,return_path);
date_time.wday = -1;
uc_id_obtained[12] = RTC_SetAlarm(date_time,return_path);
date_time.wday = 7;
uc_id_obtained[13] = RTC_SetAlarm(date_time,return_path);
sprintf((char*)s_resultInfo.test_ref,"%s",RTC_007_REF);
sprintf((char*)s_resultInfo.test_name,"%s",RTC_007_NAME);
sprintf((char*)s_resultInfo.test_comment,"%s",RTC_007_COMMENT);
gen_display_header (&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_0);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[0], sizeof(uc_id_waited[0]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_1);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[1], sizeof(uc_id_waited[1]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_2);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[2], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_3);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[3], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_4);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[4], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_5);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[5], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_6);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[6], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_7);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[7], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_8);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[8], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_9);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[9], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_10);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[10], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_11);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[11], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_12);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[12], sizeof(uc_id_waited[2]),&s_resultInfo);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_007_RESULT_FONCTION_13);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[13], sizeof(uc_id_waited[2]),&s_resultInfo);
gen_display_report (b_resultMsg);
}
break;
case 6: // Test RTC_GetAlarm
uc_id_waited[0]=RVF_OK;
if (ResultFunction=RTC_GetAlarm(&date_time) == RVF_INTERNAL_ERR)
{
LCD_WriteString( 2, 0, "GetAlarm FAILED INT", NORMAL);
rtc_test_verdict=TEST_FAILED;
return;
}
else
{
ResultFunction=RVF_OK;
if (date_time.mode_12_hour == FALSE)
{
sprintf((char*)time, "%02d:%02d:%02d ",
date_time.hour, date_time.minute, date_time.second);
}
else
{
if (date_time.PM_flag == TRUE)
sprintf((char*)time, "%02d:%02d:%02d PM ",
date_time.hour, date_time.minute, date_time.second);
else
sprintf((char*)time, "%02d:%02d:%02d AM ",
date_time.hour, date_time.minute, date_time.second);
}
sprintf((char*)date, "%02d/%02d/%02d",
date_time.month, date_time.day, date_time.year);
LCD_WriteString( 2, 0, "GetAlarm PASSED", NORMAL);
LCD_WriteString( 3, 0, (char*) date, NORMAL);
LCD_WriteString( 4, 0, (char*) time, NORMAL);
}
break;
case 7:
if (!test_to_execute)
{
sprintf((char*)s_resultInfo.test_ref,"%s",RTC_005_REF);
sprintf((char*)s_resultInfo.test_name,"%s",RTC_005_NAME);
sprintf((char*)s_resultInfo.test_comment,"%s",RTC_005_COMMENT);
sprintf((char*)s_resultInfo.var_name,"%s",RTC_005_RESULT_FONCTION);
gen_display_header (&s_resultInfo);
uc_id_obtained[0]=ResultFunction;
sprintf((char*)s_resultInfo.var_name,"%s",RTC_005_RESULT_FONCTION);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[0], sizeof(uc_id_waited[0]),&s_resultInfo);
gen_display_report (b_resultMsg);
uc_id_waited[0]=RVF_OK;
LCD_WriteString( 3, 0, " ", NORMAL);
LCD_WriteString( 4, 0, " ", NORMAL);
LCD_WriteString( 2, 0, "Set alarm 5 s ", NORMAL);
if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_GetDateTime(&date_time);
}
date_time.second += 5;
if (date_time.second > 59)
{
date_time.second -= 60;
date_time.minute++;
}
if (RTC_SetAlarm(date_time, return_path) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_SetAlarm(date_time, return_path);
}
}
else
{
rvf_delay(RVF_MS_TO_TICKS(1));
ResultFunction=RTC_UnsetAlarm();
if (ResultFunction == RVF_NOT_READY)
{
LCD_WriteString( 2, 0, "UnsetAlarm WAIT", NORMAL);
rvf_delay(RVF_MS_TO_TICKS(1));
ResultFunction=RTC_UnsetAlarm();
if(ResultFunction==RVF_OK)
LCD_WriteString( 2, 0, "UnsetAlarm PASSED", NORMAL);
}
else
if(ResultFunction==RVF_INTERNAL_ERR)
{
LCD_WriteString( 2, 0, "UnsetAlarm FAILED INT", NORMAL);
rtc_test_verdict=TEST_FAILED;
return;
}
else
LCD_WriteString( 2, 0, "UnsetAlarm PASSED", NORMAL);
}
break;
case 8:
if (!test_to_execute)
{
sprintf((char*)s_resultInfo.test_ref,"%s",RTC_008_REF);
sprintf((char*)s_resultInfo.test_name,"%s",RTC_008_NAME);
sprintf((char*)s_resultInfo.test_comment,"%s",RTC_008_COMMENT);
gen_display_header (&s_resultInfo);
uc_id_obtained[0]=ResultFunction;
sprintf((char*)s_resultInfo.var_name,"%s",RTC_008_RESULT_FONCTION);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[0], sizeof(uc_id_waited[0]),&s_resultInfo);
gen_display_report (b_resultMsg);
LCD_WriteString( 2, 0, " ", NORMAL);
/* Test a RTC reset */
if (RTC_RtcReset())
LCD_WriteString( 2, 0,"Reset", NORMAL);
}
break;
case 9:
if (!test_to_execute)
{
LCD_WriteString( 2, 0, "To add One Hour", NORMAL);
RTC_GetDateTime(&date_time);
uc_id_waited[0]=date_time.hour + RTC_NB_ADD_HOUR_TEST;
if (uc_id_waited[0] > 24)
uc_id_waited[0]=1;
}
else
{
if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_GetDateTime(&date_time);
}
date_time.hour++;
if ( (date_time.mode_12_hour == TRUE) && (date_time.hour > 12) )
{
date_time.hour-=12;
date_time.PM_flag = date_time.PM_flag ? FALSE : TRUE;
}
else if (date_time.hour > 23 )
date_time.hour -= 24;
if (RTC_SetDateTime(date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_SetDateTime(date_time);
}
sprintf((char*)ui_LcdMessage, " Add hour N %d",ui_CounterAdd);
LCD_WriteString( 3, 0, (char*)ui_LcdMessage, NORMAL);
}
break;
case 10:
if(ui_CounterAdd++ <RTC_NB_ADD_HOUR_TEST)
num_test=9;
break;
case 11:
if (!test_to_execute)
{
sprintf((char*)s_resultInfo.test_ref,"%s",RTC_003_REF);
sprintf((char*)s_resultInfo.test_name,"%s",RTC_003_NAME);
sprintf((char*)s_resultInfo.test_comment,"%s",RTC_003_COMMENT);
gen_display_header (&s_resultInfo);
RTC_GetDateTime(&date_time);
uc_id_obtained[0]=date_time.hour;
sprintf((char*)s_resultInfo.var_name,"%s",RTC_003_RESULT_ADD_H);
b_resultMsg = gen_display_table_result(&uc_id_waited[0], &uc_id_obtained[0], sizeof(uc_id_waited[0]),&s_resultInfo);
gen_display_report (b_resultMsg);
LCD_WriteString( 3, 0," ", NORMAL);
LCD_WriteString( 2, 0, "To add One second", NORMAL);
}
else
{
if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_GetDateTime(&date_time);
}
uc_id_waited[0]=date_time.second +1;
if (uc_id_waited[0] > 59)
uc_id_waited[0]-=60;
date_time.second++;
if (date_time.second > 59 )
date_time.second -= 60;
if (RTC_SetDateTime(date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_SetDateTime(date_time);
RTC_GetDateTime(&date_time);
uc_id_obtained[0]=date_time.second;
}
}
break;
case 12:
if (!test_to_execute)
{
LCD_WriteString( 2, 0, "To add One Minute", NORMAL);
RTC_GetDateTime(&date_time);
uc_id_waited[0]=date_time.minute+1;
if (uc_id_waited[0] > 59)
uc_id_waited[0]-=60;
}
else
{
if (RTC_GetDateTime(&date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_GetDateTime(&date_time);
}
date_time.minute++;
if (date_time.minute > 59 )
date_time.minute -= 60;
if (RTC_SetDateTime(date_time) == RVF_NOT_READY)
{
rvf_delay(RVF_MS_TO_TICKS(1));
RTC_SetDateTime(date_time);
}
}
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -