#include"stm32f10x_lib.h"
#include"sys.h"
#include"led.h"
#include"delay.h"
#define led PBout(0)
#define key PAin(0)
void init_led(void)
{
RCC->APB2ENR=1<<3;
GPIOB->CRL&=0xfffffff0;
GPIOB->CRL|=0x00000003;
GPIOB->ODR=1<<0;
}
void init_key(void)
{
RCC->APB2ENR=1<<2;
GPIOA->CRH&=0xfffffff0;
GPIOA->CRH|=0x00000008;
GPIOA->ODR=1<<0;
}
int main()
{
Stm32_Clock_Init(9);
delay_init(72);
init_led();
init_key();
while(1)
{
if(key==0)
led=0;
while(1);
}
}
while(1)
{
if(key==0)
led=0;
while(1);
}
晃了一眼,你while(1)里面干嘛还要搞个while,多余了吧
GPIOA->CRH&=0xfffffff0;
看你上面的宏定义应该是对端口A的低位进行设置
GPIOA->CRL&=0xfffffff0;