/************************************************************************ Function: WORD CreateJPEGDemo(void) Overview: Creates the JPEG demo screen. Input: none Output: Return 0 when memory is not enough for objects of the demo. ************************************************************************/ WORD CreateJPEGDemo(void) { BYTE TextHeight; WORD TextX; // Free memory for the objects in the previous linked list and start new list to display // the files seen on the media GOLFree(); // initialize the image decoder ImageDecoderInit(); // initialize the screen SetColor(WHITE); ClearDevice(); SetFont((void *) &GOLFontDefault); TextHeight = GetTextHeight((void *) &GOLFontDefault); SetColor(BRIGHTRED); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)ImageDisplayStr, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 1 * TextHeight, (XCHAR *)ImageDisplayStr)); SetColor(BLACK); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)DetectingStr, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 3 * TextHeight, (XCHAR *)DetectingStr)); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)ThumbDriveStr, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 4 * TextHeight, (XCHAR *)ThumbDriveStr)); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)PleaseWaitStr, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 6 * TextHeight, (XCHAR *)PleaseWaitStr)); #if defined(ENABLE_SD_MSD_DEMO) MDD_SDSPI_InitIO(); #endif MonitorDriveMedia(); if(mediaPresent == 0) { // erase the last line SetColor(WHITE); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)PleaseWaitStr, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 6 * TextHeight, (XCHAR *)PleaseWaitStr)); // replace it with these SetColor(BRIGHTRED); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)Exiting1Str, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 6 * TextHeight, (XCHAR *)Exiting1Str)); TextX = (IMG_SCREEN_WIDTH - GetTextWidth((XCHAR *)Exiting2Str, (void *) &GOLFontDefault)) / 2; WAIT_UNTIL_FINISH(OutTextXY(TextX, 7 * TextHeight, (XCHAR *)Exiting2Str)); DelayMs(1000); return (0); } blImageOnScreen = 0; blTextOnScreen = 0; pSave = NULL; blSlideShowOn = 0; NextSlide = 0xFF; // create the listbox, slider and buttons that will emulate a // list box with controls. pListBox = LbCreate ( ID_JPGLISTBOX, LBJPGXPOS, LBJPGYPOS, LBJPGXPOS + LBJPGWIDTH, LBJPGYPOS + LBJPGHEIGHT, LB_DRAW | LB_SINGLE_SEL, pJPGItemList, NULL ); if(pListBox == NULL) return (0); pSlider = SldCreate ( ID_SLD4LB, SLD4LBXPOS, SLD4LBYPOS, SLD4LBXPOS + SLD4LBWIDTH, SLD4LBYPOS + SLD4LBHEIGHT, SLD_DRAW | SLD_VERTICAL | SLD_SCROLLBAR, 2, 1, 1, // these are temporary fill items will set to proper values NULL ); if(pSlider == NULL) return (0); pBtnUp = BtnCreate ( ID_BTNUP4LB, BTNUP4LBXPOS, BTNUP4LBYPOS, BTNUP4LBXPOS + BTNUP4LBWIDTH, BTNUP4LBYPOS + BTNUP4LBHEIGHT, 0, BTN_DRAW, NULL, (XCHAR *)JpegUpArrowStr, NULL ); if(pBtnUp == NULL) return (0); pBtnDn = BtnCreate ( ID_BTNDN4LB, BTNDN4LBXPOS, BTNDN4LBYPOS, BTNDN4LBXPOS + BTNDN4LBWIDTH, BTNDN4LBYPOS + BTNDN4LBHEIGHT, 0, BTN_DRAW, NULL, (XCHAR *)JpegDownArrowStr, NULL ); if(pBtnUp == NULL) return (0); // create the control buttons at the bottom of the screen CreateCtrlButtons(ExitStr, NULL, NULL, RightArrowStr); // fill the list box with the file names of images in the media FillNewElements(); // set the first item to be focused LbSetFocusedItem(pListBox, 0); // successful creation of the JPEG demo screen return (1); }
void fsmanInitHardwareSD(void) { __debug("Initializing CS GPIO"); User_MDD_SDSPI_IO_Init(); MDD_SDSPI_InitIO(); }