野火电子论坛

标题: 结构体问题 [打印本页]

作者: 淡定哥    时间: 2015-1-14 11:47
标题: 结构体问题
STM32例程中;
typedef struct
{
  uint16_t GPIO_Pin;             /*!< Specifies the GPIO pins to be configured.
                                      This parameter can be any value of @ref GPIO_pins_define */

  GPIOSpeed_TypeDef GPIO_Speed;  /*!< Specifies the speed for the selected pins.
                                      This parameter can be a value of @ref GPIOSpeed_TypeDef */

  GPIOMode_TypeDef GPIO_Mode;    /*!< Specifies the operating mode for the selected pins.
                                      This parameter can be a value of @ref GPIOMode_TypeDef */
}GPIO_InitTypeDef;

上面代码中GPIO_InitTypeDef应该是结构体变量不是结构体类型吧,不能用来定义变量了。


怎么程序中用来定义变量;GPIO_InitTypeDef  GPIO_InitStructure;


求解惑。




作者: 淡定哥    时间: 2015-1-14 12:01
不知道这个解释对不对?
http://www.cnblogs.com/qyaizs/articles/2039101.html
作者: 淡定哥    时间: 2015-1-14 12:21
找到typedef声明新类型明的解释了
作者: nideyangzi2046    时间: 2018-1-11 12:22
GPIO_InitTypeDef 是声明类型,不是定义 不分配内存




欢迎光临 野火电子论坛 (https://www.firebbs.cn/) Powered by Discuz! X3.4