用GPIO_WriteBit时产生enumerated type mixed with another type警告

在keil里面写STM32程序,这样写GPIO_WriteBit(GPIOC,GPIO_Pin_9,1),编译的时候就报enumerated type mixed with another type警告,  这说明数据类型混用了,进入GPIO_WriteBit函数发现其原型是void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)这样的 ,BitAction这个是枚举,所以要类型转换

即把GPIO_WriteBit(GPIOC,GPIO_Pin_9,1)改为GPIO_WriteBit(GPIOC,(BitAction)GPIO_Pin_9,1)即可,再编译时,发现没有了警告

posted on 2015-06-28 21:11  天奕  阅读(2996)  评论(0编辑  收藏  举报

导航