kumar singh
/
Dealer_20Mar
BLE Transmitter not working
Fork of Dealer_23Feb by
Diff: Lora.cpp
- Revision:
- 17:758fb8454ab0
- Parent:
- 16:7703b9d92326
- Child:
- 18:86f069689502
diff -r 7703b9d92326 -r 758fb8454ab0 Lora.cpp --- a/Lora.cpp Fri Feb 17 08:30:35 2017 +0000 +++ b/Lora.cpp Sat Feb 18 08:36:54 2017 +0000 @@ -5,7 +5,8 @@ //Configure Lora Packet RawSerial LORA_Module_UART(PA_0, PA_1);//USART4_TX->PA_0,USART4_RX->PA_1 - RawSerial DEBUGING_UART(PA_14, PA_15);//USART1_TX->PA_9,USART1_RX->PA_10 + RawSerial pc2(PA_14, PA_15);//USART1_TX->PA_9,USART1_RX->PA_10 + Serial pc_2(USBTX, USBRX); uint8 Packet_Type_To_Send = HEARTBEAT_TYPE_PACKET; //By Default Heart Beat PAckets should be sent uint8 OBD_Protocol_Version = 0x01; @@ -62,25 +63,25 @@ LORA_Module_UART.baud(115200); LORA_Module_UART.printf(Attention);//Send Attention command AT_Response_Receive_Status = FAILURE; - DEBUGING_UART.printf("Nwk set up started"); + pc2.printf("Nwk set up started"); while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("AT Response received"); + pc2.printf("AT Response received"); LORA_Module_UART.printf("%s%d\r",Set_Frequency_Sub_Band,FREQUENCY_SUB_BAND_CHANNEL7);//set frequency sub band to 7 AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("Frequency band response received"); + pc2.printf("Frequency band response received"); LORA_Module_UART.printf("%s%d,%s\r",Set_Network_Key,STRING_PARAMETER,Network_Key); //set network key AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("Network key Response received"); + pc2.printf("Network key Response received"); LORA_Module_UART.printf("%s%d,%s\r",Set_Network_ID,STRING_PARAMETER,Network_ID); //set network id AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("Network Id response received"); + pc2.printf("Network Id response received"); //LORA_Module_UART.printf("%s",Reset_Device); //reset device //wait_ms(3500); @@ -97,19 +98,19 @@ AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("Configuration saved"); + pc2.printf("Configuration saved"); LORA_Module_UART.printf("%s",Reset_Device); //reset device wait_ms(3500); LORA_Module_UART.printf(Attention); //Send Attention command AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("AT Response received"); + pc2.printf("AT Response received"); LORA_Module_UART.printf("%s",Join_Network); //join network with gateway AT_Response_Receive_Status = FAILURE; while(AT_Response_Receive_Status) Get_Lora_Response(); - DEBUGING_UART.printf("Join Response received"); + pc2.printf("Join Response received"); } void Initialize_lora_Packets() @@ -431,7 +432,7 @@ { Temp_Pos1+=2; Response_Start_Pos[Lora_Response_Found++] = Temp_Pos1; - //DEBUGING_UART.printf("%c",Temp_Pos1); + //pc2.printf("%c",Temp_Pos1); if(Lora_Response_Found >= 4) break; } @@ -445,7 +446,7 @@ for(Temp_Pos1=0; LORA_UART_RX_Crnt_Pos < Response_Start_Pos[1]; Temp_Pos1++) { Lora_Command_Rcvd[Temp_Pos1] = LORA_UART_RX_Buffer[LORA_UART_RX_Crnt_Pos++]; - DEBUGING_UART.putc(Lora_Command_Rcvd[Temp_Pos1]); + pc2.putc(Lora_Command_Rcvd[Temp_Pos1]); } Lora_RxBuffer_End_Pos = 0; AT_Response_Receive_Status = SUCCESS; @@ -457,7 +458,7 @@ for(Temp_Pos1=0; LORA_UART_RX_Crnt_Pos < Response_Start_Pos[2]; Temp_Pos1++) { Lora_Command_Rcvd[Temp_Pos1] = LORA_UART_RX_Buffer[LORA_UART_RX_Crnt_Pos++]; - DEBUGING_UART.putc(Lora_Command_Rcvd[Temp_Pos1]); + pc2.putc(Lora_Command_Rcvd[Temp_Pos1]); } Lora_RxBuffer_End_Pos = 0; AT_Response_Receive_Status = SUCCESS; @@ -473,7 +474,7 @@ for(i=0;i<Length;i++) { LORA_Module_UART.putc(Command_To_Send[i]);//write to serial port for sending through lora module - DEBUGING_UART.putc(Command_To_Send[i]); + pc2.putc(Command_To_Send[i]); } LORA_Module_UART.printf("\r"); }