野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12753|回复: 2

能不能把枚举成员赋值给非枚举类型的变量

[复制链接]
发表于 2014-12-28 15:29:40 | 显示全部楼层 |阅读模式
typedef enum
{ Bit_RESET = 0,
  Bit_SET
}BitAction;

uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
{
  uint8_t bitstatus = 0x00;

  /* Check the parameters */
  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
  assert_param(IS_GET_GPIO_PIN(GPIO_Pin));

  if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)Bit_RESET)
  {
    bitstatus = (uint8_t)Bit_SET;
  }
  else
  {
    bitstatus = (uint8_t)Bit_RESET;
  }
  return bitstatus;
}

主题推荐

回复

使用道具 举报

发表于 2014-12-29 09:14:00 | 显示全部楼层
可以的
回复

使用道具 举报

 楼主| 发表于 2014-12-29 09:40:18 | 显示全部楼层
火神和高手呢?求解啊啊啊啊啊啊啊啊啊啊啊啊!!!!!!!!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-29 15:23 , Processed in 0.041970 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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