疑惑了我两天的问题,在此记录一下。
GPIO_Mode_IPD = 0x28,GPIO_Mode_IPU = 0x48,
高位一个是0010一个是0100,在GPIO的初始化中最后
/* Reset the corresponding ODR bit */
if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
{
GPIOx->BRR = (((uint32_t)0x01) << pinpos);
}
else
{
/* Set the corresponding ODR bit */
if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
{
GPIOx->BSRR = (((uint32_t)0x01) << pinpos);
}
}
说明高位是用来区分设置的模式是IPU还是IPD,从而用来初始化IO端口的输出用的。
所以0010和0100只是用来决定初始化时IO端口的输出电平是高还是低用的,高位起得是一个区分作用。 支持楼主,自己解决问题 这样的帖子就ok啦
页:
[1]