void main(void){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0X01; P1OUT = 0x01; ConfigClock(); ConfigPort(); PWM_Details(Duty_Cycle,Periodo); ConfigTimer(); __bis_SR_register(LPM0_bits); // Enter LPM0 w/ interrupts }
int main()//OPTIMIZATION LEVEL = 0 { HAL_Init(); SystemClockConfig(); ConfigLED(); ConfigTimer(); rtksvrstart(&svr); ConfigUART(svr.format[0]); fobs[0]=fobs[1]=0; //svr.raw[1].time.time = 1429540822;//test SS2 data //svr.raw[1].time.time = 1429539852;//test SS2 data while (HAL_UART_Receive_DMA(&UartGPSHandle,svr.buff[0],MAX_RAW_LEN) != HAL_OK); while (HAL_UART_Receive_DMA(&UartRFHandle,svr.buff[1],MAX_RAW_LEN) != HAL_OK); HAL_Delay(3000); sendRequest(svr.format[0]); // test(); while(1) { #ifndef _TEST_RESULT if (flagTimeout) { int index,temp; flagTimeout=0; //SendIntStr(UartGPSHandle.Instance->SR); //SendIntStr(UartRFHandle.Instance->SR); for (index=0;index<2;index++) { if (index==0) temp = UartGPSHandle.hdmarx->Instance->NDTR & 0xffff; else temp = UartRFHandle.hdmarx->Instance->NDTR & 0xffff; if (temp + svr.buffPtr[index] <= MAX_RAW_LEN) svr.nb[index] = MAX_RAW_LEN - svr.buffPtr[index] - temp; else svr.nb[index] = 2*MAX_RAW_LEN - temp - svr.buffPtr[index]; fobs[index] = decode_raw(&svr,index); svr.buffPtr[index] = MAX_RAW_LEN - temp; } // temp = UartGPSHandle.hdmarx->Instance->NDTR & 0xffff; // if (temp + svr.buffPtr[0] <= MAX_RAW_LEN) // svr.nb[0] = MAX_RAW_LEN - svr.buffPtr[0] - temp; // else // svr.nb[0] = 2*MAX_RAW_LEN - temp - svr.buffPtr[0]; // if (svr.buffPtr[0] + svr.nb[0] <= MAX_RAW_LEN) // { // for (i = svr.buff[0] + svr.buffPtr[0] ; // i < svr.buff[0] + svr.buffPtr[0] + svr.nb[0]; i++) // { // HAL_UART_Transmit(&UartResultHandle,i,1,1); // } // } // else // { // for (i = svr.buff[0] + svr.buffPtr[0] ; // i < svr.buff[0] + MAX_RAW_LEN; i++) // { // HAL_UART_Transmit(&UartResultHandle,i,1,1); // } // for (i = svr.buff[0] ; // i < svr.buff[0] + svr.nb[0] + svr.buffPtr[0] - MAX_RAW_LEN ; i++) // { // HAL_UART_Transmit(&UartResultHandle,i,1,1); // } // } // svr.buffPtr[0] = MAX_RAW_LEN - temp; //rtk positioning********************************************************************** // if (0) if (fobs[1]) { fobs[1]=0; LED4_TOGGLE; } if (fobs[0]) { int i; fobs[0]=0; LED3_TOGGLE; #ifdef TIME_MEASURE start=HAL_GetTick(); #endif temp=svr.obs[0].n; for (i=0;i<temp;i++) { obsd[i]=svr.obs[0].data[i]; } for (i=0;(i<svr.obs[1].n)&&(i+temp<MAX_OBS);i++) { obsd[i+temp]=svr.obs[1].data[i]; } if (!rtkpos(&svr.rtk,obsd,i+temp,&svr.nav)) // if (1) { LED5_TOGGLE; #ifdef TIME_MEASURE t=HAL_GetTick()-start; svr.rtk.sol.processTime = t; #endif if (svr.rtk.sol.stat==SOLQ_FIX) LED6_TOGGLE; outsol(&svr.rtk.sol,svr.rtk.rb); SendStr(svr.rtk.sol.result); } else { HAL_UART_Transmit_DMA(&UartResultHandle,(unsigned char*)svr.rtk.errbuf,svr.rtk.errLen); } } } #else if (flagTimeout) { static int i; char* res = svr.rtk.sol.result; flagTimeout = 0; res+=sprintf(res, "%04.0f/%02.0f/%02.0f %02.0f:%02.0f:%06.3f %14.4f %14.4f %14.4f %3d %3d %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %6.2f %6.1f", 2015.0,10.0,12.0,3.0,45.0,18.0,//time yy/mm/dd hh:mm:ss.ssss 1.0,2.0,1.0, 1,1, 1.0,1.0,1.0, 1.0,1.0,1.0, 1.0,1.0); res+=sprintf(res," %4d",i++); res[0]='\n'; SendStr(svr.rtk.sol.result); } #endif } }