/*---------------------------------------------------------------------------* * Routine: MainMenu *---------------------------------------------------------------------------* * Description: * Present the main menu *---------------------------------------------------------------------------*/ void MainMenu(void) { T_uezDevice lcd; T_pixelColor *pixels; // Open the LCD and get the pixel buffer if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE) { UEZLCDGetFrame(lcd, 0, (void **)&pixels); #if (!FAsT_STARTUP) // Clear the screen TitleScreen(); //while(1); PlayAudio(523, 100); PlayAudio(659, 100); PlayAudio(783, 100); PlayAudio(1046, 100); PlayAudio(783, 100); PlayAudio(659, 100); PlayAudio(523, 100); // Force calibration? Calibrate(CalibrateTestIfTouchscreenHeld()); UEZTaskDelay(1000); #else UEZLCDBacklight(lcd, 255); Calibrate(FALSE); #endif AppMenu(&mainmenu); UEZLCDClose(lcd); } }
int main (void){ ADC_Initialize (); // Initialize A/D Converter GLCD_Initialize (); // Initialize Graphical LCD Joystick_Initialize (); // Initialize joystick GLCD_SetBackgroundColor (BackgroundColor); GLCD_SetForegroundColor (ForegroundColor); GLCD_SetFont (&GLCD_Font_16x24); GLCD_ClearScreen(); // Select P0.16 as output LPC_GPIO0->FIODIR |= 0x00010000; menuChoice = InitMenu; while (1) { switch(menuChoice) { case InitMenu: InitializeAppMenu(); menuChoice = Menu; break; case Menu: AppMenu(); break; case InitPong: initDMA(); InitializeAppPong(); menuChoice = Pong; break; case Pong: AppPong(); break; case InitShooter: InitializeAppShooter(); menuChoice = Shooter; break; case Shooter: AppShooter(); menuChoice = InitMenu; break; } } }
/*---------------------------------------------------------------------------* * Routine: MainMenu *---------------------------------------------------------------------------* * Description: * Present the main menu *---------------------------------------------------------------------------*/ void MainMenu(void) { T_uezDevice lcd; T_pixelColor *pixels; // Open the LCD and get the pixel buffer if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE) { UEZLCDGetFrame(lcd, 0, (void **)&pixels); #if (!FAsT_STARTUP) // Clear the screen TitleScreen(); //while(1); PlayAudio(523, 100); PlayAudio(659, 100); PlayAudio(783, 100); PlayAudio(1046, 100); PlayAudio(783, 100); PlayAudio(659, 100); PlayAudio(523, 100); // Force calibration? Calibrate(CalibrateTestIfTouchscreenHeld()); UEZTaskDelay(1000); #else UEZLCDBacklight(lcd, 255); Calibrate(FALSE); #endif // Set the screen saver icon BouncingLogoSS_Setup( (TUInt8 *)G_uEZLogo, UEZ_ICON_WIDTH, UEZ_ICON_HEIGHT, DISPLAY_WIDTH, DISPLAY_HEIGHT); AppMenu(&mainmenu); UEZLCDClose(lcd); } }
void MainMenu(void) { T_uezDevice lcd; T_pixelColor *pixels; T_uezQueue queue; // Setup queue to receive touchscreen events if (UEZQueueCreate(1, sizeof(T_uezTSReading), &queue) == UEZ_ERROR_NONE) { // Open the LCD and get the pixel buffer if (UEZLCDOpen("LCD", &lcd) == UEZ_ERROR_NONE) { UEZLCDGetFrame(lcd, 0, (void **)&pixels); UEZLCDOn(lcd); #if (!FAST_STARTUP) // Clear the screen TitleScreen(); PlayAudio(523, 100); PlayAudio(659, 100); PlayAudio(783, 100); PlayAudio(1046, 100); PlayAudio(783, 100); PlayAudio(659, 100); PlayAudio(523, 100); #if DKTS_BUTTON_SLIDE_SHOW_DEMO // show emwin on button 1, auto slideshow on buttons 2-4 #include <uEZButton.h> #include <GUIDEMO.h> T_uezDevice ButtonBank; TUInt32 buttonsActive = 0x0F; // buttons 1-4 TUInt32 ButtonsPressed; T_slideshowDefinition aDef; aDef.iDrive = 1; if (UEZButtonBankOpen("ButtonBank0", &ButtonBank) == UEZ_ERROR_NONE) { // the device opened properly if (UEZButtonBankSetActive(ButtonBank, buttonsActive) == UEZ_ERROR_NONE) { // set active successful } if (UEZButtonBankRead(ButtonBank, &ButtonsPressed) == UEZ_ERROR_NONE) { // got buttons pressed if (ButtonsPressed == 14) { // button 1 pressed const T_choice aChoice = {0}; emWin(&aChoice); } else if (ButtonsPressed == 13) { // button 2 pressed char str1[] = {'F','D','I',' ','O','v','e','r','v','i','e','w','\0'}; memcpy(aDef.iName,str1,strlen(str1)+1); char str2[] = {'F','D','I','\0'}; memcpy(aDef.iDirectory,str2,strlen(str2)+1); SingleSlideshowMode(&aDef); // change to Speedometer Demo here } else if (ButtonsPressed == 11) { // button 3 pressed char str3[] = {'u','E','Z','G','U','I',' ','F','a','m','i','l','y','\0'}; memcpy(aDef.iName,str3,strlen(str3)+1); char str4[] = {'U','E','Z','G','U','I','\0'}; memcpy(aDef.iDirectory,str4,strlen(str4)+1); SingleSlideshowMode(&aDef); } else if (ButtonsPressed == 7) { // button 4 pressed char str5[] = {'D','e','m','o','n','s','t','r','a','t','i', 'o','n',' ','P','i','c','t','u','r','e','s','\0'}; memcpy(aDef.iName,str5,strlen(str5)+1); char str6[] = {'D','E','M','O','P','I','C','S','\0'}; memcpy(aDef.iDirectory,str6,strlen(str6)+1); SingleSlideshowMode(&aDef); } else{ } } if (UEZButtonBankClose(ButtonBank) != UEZ_ERROR_NONE) {// error closing button bank } } else {// an error occurred opening Button Bank } Calibrate(CalibrateTestIfTouchscreenHeld()); // turn touchscreen back on since touchscreen present on KOE #else // Force calibration? Calibrate(CalibrateTestIfTouchscreenHeld()); #endif //UEZTaskDelay(1000); #else UEZLCDBacklight(lcd, 255); #endif UEZTaskDelay(10000); AppMenu(&mainmenu); UEZLCDClose(lcd); } } }