野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7115|回复: 3

结构体问题

[复制链接]
发表于 2015-1-14 11:47:01 | 显示全部楼层 |阅读模式
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:41 | 显示全部楼层
不知道这个解释对不对?
http://www.cnblogs.com/qyaizs/articles/2039101.html
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-1-14 12:21:22 | 显示全部楼层
找到typedef声明新类型明的解释了
回复 支持 反对

使用道具 举报

发表于 2018-1-11 12:22:49 | 显示全部楼层
GPIO_InitTypeDef 是声明类型,不是定义 不分配内存
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-5-13 01:02 , Processed in 0.035166 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表