gpio口为甚么不能同时初始化两个端口呢?

同时初始化PB0和PC0,报错:

    错误行 //GPIO_Init(GPIOB | GPIOC,&GPIO_InitStruct);

..\user\api\led.c(10): error:  #31: expression must have integral type

	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC,ENABLE);
	
	GPIO_InitTypeDef GPIO_InitStruct;
	GPIO_InitStruct.GPIO_Pin=GPIO_PinSource0;
	GPIO_InitStruct.GPIO_Mode=GPIO_Mode_Out_PP;
	GPIO_InitStruct.GPIO_Speed=GPIO_Speed_50MHz;
	GPIO_Init(GPIOB | GPIOC,&GPIO_InitStruct);

 

如果想用两个GPIO逻辑或做为一个IO,你可以写一个设备驱动在读的时候分别把两个GPIO读回来再做或操作。

好的,谢谢~