/************************************************************************************************** void LCD_Init(uint8_t v_lcdNoOfLines_u8, uint8_t v_MaxCharsPerLine_u8) *************************************************************************************************** * Function name: LCD_Init() * I/P Arguments: uint8_t: Number of lines of LCD uint8_t: Number of Chars per line * Return value : none * description :This function is used to initialize the lcd. *It initializes the LCD for selected mode(4/8-bit) and Type(16x2/16x1 etc) **************************************************************************************************/ void LCD_Init(uint8_t v_lcdNoOfLines_u8, uint8_t v_MaxCharsPerLine_u8) { LCDConfig.v_MaxSupportedChars_U8 = v_MaxCharsPerLine_u8; //Maintaian the LCD type LCDConfig.v_MaxSupportedLines_U8 = v_lcdNoOfLines_u8; if(v_lcdNoOfLines_u8 > C_LcdLineTwo) { ARR_LcdLineNumAddress_U8[C_LcdLineTwo] = 0x90 + (v_MaxCharsPerLine_u8 & 0x0fu); ARR_LcdLineNumAddress_U8[C_LcdLineThree] = 0xd0 + (v_MaxCharsPerLine_u8 & 0x0fu); } DELAY_ms(100); if(LCDConfig.v_LcdMode_U8 == C_EightBitMode_U8) { LCD_CmdWrite(CMD_LCD_EIGHT_BIT_MODE); // Initialize the LCD for 8-bit 5x7 matrix type } else if(LCDConfig.v_LcdMode_U8 == C_FourBitMode_U8) { lcd_Reset(); LCD_CmdWrite(CMD_LCD_FOUR_BIT_MODE); // Initialize the LCD for 4-bit 5x7 matrix type } LCD_CmdWrite(CMD_DISPLAY_ON_CURSOR_ON); // Display ON cursor ON LCD_Clear(); // Clear the LCD and go to First line First Position }
void rt_hw_lcd_init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOD ,ENABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = lcd_data_pin | lcd_clk_pin; GPIO_Init(lcd_gpio_data, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //GPIO_InitStructure.GPIO_Pin = lcd_A0 | lcd_E1 | lcd_E2 | lcd_RW; ; GPIO_InitStructure.GPIO_Pin = lcd_A0 | lcd_CSB | lcd_RST; GPIO_Init(lcd_gpio_ctrl, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Pin = lcd_BK; GPIO_Init(lcd_bk_ctrl, &GPIO_InitStructure); lcd_Reset(); lcd_delay(30); rt_hw_lcd_on(); }