#define LED_G_TOGGLE {LED_G_GPIO_PORT->ODR ^= LED_G_GPIO_PIN;}
while(1)
{
//if( Key_Scan(KEY1_GPIO_PORT,KEY1_GPIO_PIN) ==KEY_ON )
//LED_G_TOGGLE;
if(PAin(0)== KEY_ON)
{
while(PAin(0)== KEY_ON);
LED_G_TOGGLE;
}
if(PCin(0)== KEY_ON)
{
while(PCin(0)== KEY_ON);
LED_G_TOGGLE;
}
}
这部分代码是怎么运行,使得按键按一次,随即灭,再按一次,随即亮,并且始终保持一个状态(亮或者灭)下 |