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

[复制链接]
373|0
 楼主| スモモ 发表于 2018-6-7 11:10 | 显示全部楼层 |阅读模式
pi, IO, GPIO, gp, se

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;

}



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

本版积分规则

458

主题

484

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部