void LCDInit(void){
LCD_InitTypeDef LCD_InitStructure;
RCC_LSICmd(ENABLE);
while (RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET);
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
LCD_GPIOConfig();
RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD, ENABLE);
LCD_InitStructure.LCD_Prescaler = LCD_Prescaler_8;
LCD_InitStructure.LCD_Divider = LCD_Divider_16;
LCD_InitStructure.LCD_Duty = LCD_Duty_1_4;
LCD_InitStructure.LCD_Bias = LCD_Bias_1_3;
LCD_InitStructure.LCD_VoltageSource = LCD_VoltageSource_Internal;
LCD_Init(&LCD_InitStructure);
LCD_HighDriveCmd(ENABLE);
/*!< Configure the Pulse On Duration */
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_7);
/*!< Configure the LCD Contrast (2.99V) */
LCD_ContrastConfig(LCD_Contrast_Level_3);
/*!< Wait Until the LCD FCR register is synchronized */
LCD_WaitForSynchro();
/*!< Enable LCD peripheral */
LCD_Cmd(ENABLE);
/*!< Wait Until the LCD is enabled */
while(LCD_GetFlagStatus(LCD_FLAG_ENS) == RESET);
/*!< Wait Until the LCD Booster is ready */
while(LCD_GetFlagStatus(LCD_FLAG_RDY) == RESET);
}
|