码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2015-06-28 21:36:24      阅读:371      评论:0      收藏:0      [点我收藏+]

标签:

在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)即可,再编译时,发现没有了警告

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

标签:

原文地址:http://www.cnblogs.com/baitx/p/4606112.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!