#include "system_general_para.h"
|
#include "main.h"
|
#include "extern_rtc.h"
|
|
//uint8_t read_data_buf_A_l[200] ={0};
|
//uint8_t read_data_buf_B_l[200] ={0};
|
//uint8_t read_data_buf_C_l[200] ={0};
|
|
__IO FlagStatus sys_run_period = RESET; // ϵͳ¼¤»îÖÜÆÚ
|
|
SYS_DELAY_SEC_PARA_T sys_delay_sec_para_g = { .gprs_timeout_para.delay_flag = RESET, \
|
.gprs_timeout_para.delay_time = 0, \
|
.sys_active_time.delay_flag = RESET, \
|
.sys_active_time.delay_time = SYS_WAKE_UP_TIME, \
|
.sys_restart_delay_time.delay_flag = RESET, \
|
.sys_restart_delay_time.delay_time = 180, \
|
|
};
|
|
FUN_START_CTRL_PARA_T sys_fun_run_ctrl_g;
|
|
|
/*******************³£ÓõĴúÂ빤¾ß********************************/
|
/******************************************
|
* func: ucharcmp
|
* desc: Á½×éÊý¾Ý±È½Ï£¬²»Ïàͬ·µ»ØFAIL,Ïàͬ·µ»ØPASS
|
* input: none
|
* output: none
|
* return: none
|
*****************************************/
|
ErrorStatus ucharcmp(uint8_t *dataA,uint8_t *dataB,uint16_t data_length)
|
{
|
uint16_t index_i=0;
|
ErrorStatus return_flag=FAIL;
|
for(index_i=0;index_i<data_length;index_i++)
|
{
|
if((*(dataA + index_i))!=(*(dataB + index_i)) )
|
{
|
return_flag = FAIL;
|
break;
|
}else
|
{
|
|
}
|
|
}
|
|
if(index_i ==data_length)
|
{
|
return_flag = PASS;
|
}
|
|
return return_flag;
|
}
|
|
|
|
/******************************************
|
* func: arrayA_2_arrayB
|
* desc: array A TO array B
|
* input: none
|
* output: none
|
* return: none
|
*****************************************/
|
void arrayA_2_arrayB(uint8_t * aA , uint8_t * aB, uint16_t len, BIG_OR_LITTLE_ENDIAN mode)
|
{
|
uint16_t index;
|
uint8_t *ptra,*ptrb;
|
|
if(mode==LITTLE_ENDIAN)
|
{
|
ptra = aA;
|
ptrb = aB;
|
for(index = 0; index < len; index ++)
|
{
|
*ptrb = *ptra;
|
ptrb ++;
|
ptra ++;
|
}
|
}else if(mode==BIG_ENDIAN)
|
{
|
ptra = aA + len - 1;
|
ptrb = aB;
|
for(index = 0; index < len; index ++)
|
{
|
*ptrb = *ptra;
|
ptrb ++;
|
ptra --;
|
}
|
|
}
|
}
|
|
|
|
|
/******************************************
|
* func: IntervalTriggerHandle
|
* desc: ¼ä¸ô´¥·¢£¬Ö»¿¼ÂÇ1ÌìÄڵ쬼ä¸ôʱ³¤³¬¹ý1ÌìµÄ²»¿¼ÂÇ£¬±ÈÈç1ÌìÄڵļä¸ô60·ÖÖÓ´¥·¢Ò»´Î
|
* input: IntervalTime¼ä¸ôʱ¼ä£¬µ¥Î»·Ö ; IntervalFirstTimeBCDÊ×´Îʱ¼ä,ʱ£¬·Ö£¬Ê±ÔÚǰ
|
* output: FlagStatus SET±íʾÉúЧ
|
* return: none
|
*****************************************/
|
FlagStatus IntervalTriggerHandle(sClockBCD sys_clockBCD_in,uint16_t IntervalTime,uint8_t *IntervalFirstTimeBCD)
|
{
|
//¼ä¸ôÉϱ¨ÔÝʱ²»¿¼ÂǼä¸ô³¬¹ý1440·ÖÖÓ£¬Ò²¾ÍÊdz¬¹ý1Ìì¡£
|
uint16_t FirstTime; //Ê×´ÎÉϱ¨Ê±¼ä£¬ÕÛËã³É·ÖÖÓ
|
uint16_t NextTime; //Ï´ÎÉϱ¨Ê±¼ä£¬·ÖÖÓ
|
uint16_t CurrentTime;//µ±Ç°Ê±¼ä£¬ÕÛËã³É·ÖÖÓ
|
uint16_t Count_i=0;
|
uint16_t ComparisonsNumber;
|
|
|
if(IntervalTime==0)
|
{
|
return RESET;
|
}
|
|
FirstTime = (uint16_t)BCD_2_DECIMAL(IntervalFirstTimeBCD[0]) * 60 + BCD_2_DECIMAL(IntervalFirstTimeBCD[1]);
|
|
CurrentTime = (uint16_t)BCD_2_DECIMAL(sys_clockBCD_in.hour) *60 + BCD_2_DECIMAL(sys_clockBCD_in.min);
|
NextTime = FirstTime;
|
|
ComparisonsNumber = (IntervalTime !=0)? 1440/IntervalTime +1 : 1;
|
|
if(sys_clockBCD_in.sec == 0) //ΪÁ˼õÉÙ×ÊÔ´ÀË·Ñ£¬Ö»ÓÐÔÚÃëÖÓ=0ʱÅжÏ
|
{
|
for(Count_i =0;Count_i<ComparisonsNumber;Count_i++)
|
{
|
if(NextTime == CurrentTime )
|
{
|
return SET;
|
}
|
else
|
{
|
NextTime = NextTime + IntervalTime; //Ï´ÎÉϱ¨Ê±¼äµã
|
if(NextTime>=1440)
|
{
|
NextTime -=1440;
|
}
|
}
|
}
|
}
|
|
return RESET;
|
}
|