处理:
使用定时器来延迟重新使能该通道的时间,进而延迟重新发送 IN 令牌的时间。 基于 U 盘读写的例程。
一.在主函数中增加初始化 TIM3 的代码://Tomas Li add TimHandle.Instance = TIM3;
TimHandle.Init.Prescaler = 5;
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
TimHandle.Init.Period = 3000;
TimHandle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_Base_Init(&TimHandle);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
HAL_TIM_ConfigClockSource(&TimHandle, &sClockSourceConfig);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&TimHandle, &sMasterConfig);
//Tomas Li add
|