Ejemplo n.º 1
0
/**
  * @brief  Init the GPIO port of the LCD and LCD peripheral.
  * @param  None 
  * @retval None
  */
void LCD_Seg_Init(void)
{
    uint16_t i;
    LCD_InitPara LCD_InitStructure;

    /* Configure the LCD GPIO pins */
    LCD_GPIO_Config(); 

    /*!< Enable the clock of LCD */
    RCC_APB1PeriphClock_Enable(RCC_APB1PERIPH_LCD, ENABLE);
    for(i=0;i<500;i++);
    /* Configure the LCD interface */
    LCD_InitStructure.LCD_Prescaler = LCD_PRESCALER_1;
    LCD_InitStructure.LCD_Divider = LCD_DIVIDER_16;
    LCD_InitStructure.LCD_Duty = LCD_DUTY_1_4;
    LCD_InitStructure.LCD_VBias = LCD_BIAS_1_3;
    LCD_InitStructure.LCD_VSRC = LCD_VOLTAGESOURCE_INTERNAL;
    LCD_Init(&LCD_InitStructure);

    /* Configure the Pulse On Duration */
    LCD_PulseOnDurationConfig(LCD_PULSEON_DURATION_7);

    /* Configure the Datatime Period */
    LCD_DeadTimeConfig(LCD_DEADTIME_PERIOD_7);

    /* Configure the LCD Contrast LEVEL_7(3.51V) */
    LCD_ContrastConfig(LCD_CONTRAST_LEVEL_7);

    /* Enable high drive function */
    LCD_HighDrive_Enable(ENABLE);

    /* Loop until SYNF flag is set */
    while ((LCD->SFR & LCD_FLAG_SYNF) == (uint32_t)RESET)
    {
    }
    /* Enable LCD peripheral */
    LCD_Enable(ENABLE);

    /* Wait the LCD is enable */
    while(!(LCD_GetBitState(LCD_FLAG_ONF)))
    {
    }

    /* Wait the LCD CFGR register synchronization */
//    while(!(LCD_GetBitState(LCD_FLAG_VRDYF)))
//    {
//    }

}
Ejemplo n.º 2
0
Archivo: lcd.c Proyecto: ezhov/test2
void startLcd()
{
    int i;
    long j;

    CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
    CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_1);
    CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);

    LCD_Init(LCD_Prescaler_1, LCD_Divider_31, LCD_Duty_1_4, LCD_Bias_1_3, LCD_VoltageSource_Internal);
    LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff);
    LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0xff);
    LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0xff);
    LCD_ContrastConfig(LCD_Contrast_3V0);
    LCD_DeadTimeConfig(LCD_DeadTime_0);
    LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);

    LCD_Cmd(ENABLE);
}