/******************************************************************************* * Function Name : DisplayMenuItemString * Description : Prints menu line * Input : y - line y-coordinate * : ptr - pointer to string * Output : None * Return : None *******************************************************************************/ void DisplayMenuItemString(uint32_t y, ucint8_t *ptr) { uint32_t x; LCD_PUTS(0, y, " "); x = (MAX_X - (CurrentFont->Width * strlen((const char *)ptr))) / 2; LCD_PUTS(x, y, ptr); }
static int lcd_send_cmd_sequence(Init_Seq_t * init) { int i; LCD_PUTS("enter"); /* lcd_enable_ce(false); */ for (i = 0; init[i].type != STOP; i++) { if (init[i].type == WRITE_INDEX) { LCD_DEBUG("Index:0x%04x(0x%04x), Data:0x%04x(0x%04x)\n", init[i].data >> 1, init[i].data, init[i + 1].data >> 1, init[i + 1].data); WRITE_LCD_INDEX(init[i].data); } else if (init[i].type == WRITE_DATA) {
/******************************************************************************* * Function Name : VCOMHelp * Description : Prints hint to the screen. * Input : None * Output : None * Return : None *******************************************************************************/ void VCOMHelp(void) { sFONT *OldFont = CurrentFont; LCD_Method OldMethod = CurrentMethod; LCD_CLS(); CurrentMethod = MET_AND; CurrentFont = &Font_6x8; DisplayMenuTitle("MDR_USB. Virtual COM"); WAIT_UNTIL_KEY_RELEASED(SEL); LCD_PUTS(0, CurrentFont->Height * 2 + 2, " To stop Press SEL"); CurrentMethod = OldMethod; CurrentFont = OldFont; }
/******************************************************************************* * Function Name : DisplayMenuTitle * Description : Prints menu header * Input : ptr - pointer to header string * Output : None * Return : None *******************************************************************************/ void DisplayMenuTitle(ucint8_t *ptr) { uint32_t x, y; sFONT *OldFont = CurrentFont; LCD_Method OldMethod = CurrentMethod; CurrentFont = &Font_6x8; CurrentMethod = MET_AND; x = (MAX_X - (CurrentFont->Width * strlen((const char *)ptr))) / 2; LCD_PUTS(x, 0, ptr); y = CurrentFont->Height + 1; CurrentMethod = MET_OR; LCD_Line(0, y, MAX_X, y); CurrentFont = OldFont; CurrentMethod = OldMethod; }
/******************************************************************************* * Function Name : UpFunc * Description : UP - steps one one item up * Input : None * Output : None * Return : None *******************************************************************************/ void UpFunc(void) { /* Display current menu item as non-selected */ psMenuItem = &psCurrentMenu->psItems[MenuItemIndex]; CurrentMethod = MET_AND; DisplayMenuItemString((MenuItemIndex * (CurrentFont->Height + 2) + CurrentFont->Height + 4), psMenuItem->psTitle); /* Determine new menu item (iteratively) */ if(MenuItemIndex > 0) { MenuItemIndex--; } else { MenuItemIndex = psCurrentMenu->nItems - 1; } /* Display new menu item as selected */ psMenuItem = &psCurrentMenu->psItems[MenuItemIndex]; CurrentMethod = MET_NOT_XOR; LCD_PUTS(0, (MenuItemIndex * (CurrentFont->Height + 2) + CurrentFont->Height + 4), " "); }
/******************************************************************************* * Function Name : DisplayMenu * Description : Displays the current menu * Input : None * Output : None * Return : None *******************************************************************************/ void DisplayMenu(void) { uint32_t y, index; tMenuItem psMenuItem2; LCD_CLS(); CurrentMethod = MET_AND; /* Display menu header */ DisplayMenuTitle(psCurrentMenu->psTitle); /* Display menu items */ for (index = 0, y = CurrentFont->Height + 4; index < psCurrentMenu->nItems; index++, y += CurrentFont->Height + 2) { psMenuItem2 = &(psCurrentMenu->psItems[index]); DisplayMenuItemString(y, psMenuItem2->psTitle); } /* Determine current item */ psMenuItem = &(psCurrentMenu->psItems[MenuItemIndex]); CurrentMethod = MET_NOT_XOR; LCD_PUTS(0, (MenuItemIndex * (CurrentFont->Height + 2) + CurrentFont->Height + 4), " "); }