Backlight driver, totally untested. Backlight SF color not handled yet.
This commit is contained in:
@@ -137,24 +137,41 @@ static void LCD_BL_Config()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOBL, ENABLE);
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_BL;
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_BL;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(GPIOBL, &GPIO_InitStructure);
|
||||
GPIO_PinAFConfig(GPIOBL, GPIO_PinSource_BL, Pin_BL_AF);
|
||||
|
||||
GPIO_PinAFConfig(GPIOBL, GPIO_PinSource_BL, GPIO_AF_TIM10);
|
||||
|
||||
#if defined(REVPLUS)
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_BLW;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(GPIOBL, &GPIO_InitStructure);
|
||||
GPIO_PinAFConfig(GPIOBL, GPIO_PinSource_BLW, Pin_BLW_AF);
|
||||
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM4EN ; // Enable clock
|
||||
TIM4->ARR = 100 ;
|
||||
TIM4->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 10000 - 1;
|
||||
TIM4->CCMR1 = 0x60 ; // PWM
|
||||
TIM4->CCER = 1 ;
|
||||
TIM4->CCR1 = 80;
|
||||
TIM4->EGR = 0 ;
|
||||
TIM4->CR1 = 1 ;
|
||||
#else
|
||||
RCC->APB2ENR |= RCC_APB2ENR_TIM10EN ; // Enable clock
|
||||
TIM10->ARR = 100 ;
|
||||
TIM10->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 10000 - 1;
|
||||
TIM10->CCMR1 = 0x60 ; // PWM
|
||||
TIM10->CCER = 1 ;
|
||||
|
||||
TIM10->CCR1 = 80;
|
||||
TIM10->EGR = 0 ;
|
||||
TIM10->CR1 = 1 ;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Init the anolog spi gpio
|
||||
|
||||
Reference in New Issue
Block a user