关于stm32单片机定时器的使用

[复制链接]
 楼主| 第三章 发表于 2019-11-28 15:20 | 显示全部楼层 |阅读模式
static void TIM3_GPIO_Config(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);

  /*GPIOA Configuration: TIM3 channel 1 and 2 as alternate function push-pull */
  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_6 | GPIO_Pin_7;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_0 | GPIO_Pin_1;//这是利用STM32的定时器3输出PWM波形的程序中的一个函数,该函数是对GPIO进行配置的函数
  GPIO_Init(GPIOB, &GPIO_InitStructure);                              //想请问大神:为什么这里仅仅只需要配置选择IO口,不需要配置GPIO_SPEED和GPIO_MODE?为什么?
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

380

主题

380

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部

380

主题

380

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部