高级会员

- 积分
- 538
- 金钱
- 538
- 注册时间
- 2019-5-14
- 在线时间
- 231 小时
|
3金钱
如图 LCD_EN是用来控制LCD屏的背光 然后我发现这个工程里 关闭背光时,设置io口为输出模式 低电平。而打开背光用的是下拉输入模式,然后我把打开背光的 下拉输入改成输出模式 置为高电平 也能打开背光。到底哪个对?
void disable_lcd(void){
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; //GPIO_MODE_INPUT
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Pin = LCD_EN; //0010,0000,0000,0000
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOD, LCD_EN, GPIO_PIN_RESET);
lcd_write_command(0x28);
}
void light_lcd(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Pin = LCD_EN; //0010,0000,0000,0000
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
lcd_write_command(0x29);
}
我改的如下
void light_lcd(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Pin = LCD_EN; //0010,0000,0000,0000
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOD, LCD_EN, GPIO_PIN_SET);
lcd_write_command(0x29);
}
|
-
|