static void HMI_thread_entry(void *parameter) { u8 counter_printer = 0; TIRED_DoorValue_Init(); Init_4442(); IC_info_default(); //--------自检过后操作DF 读取----- DF_init(); SysConfiguration(); // system config // total_ergotic(); DF_initOver = 1; Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate pMenuItem = &Menu_0_0_self_Checking; pMenuItem->show(); pMenuItem->timetick(10); pMenuItem->keypress(10); while (1) { // 6. ACC 状态检测 ACC_status_Check(); //-------------------------------------------- rt_thread_delay(25); //25 } }
static rt_err_t Device_GSM_init( rt_device_t dev ) { // 一. --------- GSM Hardware initial --------------------- rt_hw_gsm_init(); // 三. GSM 状态寄存器初始化 Gsm_RegisterInit(); // init register states ,then it will power on the module return RT_EOK; }
static void HMI_thread_entry(void *parameter) { u8 counter_printer = 0; TIRED_DoorValue_Init(); Init_4442(); IC_info_default(); while(1) { pMenuItem = &Menu_0_0_self_Checking; pMenuItem->show(); pMenuItem->timetick(10); pMenuItem->keypress(10); if(self_checking_result == 10) //自检正常 { //rt_kprintf("\r\n------------------自检正常,退出-------"); break; } if(self_checking_result == 30) //自检异常2,按 确认 后为3 { //rt_kprintf("\r\n------------------自检异常,退出-------"); break; } rt_thread_delay(25); } //--------自检过后操作DF 读取----- DF_init(); SysConfiguration(); // system config total_ergotic(); DF_initOver = 1; Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate //----------------------------------------------------------------- if(Login_Menu_Flag == 0) { JT808Conf_struct.Regsiter_Status = 0; //需要重新注册 pMenuItem = &Menu_0_0_password; pMenuItem->show(); } else { pMenuItem = &Menu_1_Idle; pMenuItem->show(); } while (1) { // 6. ACC 状态检测 ACC_status_Check(); #if 1 pMenuItem->timetick( 10 ); pMenuItem->keypress( 10 ); //------- if((print_rec_flag == 1) && (TTS_Var.Playing == 0)) // 为了避开大电流 播报时候不打印 { counter_printer++; if(counter_printer >= 5) //加电后1s开始打印,打印间隔必须>300ms { counter_printer = 0; #ifdef SPD_WARN_SAVE if(ExpSpdRec_write > 0) { ReadEXspeed(1); WatchDog_Feed(); Dis_chaosu(data_tirexps); } #endif print_rec_flag = 2; DaYin = 1; //开始打印 WatchDog_Feed(); } } else if(print_rec_flag == 2) { counter_printer++; if(counter_printer >= 2) //打印间隔必须>300ms 7 { counter_printer = 0; Dayin_Fun(1); } } if(ASK_Centre.ASK_disp_Enable == 1) { ASK_Centre.ASK_disp_Enable = 0; pMenuItem = &Menu_3_1_CenterQuesSend; pMenuItem->show(); } else if(TextInfo.TEXT_SD_FLAG == 1) { TextInfo.TEXT_SD_FLAG = 0; pMenuItem = &Menu_7_CentreTextDisplay; pMenuItem->show(); } #endif //-------------------------------------------- rt_thread_delay(25); //25 } }
static void gsm_thread_entry(void* parameter) { u8 atd_str[25]; rt_size_t res=RT_ERROR; // finsh_init(&shell->parser); // // step 1: Init Dataflash DF_init(); APP_IOpinInit(); rt_kprintf("\r\n ---> gsm thread start !\r\n"); HardWareVerion=HardWareGet(); // step 2: process config data SysConfiguration(); // system config total_ergotic(); Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate #ifdef HMI HMI_app_init(); #endif gps_init(); //-------------------------------------- while (1) { if(GSM_Working_State()) { // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); } rt_thread_delay(20); if(GSM_Working_State()==2) { DataLink_Process(); //------------------------------------------------ if (Send_DataFlag== 1) { res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) rt_device_write(&Device_GSM, LinkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); Send_DataFlag=0; } //监听 if(CallState==CallState_rdytoDialLis) { CallState=CallState_Dialing; memset(atd_str,0,sizeof(atd_str)); memcpy(atd_str,"ATD",3); memcpy(atd_str+3,JT808Conf_struct.LISTEN_Num,strlen((const char*)JT808Conf_struct.LISTEN_Num)); memcpy(atd_str+3+strlen((const char*)JT808Conf_struct.LISTEN_Num),";\r\n",3); rt_hw_gsm_output(atd_str); rt_kprintf("\r\n拨打%s\r\n",atd_str); } //--------- Step timer // Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value if(GSM_CSQ_Query()==false) { if(Calling_ATA_flag==1) { rt_thread_delay(3); rt_hw_gsm_output("ATA\r\n"); //检查信号强度 if(DispContent) rt_kprintf(" 接听 ATA\r\n"); Calling_ATA_flag=0; } } // SMS Service SMS_Process(); rt_thread_delay(10); } } }
static void gsm_thread_entry(void* parameter) { u8 atd_str[25]; rt_size_t res=RT_ERROR; // finsh_init(&shell->parser); // // step 1: Init Dataflash DF_init(); APP_IOpinInit(); rt_kprintf("\r\n ---> gsm thread start !\r\n"); HardWareVerion=HardWareGet(); // step 2: process config data SysConfiguration(); // system config total_ergotic(); Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate #ifdef HMI HMI_app_init(); #endif gps_init(); Lcd_init(); //-------------------------------------- while (1) { if((GSM_PWR.result==result_success)&&(dwlcd_contr<=5)) { if(Login_Menu_Flag!=1) { Lcd_write(Big_lcd.status,LCD_PAGE,0x15); dwlcd_contr++; } else { Lcd_write(Big_lcd.status,LCD_PAGE,0x01); dwlcd_contr++; } ; } // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); rt_thread_delay(20); DataLink_Process(); //++++++++++++++++++++++++DWLCD+++++++++++++++++++++ //_485_RxHandler_01(); if(Big_lcd.RX_enable==LCD_BUSY) { Lcd_Data_Process(); Big_lcd.RX_enable=LCD_IDLE; } /* Lcd_write(Big_lcd.status,LCD_SETSPD,0); Lcd_write(Big_lcd.status,LCD_GPSNUM,Satelite_num); Lcd_write(Big_lcd.status,LCD_GSMNUM,ModuleSQ); */ if(ModuleStatus&Status_GPS ) { if(Big_lcd.RX_enable==LCD_IDLE) { if(lcd_contrl==0) { Lcd_write(Big_lcd.status,LCD_SETTIME,0); delay_ms(5); lcd_contrl++; } } } //++++++++++++++++++++++++DWLCD+++++++++++++++++++++ if(BD1_struct.Rx_enable==RT_EOK) { BD1_RxProcess(); } //------------------------------------------------ if (Send_DataFlag== 1) { res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) rt_device_write(&Device_GSM, LinkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); Send_DataFlag=0; } //监听 if(CallState==CallState_rdytoDialLis) { CallState=CallState_Dialing; memset(atd_str,0,sizeof(atd_str)); memcpy(atd_str,"ATD",3); memcpy(atd_str+3,JT808Conf_struct.LISTEN_Num,strlen((const char*)JT808Conf_struct.LISTEN_Num)); memcpy(atd_str+3+strlen((const char*)JT808Conf_struct.LISTEN_Num),";\r\n",3); rt_hw_gsm_output(atd_str); rt_kprintf("\r\n拨打%s\r\n",atd_str); } //--------- Step timer // Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value if(GSM_CSQ_Query()==false) { if(Calling_ATA_flag==1) { delay_ms(10); rt_hw_gsm_output("ATA\r\n"); //检查信号强度 if(DispContent) rt_kprintf(" 接听 ATA\r\n"); Calling_ATA_flag=0; } } // SMS Service SMS_Process(); } }