if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET) { TIM_ClearITPendingBit(TIM2, TIM_IT_CC1);
if (var == 0) /* OCMP_1 */ { var++;
/* Segments(lcdcr) to be turned on are loaded with the value 1 otherwise 0 */ Seg_Old = frame[lcdcr]; GPIO_Write(GPIOE,Seg_Old);
/* com(lcdcr) is set to low, other coms set to Vdd/2 */ /* Configure all coms as Floating Input */ GPIO_InitStructure.GPIO_Pin = COMPORT; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure);
/* com(lcdr) is set to low PP */ GPIO_ResetBits(GPIOC,com[lcdcr]); GPIO_InitStructure.GPIO_Pin = com[lcdcr]; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); } else /* OCMP_2 */ { var = 0;
/* Segments(lcdcr) values are inverted */ Seg_Old = (u16)(~Seg_Old); GPIO_Write(GPIOE,Seg_Old);
/* com(lcdcr) is set to high, other coms set to Vdd/2 */ /* Configure all coms as Floating Input */ GPIO_InitStructure.GPIO_Pin = COMPORT; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure);
/* com(lcdr) is set to high PP */ GPIO_SetBits(GPIOC,com[lcdcr]); GPIO_InitStructure.GPIO_Pin = com[lcdcr]; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure);
lcdcr++; if (lcdcr>3) lcdcr =0; } } else if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) { TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
/* All seg and coms off to decrease VRMS */ GPIO_Write(GPIOE,0); /* Clear segments on portE */ GPIO_ResetBits(GPIOC,COMPORT); /* Clear segments on portC */
/* Configure all coms as PP_output */ GPIO_InitStructure.GPIO_Pin = COMPORT; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOC, &GPIO_InitStructure); } }