搞不懂STM_EVAL_LEDInit(LED1);有什么作用

2019-07-21 01:36发布

  这种
STM_EVAL_LEDInit(LED1);
void STM_EVAL_LEDInit(Led_TypeDef Led)
{
  GPIO_InitTypeDef  GPIO_InitStructure;
 
  /* Enable the GPIO_LED Clock */
  RCC_AHB1PeriphClockCmd(GPIO_CLK[Led], ENABLE);
  /* Configure the GPIO_LED pin */
  GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led];
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure);
}

和 void GPIO_Init ( MSITStore:C:UsersAdministratorDesktopstm32f4_dsp_stdperiph_libSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0stm32f4xx_dsp_stdperiph_lib_um.chm::/structGPIO__TypeDef.html">GPIO_TypeDef * GPIOx, MSITStore:C:UsersAdministratorDesktopstm32f4_dsp_stdperiph_libSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0stm32f4xx_dsp_stdperiph_lib_um.chm::/structGPIO__InitTypeDef.html">GPIO_InitTypeDef * GPIO_InitStruct ) 这种普通的初始化有什么区别呢,搞不懂STM_EVAL_LEDInit(LED1);有什么作用 GPIO_Init ( MSITStore:C:UsersAdministratorDesktopstm32f4_dsp_stdperiph_libSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0stm32f4xx_dsp_stdperiph_lib_um.chm::/structGPIO__TypeDef.html">GPIO_TypeDef * GPIOx, MSITStore:C:UsersAdministratorDesktopstm32f4_dsp_stdperiph_libSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0stm32f4xx_dsp_stdperiph_lib_um.chm::/structGPIO__InitTypeDef.html">GPIO_InitTypeDef * GPIO_InitStruct )
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
1条回答
taizonglai
1楼-- · 2019-07-21 05:39
GPIO_Init()函数是ST的官方库函数,用来初始化某个IO,但是需要向这个函数传递这个IO的一些参数。STM_EVAL_LEDInit()不是ST官方库函数,这个是用户自己写的,这个函数先初始化结构体GPIO_InitStructure,让后将结构体传递给函数GPIO_Init()。话说,底子亟待加强啊。

一周热门 更多>