en_uart_mmdorck_t enTb8;
DDL_ZERO_STRUCT(stcConfig);
DDL_ZERO_STRUCT(stcUartIrqCb);
DDL_ZERO_STRUCT(stcMulti);
DDL_ZERO_STRUCT(stcBaud);
DDL_ZERO_STRUCT(stcBtConfig);
DDL_ZERO_STRUCT(stcLpmCfg);
stcLpmCfg.enSLEEPDEEP = SlpDpDisable;
//时钟部分配置
stcCfg.enClkSrc = ClkXTH;
stcCfg.enHClkDiv = ClkDiv1;
stcCfg.enPClkDiv = ClkDiv1;
Clk_Init(&stcCfg);
Gpio_InitIO(T1_PORT,T1_PIN,GpioDirIn);
Gpio_InitIO(0,3,GpioDirOut);
Gpio_SetIO(0,3,1);
Gpio_InitIOExt(3,5,GpioDirOut,TRUE,FALSE,FALSE,FALSE);
Gpio_InitIOExt(3,6,GpioDirOut,TRUE,FALSE,FALSE,FALSE);
//通道端口配置
Gpio_SetFunc_UART1TX_P35();
Gpio_SetFunc_UART1RX_P36();
//外设时钟使能
Clk_SetPeripheralGate(ClkPeripheralBt,TRUE);//模式0/2可以不使能
Clk_SetPeripheralGate(ClkPeripheralUart1,TRUE);
stcUartIrqCb.pfnRxIrqCb = RxIntCallback;
stcUartIrqCb.pfnTxIrqCb = TxIntCallback;
stcUartIrqCb.pfnRxErrIrqCb = ErrIntCallback;
stcConfig.pstcIrqCb = &stcUartIrqCb;
stcConfig.bTouchNvic = TRUE;
stcConfig.enRunMode = UartMode1;//测试项,更改此处来转换4种模式测试
stcMulti.enMulti_mode = UartNormal;//测试项,更改此处来转换多主机模式,mode2/3才有多主机模式
enTb8 = DataOrEven;
Uart_SetMMDOrCk(UARTCH1,enTb8);
stcConfig.pstcMultiMode = &stcMulti;
|