技术咨询 HC32F005 2组USART设定相同 TIM0可否共用
void _UartBaudCfg(void)
{
uint16_t timer=0;
stc_uart_baud_cfg_t stcBaud;
stc_bt_cfg_t stcBtCfg;
DDL_ZERO_STRUCT(stcBaud);
DDL_ZERO_STRUCT(stcBtCfg);
//俋扢奀笘妏夔
Sysctrl_SetPeripheralGate(SysctrlPeripheralBt,TRUE);//耀宒0/2褫眕祥妏夔
Sysctrl_SetPeripheralGate(SysctrlPeripheralUart0,TRUE);
Sysctrl_SetPeripheralGate(SysctrlPeripheralUart1,TRUE);
stcBaud.bDbaud = 0u;//邧捷疏杻薹髡夔
stcBaud.u32Baud = 115200u;//載陔疏杻薹弇离
stcBaud.enMode = UartMode3; //數呾疏杻薹剒猁耀宒統杅
stcBaud.u32Pclk = Sysctrl_GetPClkFreq(); //鳳PCLK
timer = Uart_SetBaudRate(M0P_UART0, &stcBaud);
timer = Uart_SetBaudRate(M0P_UART1, &stcBaud);
stcBtCfg.enMD = BtMode2;
stcBtCfg.enCT = BtTimer;
Bt_Init(TIM0, &stcBtCfg);//覃蚚basetimer1扢离滲杅莉汜疏杻薹
Bt_ARRSet(TIM0,timer);
Bt_Cnt16Set(TIM0,timer);
Bt_Run(TIM0);
} |