高级会员

- 积分
- 947
- 金钱
- 947
- 注册时间
- 2014-11-22
- 在线时间
- 145 小时
|

楼主 |
发表于 2014-11-22 16:24:40
|
显示全部楼层
回复【4楼】jermy_z:
---------------------------------
是我keil出现问题了吗,我该了不用连键了,但是到key1==0这种地方就报错,这是改的程序#include <stm32f10x.h>
#include <key.h>
#include <delay.h>
void KEY_GPIO(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE |RCC_APB2Periph_GPIOC, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIOE, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIOC, &GPIO_InitStructure);
}
u8 keyscan(u8 mode)
{
if(key1==0)
{
delay_ms(5);
if(key1==0)
{
key1_pres;
}
}
return key1_pres;
else if(key2==0)
{
delay_ms(5);
if(key2==0)
{
key2_pres;
}
}
return key2_pres;
else if(key1==1 || key2==1)
{
key_no;
}
return 0;
} |
|