Пример #1
0
int TIME_PRO::process()
{
	u8 item_count = 0;
	u8 bd_info_item_seek = 0;
	u16 seek = 0;
	u8 ret = 0;
	u8 *p_cmd = NULL;
	int flag;
	//这个bug隐藏的太深了
	no_interrupts();
	flag = (cmd_check_dog() == -1) && (cmd_num > 0);
	interrupts();
	if( flag == 1 )

	{
		
		memset(&date_time_string,0x00,sizeof(date_time_string));//清除结构体	
		ret = find_str(buf,(u8 *)"$dmyhms",seek);
		if(ret == 0)
		{
			p_cmd = buf + seek;
			do
			{
				p_cmd++;
				switch(*p_cmd)
				{
					case ',':
						item_count++;
						bd_info_item_seek = 0;
						break;
					default :
						switch(item_count)
						{
							case 0:break;
							case 1:date_time_string[bd_info_item_seek]		= *p_cmd;break;
							default:break;								
						}		
						bd_info_item_seek++;						
						break;				
				}				
			}while(*p_cmd!='*');
		}
		//date_time[12] = 0;
		char_count = 0;
		cmd_num = 0;
		
		uart1.printf((char *)buf);
		if(buf[1] != 'd')
			uart1.printf("flag = %d,cmd = %d",flag,cmd_num);
		uart1.printf("\r\n");
		memset(&buf,0x00,1024);//清除结构体	

		return 1;
	}
	return 0;
}
Пример #2
0
    uint64_t micros(void)
    {
        uint64_t micro;
        if((SysTick->CTRL & (1 << 16)) && (__get_PRIMASK())) //如果此时屏蔽了所有中断且发生了systick溢出,需要对millis_secend进行补偿
        {
            millis_seconds++;
        }
        no_interrupts();
//        micro = (millis_seconds * 1000 + (1000 - (SysTick->VAL)/(cpu.clock.core/1000000)));
        micro = (millis_seconds * 1000 + (1000 - (SysTick->VAL)/(micro_para)));
        interrupts();
        return  micro;
    }