定时器TIM8的通道1,PC6,用于输出PWM信号
void TIM8_PWM_Init(u16 arr,u16 psc)
{
GPIO_InitTypeDef GPIO_InitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM8,ENABLE); //复用
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOC,ENABLE);
GPIO_PinAFConfig(GPIOC,GPIO_PinSource6,GPIO_AF_TIM8); //初始化
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;//GPIOC6,
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度100MHz
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽复用输出
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;//上拉
GPIO_Init(GPIOC, &GPIO_InitStructure);//初始化PC6,
TIM_TimeBaseStructure.TIM_Period =arr; //自动重装载值
TIM_TimeBaseStructure.TI