//串口配置1=RXD3_/TXD3_ on PB[20]/PB[21]
GPIOPinRemap(ENABLE, RB_PIN_UART3); // 重新映射串口3
GPIOB_SetBits(bSCL_); // PB21输出高
GPIOB_ModeCfg(bSDA_, GPIO_ModeIN_PU); // PB20上拉输入
GPIOB_ModeCfg(bSCL_, GPIO_ModeOut_PP_5mA); // 推挽输出1
UART3_DefInit( ); // 波特率等设置
UART3_INTCfg(ENABLE, RB_IER_RECV_RDY|RB_IER_THR_EMPTY); // 开启中断,
PFIC_EnableIRQ(UART3_IRQn); // 使能串口中断
__INTERRUPT
__HIGH_CODE
void UART3_IRQHandler(void)
{
switch(UART3_GetITFlag())
{
case UART_II_RECV_RDY: //接收到数据
Finger_Rx_Buf[Finger_Rx_Buf_Write_Count]=R8_UART3_RBR;
if((Finger_Tx_Count==0)&&(0x55==Finger_Rx_Buf[Finger_Rx_Buf_Write_Count]))Finger_Timer=100; //1S
Finger_Write_Rx_Buf();
break;
case UART_II_THR_EMPTY: //发送缓存区空,可以继续发送数据
if(Finger_Tx_Buf_Write_Count!=Finger_Tx_Buf_Read_Count)
{
R8_UART3_THR=Finger_Tx_Buf[Finger_Tx_Buf_Read_Count];
PRINT("%x", Finger_Tx_Buf[Finger_Tx_Buf_Read_Count]);
Finger_Read_Tx_Buf();
}
else
{
Finger_Tx_Busy_0; //3位=0发送空闲
Finger_Timer=0;
}
break;
case UART_II_MODEM_CHG: //硬件流控制
break;
default:
break;
}
}