按键实验 错误 #18:expected a ")" 怎么解决啊
时间:10-02
整理:3721RD
点击:
程序#include "stm32f10x.h"
#include "key.h"
#include "delay.h"
#include "sys.h"
void KEY_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIOD, &GPIO_InitStructure);
}
u8 KEY_Scan(u8 mode)
{
static u8 key_up=1;
if(mode)key_up=1;
if(key_up&&(key1==0||key2==0))
{
delay_ms(10);
key_up=0;
if(key1==0)return KEY1;
else return KEY2;
}
else if(key1==0==key2==0)key_up=1;
return 0;
}
#include "key.h"
#include "delay.h"
#include "sys.h"
void KEY_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
GPIO_Init(GPIOD, &GPIO_InitStructure);
}
u8 KEY_Scan(u8 mode)
{
static u8 key_up=1;
if(mode)key_up=1;
if(key_up&&(key1==0||key2==0))
{
delay_ms(10);
key_up=0;
if(key1==0)return KEY1;
else return KEY2;
}
else if(key1==0==key2==0)key_up=1;
return 0;
}
错误显示在 if(key_up&&(key1==0||key2==0))
if(key1==0)return KEY1;
else if(key1==0==key2==0)key_up=1;
看看是不是中英文切换的问题