void BD_MODULE_Write(u8 in) { RMC_Counter=0; GNTXT_Counter=0; if(in) GPS_MODULE_TYPE=1; else GPS_MODULE_TYPE=in; DF_WriteFlashSector(DF_GPS_MODULE_offset,0,&GPS_MODULE_TYPE,1); if(Module_3017A==GPS_MODULE_TYPE) rt_kprintf("\r\n 设置北斗定位模块: 3017A"); else if(Module_3020C==GPS_MODULE_TYPE) rt_kprintf("\r\n 设置北斗定位模块: 3020C"); // else // rt_kprintf("\r\n 设置北斗定位模块: 尚未自动检测"); gps_keyIO_init(); // 去掉3020C 硬件开短路检测的管脚初始化 APP_IOpinInit(); // 配置 3017A的蜂鸣器 printer_port_init(); // 打印控制还原3017A 模块控制 }
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(); } }