stm32 oled io口配置
voidOLED_Init(void){RCC->APB2ENR|=1<<3;//使能PORTB时钟RCC->APB2ENR|=1<<4;//使能PORTC时钟#ifOL...
void OLED_Init(void)
{
RCC->APB2ENR|=1<<3; //使能PORTB时钟
RCC->APB2ENR|=1<<4; //使能PORTC时钟
#if OLED_MODE==1
JTAG_Set(SWD_ENABLE);
GPIOB->CRL=0X33333333;
GPIOB->ODR|=0XFFFF;
GPIOC->CRH&=0XFFFFFF00;
GPIOC->CRL&=0X00FFFFFF;
GPIOC->CRH|=0X00000033;
GPIOC->CRL|=0X33000000;
GPIOC->ODR|=0X03C0;
#else
GPIOB->CRL&=0XFFFFFF00;
GPIOB->CRL|=0XF0000033;
GPIOB->ODR|=0X03;
GPIOC->CRH&=0XFFFFFF00;
GPIOC->CRH|=0X00000033;
GPIOC->ODR|=3<<8;
#endif
这是他源程序,我现在想PB0~7不变,PB8~12分别接OLED的CS.RST.DC.RW.RD。请高手们修改一下 展开
{
RCC->APB2ENR|=1<<3; //使能PORTB时钟
RCC->APB2ENR|=1<<4; //使能PORTC时钟
#if OLED_MODE==1
JTAG_Set(SWD_ENABLE);
GPIOB->CRL=0X33333333;
GPIOB->ODR|=0XFFFF;
GPIOC->CRH&=0XFFFFFF00;
GPIOC->CRL&=0X00FFFFFF;
GPIOC->CRH|=0X00000033;
GPIOC->CRL|=0X33000000;
GPIOC->ODR|=0X03C0;
#else
GPIOB->CRL&=0XFFFFFF00;
GPIOB->CRL|=0XF0000033;
GPIOB->ODR|=0X03;
GPIOC->CRH&=0XFFFFFF00;
GPIOC->CRH|=0X00000033;
GPIOC->ODR|=3<<8;
#endif
这是他源程序,我现在想PB0~7不变,PB8~12分别接OLED的CS.RST.DC.RW.RD。请高手们修改一下 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询