打印

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

[复制链接]
203|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
第三章|  楼主 | 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

粉丝