/*******************************************************************************
* Function Name : main
* Description : Main program
* Input : None
* Output : None
* Return : None
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
debug();
#endif
/* System Clocks Configuration */
RCC_Configuration();
/* NVIC configuration */
NVIC_Configuration();
/* Configure the GPIO ports */
GPIO_Configuration();
USART2_Configuration(); // uart初始化
//USART1_Configuration();
//DMA_Configuration();
TIM_Configuration();//初始化定时器
/* USART2_Configuration(); // uart初始化
UART1Write((u8*)"\r\n串口1初始化成功.....\r\n",sizeof("串口1初始化成功.....")) ;
UART1Write((u8*)"\r\n Welcome to www.PowerAVR.com \r\n",sizeof("Welcome to www.PowerAVR.com")); */
/* Output a message on Hyperterminal using printf function */
//printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
LCD_Init();
POINT_COLOR=BLUE;//设置字体为蓝色
LCD_ShowString(30,30,"system status:");
LCD_ShowString(30,50,"please press WAKEUP");
LCD_ShowString(30,100,"GPS data:");
LCD_ShowString(30,115,(u8*)GPSdata);
LCD_ShowString(30,200,"location and time:");
TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
while(!GPSstart);
LCD_Fill(30, 50, 200, 70,WHITE);
while(1)
{
USART1_Configuration();
DMA_Configuration();
LCD_ShowString(30,50,"please wait...");
TIM_Cmd(TIM2, ENABLE);
while(!timeup);
timeup=0;
GPSledon;
TIM_Cmd(TIM2, DISABLE);
LCD_ShowString(30,50,"getting GPS data...");
USART_DMACmd(USART1, USART_DMAReq_Rx, ENABLE);
DMA_Cmd(DMA1_Channel5, ENABLE);
// while(!DMAflag);
while (DMA_GetFlagStatus(DMA1_FLAG_TC5) == RESET);//while(!(DMA1->ISR&(1<<17)));//等待通道5传输完成
USART_ClearFlag(USART1,USART_FLAG_TC);
LCD_Fill(30, 50, 200, 70,WHITE);
LCD_ShowString(30,115,(u8*)GPSdata);
GPSledoff;
if(GPSdataformat())
{
LCD_ShowString(30,220,(u8*)location);
}
}
}