htim1.Instance = TIM1;
htim1.Init.Prescaler = ((TIM_CLOCK_DIVIDER) - 1);
htim1.Init.CounterMode = TIM_COUNTERMODE_CENTERALIGNED1;
htim1.Init.Period = ((PWM_PERIOD_CYCLES) / 2);
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV2;
htim1.Init.RepetitionCounter = (REP_COUNTER);
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
//---------------------------------------------------------------
//从模式:触发模式
sSlaveConfig.SlaveMode = TIM_SLAVEMODE_TRIGGER;
sSlaveConfig.InputTrigger = TIM_TS_ITR1;
//---------------------------------------------------------------
if (HAL_TIM_SlaveConfigSynchro(&htim1, &sSlaveConfig) != HAL_OK)
{
Error_Handler();
}
求教,这个是设置TIM1为从模式,等待别的地方触发吗?
是通过TIM2 触发TIM1 吗?可是源码里并没有使用TIM2啊?困惑了,求助。
|