void UART_Cfg(void)
{
UART_InitTypeDef UART_InitStruct;
UART_InitStruct.UART_BaudRate = 115200;
UART_InitStruct.UART_WordLength = UART_WordLength_8b ;
UART_InitStruct.UART_StopBits = UART_StopBits_1;
UART_InitStruct.UART_Parity = UART_Parity_No;
UART_InitStruct.UART_Mode = UART_Mode_Rx|UART_Mode_Tx;
UART_InitStruct.UART_PIN = RX_PTB0_TX_PTB1 ;
UART_Init(&UART_InitStruct);
UART_ITConfig(UART_IT_RXNE, ENABLE);
NVIC_Init(UART0_IRQn,1);
}
void PIT_Cfg(void)
{
PIT_InitTypeDef PIT_InitStruct;
PIT_InitStruct.CHANNELx = PIT_CHANNEL0;
PIT_InitStruct.PIT_Mode = PIT_Mode_ms;
PIT_InitStruct.Timer = 1000;
PIT_Init(&PIT_InitStruct);
PIT_ITConfig(PIT_CHANNEL0,ENABLE);
PIT_ClearFlag(PIT_CHANNEL0);
PIT_Cmd(PIT_CHANNEL0,ENABLE);
NVIC_Init(PIT_CH0_IRQn,1);
}
|