void MX_DAC_Init(void)
{
DAC_ChannelConfTypeDef sConfig;
TIM_MasterConfigTypeDef sMasterConfig;
/* DMA中断配置 */
// HAL_NVIC_SetPriority(DACx_DMAx_CHANNELn_IRQn, 1, 0);
// HAL_NVIC_EnableIRQ(DACx_DMAx_CHANNELn_IRQn);
/* DAC初始化 */
hdac.Instance = DACx;
HAL_DAC_Init(&hdac);
/* DAC通道输出配置 */
sConfig.DAC_Trigger = DAC_TRIGGER_T6_TRGO;
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_DISABLE;
HAL_DAC_ConfigChannel(&hdac, &sConfig, DACx_CHANNEL);
htim6.Instance = TIM6;
htim6.Init.Prescaler =900-1;
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
htim6.Init.Period =4-1;
HAL_TIM_Base_Init(&htim6);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig);
}
|