uint8_t press_K1(){
if(((GPIOA->IDR)&0x0001)!=1){
return 0;
}else{
return 1;
}
}
uint8_t press_K2(){
if(((GPIOC->IDR)&0x2000)!=1){
return 0;
}else{
return 1;
}
}
void key_Init(){
RCC->APB2ENR |= (0x01<<2);
RCC->APB2ENR |= (0x01<<4);
GPIOA->CRL &= ~(0x0f<<0);
GPIOA->CRL |= (0x04<<0);
GPIOC->CRH &= ~((uint32_t)0x0f<<20);
GPIOC->CRH |= ((uint32_t)0x04<<20);
}
我检查了好几遍,不知道错在哪里了,求大佬指点 |