|
全部的如下
while (1) { if((GPIOE->IDR & left)==0) { delay(100); if((GPIOE->IDR & left)==0) { while(!(GPIOE->IDR & left) ) { GPIOC->ODR=0x0000; }
} } GPIOC->ODR=0x0200; // Loop forever if((GPIOE->IDR & right)==0) { delay(100); if((GPIOE->IDR & right)==0) { while(!(GPIOE->IDR & right) ) { GPIOC->ODR=0x0000; }
} } GPIOC->ODR=0x0040; // Loop forever if((GPIOD->IDR & up)==0) { delay(100); if((GPIOD->IDR & up)==0) { while(!(GPIOD->IDR & up) ) { GPIOC->ODR=0x0000; }
} } GPIOC->ODR=0x0100; // Loop forever
if((GPIOD->IDR & down)==0) { delay(100); if((GPIOD->IDR & down)==0) { while(!(GPIOD->IDR & down) ) { GPIOC->ODR=0x0000; }
} } GPIOC->ODR=0x0080; // Loop forever
}
如果单独分开,一个个按键修改的话,没问题,一一对应。但放在一起,就会错位。
|
|