int main() { person persona[MAX_PERSON]; int num = 0, choice = 1; DisplayMenu(); while (choice != 0) { cout << endl << "Enter command: "; cin >> choice; while (cin.fail()) { cout << "Invalid input, enter number 0-7:"; cin.clear(); cin.ignore(256, '\n'); cin >> choice; } if (choice == 0) { cout << "Goodbye" << endl; return 0; } if (choice == 1) DisplayMenu(); if (choice == 2) AddPerson(persona, &num); if (choice == 3) PrintPerson(persona, num); if (choice == 4) PrintAllPersons(persona, num); if (choice == 5) DeletePerson(persona, &num); if (choice == 6) ExportToFile(persona, num); if (choice == 7) ImportFromFile(persona, &num); } return 0; }
/** * \brief Application entry point for UART example. * * \return Unused (ANSI-C compatibility). */ extern int main(void) { uint8_t ucKey; /* Disable watchdog */ WDT_Disable(WDT); /* Output example information */ printf("-- UART Example %s --\n\r", SOFTPACK_VERSION); printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s With %s--\n\r", __DATE__, __TIME__, COMPILER_NAME); /* Enable I and D cache */ SCB_EnableICache(); SCB_EnableDCache(); /* Display menu */ DisplayMenu(); while (1) { ucKey = DBG_GetChar(); switch (ucKey) { case 'h': DisplayMenu(); break; case 'i': case 'I': printf("\n\rSending Tx Buffer.. \n\r"); UartTransfer(); break; case 'd': case 'D': memset(pRxBuffer,'X' ,30); pRxBuffer[28] = '\n'; pRxBuffer[29] = '\r'; printf("\n\rRx Buffer before transfer is \n\r"); puts((char*)pRxBuffer); _UartdConfigLB(); UARTD_EnableRxChannels(&Uartd, &UartRx); UARTD_EnableTxChannels(&Uartd, &UartTx); UARTD_RcvData(&Uartd); UARTD_SendData(&Uartd); printf("\n\rRx Buffer after transfer is \n\r"); while (Uartd.pRxChannel->sempaphore == 0); puts((char*)pRxBuffer); UARTD_DisableRxChannels(&Uartd, &UartRx); UARTD_DisableTxChannels(&Uartd, &UartTx); break; default : break; } } }
/** * \brief Application entry point for spi_slave example. * * \return Unused (ANSI-C compatibility). */ extern int main( void ) { uint8_t ucKey ; /* Disable watchdog */ WDT_Disable( WDT ) ; /* Output example information */ printf( "-- spi slave example %s --\n\r", SOFTPACK_VERSION ) ; printf( "-- %s\n\r", BOARD_NAME ) ; printf( "-- Compiled: %s %s --\n\r", __DATE__, __TIME__ ) ; /* Configure PIO Pins for SPI */ PIO_Configure( pSpiPins, PIO_LISTSIZE( pSpiPins ) ) ; /* Configure SPI interrupts for Slave only*/ NVIC_DisableIRQ( SPI_IRQn ) ; NVIC_ClearPendingIRQ( SPI_IRQn ) ; NVIC_SetPriority( SPI_IRQn, 0 ) ; NVIC_EnableIRQ( SPI_IRQn ) ; SpiSlaveInitialize() ; /* Display menu */ DisplayMenu() ; while ( 1 ) { ucKey = UART_GetChar() ; switch ( ucKey ) { case 'h' : DisplayMenu() ; break ; case 't' : SpiMasterGo() ; break ; default : /* Set configuration #n */ if ( (ucKey >= '0') && (ucKey <= ('0' + NUM_SPCK_CONFIGURATIONS - 1)) ) { SetClockConfiguration( ucKey - '0' ) ; } break ; } } }
int main(int argc,char *argv[]) { /* Initialize PSP */ pl_psp_init("cache0:/GENPlusVITA/"); pl_snd_init(SOUND_SAMPLES, 1); pspCtrlInit(); pspVideoInit(); /* Initialize callbacks */ pl_psp_register_callback(PSP_EXIT_CALLBACK, ExitCallback, NULL); pl_psp_start_callback_thread(); /* Start emulation */ InitMenu(); DisplayMenu(); TrashMenu(); /* Release PSP resources */ pl_snd_shutdown(); pspVideoShutdown(); pl_psp_shutdown(); return(0); }
/******************************************************************************* * Function Name : Alarm_Adjust * Description : Adjusts an alarm event to occurs within the current day. * Input : None * Output : None * Return : None *******************************************************************************/ void Alarm_Adjust(void) { /* Disable the JoyStick interrupts */ IntExtOnOffConfig(DISABLE); while(ReadKey() != NOKEY) { } RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); /* Clear the LCD screen */ LCD_Clear(White); LCD_SetDisplayWindow(160, 223, 128, 128); LCD_NORDisplay(ALARM_ICON); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); /* Disable LCD Window mode */ LCD_WindowModeDisable(); Alarm_PreAdjust(); /* Clear the LCD */ LCD_Clear(White); /* Display the menu */ DisplayMenu(); /* Enable the JoyStick interrupts */ IntExtOnOffConfig(ENABLE); }
int main(int argc, char *argv[]) { srand (time(NULL)); // Analyse des arguments et chargement des API S_AIFunctions aiFunctions[2]; InitAIStruct(aiFunctions); E_GameMode gameMode = ParseArgs(argc, argv, aiFunctions); if (gameMode == ERROR) return EXIT_FAILURE; // Chargement de la fenetre SDL_Surface *window = NULL; SDL_Surface *icon = NULL; if (!InitWindow(&window, &icon)) return EXIT_FAILURE; // Affichage du menu DisplayMenu(window, gameMode, aiFunctions); // Liberation des ressources FreeWindow(icon); FreeAIStruct(aiFunctions); return EXIT_SUCCESS; }
int main(int argc, char **argv) { /* Initialize PSP */ pl_psp_init("ux0:/data/NeopopVITA/"); pl_snd_init(512,1); pspCtrlInit(); pspVideoInit(); // show_splash(); #ifdef PSP_DEBUG FILE *debug = fopen("message.txt", "w"); fclose(debug); #endif /* Initialize callbacks */ pl_psp_register_callback(PSP_EXIT_CALLBACK, ExitCallback, NULL); pl_psp_start_callback_thread(); /* Show the menu */ if (InitMenu()) { DisplayMenu(); TrashMenu(); } /* Release PSP resources */ pl_snd_shutdown(); pspVideoShutdown(); pl_psp_shutdown(); return(0); }
void cSatipMenuInfo::Display(void) { cOsdMenu::Display(); DisplayMenu()->SetText(textM, true); if (*textM) cStatus::MsgOsdTextItem(textM); }
/*** * Main entrypoint of the emulator */ int main() { // first, initialize Vita2D printf("Starting CATSFC-libretro-VITA"); vita2d_init_advanced(8 * 1024 * 1024); // do some setup setup_input(); setup_callbacks(); setup_audio(); pl_psp_init("ux0:/data/CATSFC-libretro-VITA/"); // get the game ready if (InitMenu()) { DisplayMenu(); TrashMenu(); } // once emulation is complete, shut down and exit vita_cleanup(); sceKernelExitProcess(0); return 0; }
void APacmanMainMenuHUD::PostInitializeComponents() { Super::PostInitializeComponents(); SAssignNew(MainMenuWidget, SPacmanMainMenuWidget).HUD(this); DisplayMenu(MainMenuWidget.ToSharedRef()); }
/******************************************************************************* * Function Name : Mass_Storage_Start * Description : Starts the mass storage demo. * Input : None * Output : None * Return : None *******************************************************************************/ void Mass_Storage_Start (void) { /* Disble the JoyStick interrupts */ IntExtOnOffConfig(DISABLE); /* Clear the LCD screen */ LCD_Clear(White); LCD_SetDisplayWindow(160, 223, 128, 128); LCD_DrawBMP(0x00647C00); /* Disable LCD Window mode */ LCD_WindowModeDisable(); /* Set the Back Color */ LCD_SetBackColor(Blue); /* Set the Text Color */ LCD_SetTextColor(White); if(MSD_Init() != 0x00) { LCD_DisplayStringLine(Line8, " No MSD Card Present"); LCD_DisplayStringLine(Line9, " To exit Press SEL "); /* Loop until SEL key pressed */ while(ReadKey() != SEL) { } } else { Get_Medium_Characteristics(); /* Display the " Plug the USB " message */ LCD_DisplayStringLine(Line8, " Plug the USB Cable "); LCD_DisplayStringLine(Line9, "Exit: Push JoyStick"); /* Intialize the USB cell */ USB_Init(); LCD_ClearLine(Line9); /* Display the "To stop Press SEL" message */ LCD_DisplayStringLine(Line8, " To stop Press SEL "); /* Loop until SEL key pressed */ while(ReadKey() != SEL) { } PowerOff(); } LCD_Clear(White); DisplayMenu(); IntExtOnOffConfig(ENABLE); /* Flush SPI1 Data Register */ SPI_I2S_ReceiveData(SPI1); }
void MenuSelection() { DisplayMenu(); GetSelection(); if (selection != 5) ImplementSelection(); }
void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsigned int item_on_page) { const char *item_name = menu->GetItemInfo(item, NULL); if (!item_name) { return; } topmenu_object_t *obj; topmenu_player_t *pClient = &m_clients[client]; if (!m_ObjLookup.retrieve(item_name, &obj)) return; /* We now have the object... what do we do with it? */ if (obj->type == TopMenuObject_Category) { /* If it's a category, the user wants to view it.. */ assert(obj->cat_id < m_Categories.size()); assert(m_Categories[obj->cat_id]->obj == obj); pClient->last_root_pos = item_on_page; if (!DisplayCategory(client, obj->cat_id, MENU_TIME_FOREVER, false)) { /* If we can't display the category, re-display the root menu. * This code should be dead as of bug 3256, which disables categories * that cannot be displayed. */ DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot); } } else { pClient->last_position = item_on_page; /* Re-check access in case this user had their credentials revoked */ if (obj->cmdname[0] != '\0' && !adminsys->CheckAccess(client, obj->cmdname, obj->flags, false)) { DisplayMenu(client, 0, TopMenuPosition_LastCategory); return; } /* Pass the information on to the callback */ obj->callbacks->OnTopMenuSelectOption(this, client, obj->object_id); } }
int main(void) { unsigned int switchPressed; debug_init(SOFTWARE_NAME); PIO_InitializeInterrupts(AT91C_AIC_PRIOR_LOWEST); switches_init(); char_display_init(); LED_Configure(0); LED_Configure(1); if (! BCAN_Init(1000, 0, NULL)) { printf("INIT FAIL"); LED_Set(1); return 1; } printf("INIT OK\n\r"); LED_Set(0); BCAN_InitMailboxRegisters( 0, 1, 0x0, (0x5AC << 18), AT91C_CAN_MOT_TX, 0x0); while(1) { DisplayMenu(); switchPressed = -1; while (switchPressed == -1) { if (switches_pressed(0)) { TRACE_INFO("Switch 0 is pressed\n\r"); switchPressed = 0; } else if (switches_pressed(1)) { TRACE_INFO("Switch 1 is pressed\n\r"); switchPressed = 1; } else if (switches_pressed(2)) { TRACE_INFO("Switch 2 is pressed\n\r"); switchPressed = 2; } else if (switches_pressed(3)) { TRACE_INFO("Switch 3 is pressed\n\r"); switchPressed = 3; } else { //TRACE_INFO("No Switch is pressed\n\r"); } char_display_tick(); for (volatile unsigned int i = 0xFF; i > 0; i--) ; } unsigned int result = -1; while (result != CAN_STATUS_SUCCESS) { result = BCAN_Write(0, 1, 0, switchPressed, 0x1); } char_display_number(switchPressed); } return 0; }
int MenuSelection() { DisplayMenu(); GetSelection(); if (selection != 5) ImplementSelection(); return selection; }
void MythBDPlayer::DisplayPauseFrame(void) { if (player_ctx->buffer->IsBD() && player_ctx->buffer->BD()->IsInStillFrame()) { SetScanType(kScan_Progressive); } DisplayMenu(); MythPlayer::DisplayPauseFrame(); }
void TopMenu::OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason reason) { if (reason == MenuCancel_ExitBack) { /* If the client chose exit back, they were on a category menu, and we can * now display the root menu from the last known position. */ DisplayMenu(client, 0, TopMenuPosition_LastRoot); } }
/******************************************************************************* * Function Name : Continue Func * Description : This function is executed when the "Continue..." menu is selected. * Input : None * Output : None * Return : None *******************************************************************************/ void ContinueFunc(void) { psMenuItem->pfUpDownMenuFunc(); psNextMenu[3] = &ContinueMenu; psCurrentMenu = psNextMenu[3]; psMenuItem = &psCurrentMenu->psItems[0]; ItemNumb[nMenuLevel] = 0; MenuItemIndex = 0; nMenuLevel++; DisplayMenu(); }
/// The main function. Creates a filter, configures it, launches the /// filtering thread, handles user input, and cleans up resources when /// exiting. The intention is to run this program with a command line /// argument specifying the configuration file to use. /// @param argc Number of command line arguments /// @param argv Command line arguments /// @return EXIT_SUCCESS or EXIT_FAILURE int main(int argc, char* argv[]) { // TODO: implement function char input[20]; short mode; pthread_t filterThread; int rc; if (argc != 2){ fprintf(stderr, "usage: firewall <config_file>\n"); return EXIT_SUCCESS; } IpPktFilter filter = CreateFilter(); if (!ConfigureFilter(filter, argv[1])){ return EXIT_FAILURE; } rc = pthread_create(&filterThread, NULL, FilterThread, (void*) filter); if (rc){ fprintf(stderr, "Could not create filter thread"); return EXIT_FAILURE; } DisplayMenu(); while(Mode){ printf("> "); char* s = fgets(input, 20 , stdin); if (s){}; mode = ((short) input[0]) -48; if (mode == MODE_BLOCK_ALL){ Mode = MODE_BLOCK_ALL; } else if (mode == MODE_ALLOW_ALL){ Mode = MODE_ALLOW_ALL; } else if (mode == MODE_FILTER){ Mode = MODE_FILTER; } else if (mode == 0){ Mode = 0; pthread_join(filterThread, NULL); break; } } DestroyFilter(filter); return EXIT_SUCCESS; }
/******************************************************************************* * Function Name : ReturnFunc * Description : Jumps to upper level menu * Input : None * Output : None * Return : None *******************************************************************************/ void ReturnFunc(void) { if(nMenuLevel == 0) { nMenuLevel++; } psCurrentMenu = psPrevMenu[nMenuLevel-1]; psMenuItem = &psCurrentMenu->psItems[0]; MenuItemIndex = 0; nMenuLevel--; DisplayMenu(); }
void GetSelection() { int s; while (true) { try { cin >> s; if (!cin.good()) { throw 'c'; } else { if (s >= 1 && s <= 5) { selection = s; // cout << "Legal selection = " << selection << endl; cin.clear(); cin.ignore(10, '\n'); break; } else { throw s; } } } catch (char) { cout << "\nIncorrect input. Try again!\n\n"; cin.clear(); cin.ignore(10, '\n'); DisplayMenu(); continue; } catch (int) { cout << "\nNot a valid choice. Just use 1-5!\n\n"; cin.clear(); cin.ignore(10, '\n'); DisplayMenu(); continue; } } }
void PadView::MouseDown(BPoint where) { BWindow* window = Window(); if (window == NULL) return; BRegion region; GetClippingRegion(®ion); if (!region.Contains(where)) return; bool handle = true; for (int32 i = 0; BView* child = ChildAt(i); i++) { if (child->Frame().Contains(where)) { handle = false; break; } } if (!handle) return; BMessage* message = window->CurrentMessage(); if (message == NULL) return; uint32 buttons; message->FindInt32("buttons", (int32*)&buttons); if (buttons & B_SECONDARY_MOUSE_BUTTON) { BRect r = Bounds(); r.InsetBy(2.0, 2.0); r.top += 6.0; if (r.Contains(where)) { DisplayMenu(where); } else { // sends the window to the back window->Activate(false); } } else { if (system_time() - fClickTime < sActivationDelay) { window->Minimize(true); fClickTime = 0; } else { window->Activate(); fDragOffset = ConvertToScreen(where) - window->Frame().LeftTop(); fDragging = true; SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); fClickTime = system_time(); } } }
void ContextMenu::ShowSkinCustomMenu(POINT pos, Skin* skin) { if (m_MenuActive || skin->IsClosing()) return; m_MenuActive = true; HMENU menu = CreatePopupMenu(); AppendSkinCustomMenu(skin, 0, menu, true); DisplayMenu(pos, menu, skin->GetWindow()); DestroyMenu(menu); m_MenuActive = false; }
/******************************************************************************* * Function Name : EnterSTANDBYMode_RTCAlarm * Description : Enters MCU in STANDBY mode. The wake-up from STANDBY mode is * performed by an RTC Alarm event. * Input : None * Output : None * Return : None *******************************************************************************/ void EnterSTANDBYMode_RTCAlarm(void) { uint32_t tmp = 0; LCD_Clear(White); /* Set the LCD Back Color */ LCD_SetBackColor(Blue); /* Set the LCD Text Color */ LCD_SetTextColor(White); /* Disable the JoyStick interrupts */ IntExtOnOffConfig(DISABLE); if(BKP_ReadBackupRegister(BKP_DR1) != 0xA5A5) { LCD_DisplayStringLine(Line1, "Time and Date are "); LCD_DisplayStringLine(Line2, "not configured, "); LCD_DisplayStringLine(Line3, "please go to the "); LCD_DisplayStringLine(Line4, "calendar menu and "); LCD_DisplayStringLine(Line5, "set the time and "); LCD_DisplayStringLine(Line6, "date parameters. "); LCD_DisplayStringLine(Line7, "Press JoyStick to "); LCD_DisplayStringLine(Line8, "continue... "); while(ReadKey() == NOKEY) { } /* Clear the LCD */ LCD_Clear(White); /* Display the previous menu */ DisplayMenu(); /* Enable the JoyStick interrupts */ IntExtOnOffConfig(ENABLE); return; } tmp = RTC_GetCounter(); /* Save the Alarm value in the Backup register */ BKP_WriteBackupRegister(BKP_DR6, (tmp & 0x0000FFFF)); BKP_WriteBackupRegister(BKP_DR7, (tmp >> 16)); Alarm_PreAdjust(); LCD_DisplayStringLine(Line7, " MCU in STANDBY Mode"); LCD_DisplayStringLine(Line8, " Wait For RTC Alarm "); /* Request to enter STANDBY mode (Wake Up flag is cleared in PWR_EnterSTANDBYMode function) */ PWR_EnterSTANDBYMode(); }
//-------------------------- // void CheckFlags( void ) { if ( exitFlag == TRUE ) { ExitRoutine(); exitFlag = FALSE; return; } // close window and enter normal state if ( terminateFlag == TRUE ) { TerminateRoutine(); return; } // clean-up and terminate TAP if ( returnFromEdit == TRUE ) // Handle navigation up level { // redraw the underlying window returnFromEdit = FALSE; if ( menuShowing ) { DisplayMenu( &mainMenu ); return; } if ( schEditWindowShowing ) { schEditRefresh(); return; } if ( schShowWindowShowing ) { schShowRefresh(); return; } if ( schDispWindowShowing ) { schDispRefresh(TRUE); return; } } }
/******************************************************************************* * Function Name : SelFunc * Description : SEL - jumps to the submenu and/or calls corresponding handler * Input : None * Output : None * Return : None *******************************************************************************/ void SelFunc(void) { psCurrentMenuItem = psMenuItem; if(psMenuItem->psSubMenu != NULL) { MenuItemIndex = 0; psCurrentMenu = psMenuItem->psSubMenu; psMenuItem = &(psCurrentMenu->psItems)[MenuItemIndex]; DisplayMenu(); nMenuLevel++; psPrevMenu[nMenuLevel] = psCurrentMenu; } psCurrentMenuItem->pfMenuFunc(); }
/******************************************************************************* * Function Name : Date_Adjust * Description : Adjusts the current date (MM/DD/YYYY). * Input : None * Output : None * Return : None *******************************************************************************/ void Date_Adjust(void) { IntExtOnOffConfig(DISABLE); while(ReadKey() != NOKEY) { } /* Preadjust the date */ Date_PreAdjust(); /* Clear the LCD */ LCD_Clear(White); /* Display the menu */ DisplayMenu(); /* Enable the JoyStick interrupts */ IntExtOnOffConfig(ENABLE); }
/******************************************************************************* * Function Name : ReturnFunc * Description : This function is executed when the "RETURN" menu is selected. * Input : None * Output : None * Return : None *******************************************************************************/ void ReturnFunc(void) { psMenuItem->pfUpDownMenuFunc(); if(nMenuLevel == 0) { nMenuLevel++; } psCurrentMenu = psPrevMenu[nMenuLevel-1]; psMenuItem = &psCurrentMenu->psItems[0]; ItemNumb[nMenuLevel] = 0; MenuItemIndex = 0; nMenuLevel--; DisplayMenu(); }
eOSState cSatipMenuInfo::ProcessKey(eKeys keyP) { switch (int(keyP)) { case kUp|k_Repeat: case kUp: case kDown|k_Repeat: case kDown: case kLeft|k_Repeat: case kLeft: case kRight|k_Repeat: case kRight: DisplayMenu()->Scroll(NORMALKEY(keyP) == kUp || NORMALKEY(keyP) == kLeft, NORMALKEY(keyP) == kLeft || NORMALKEY(keyP) == kRight); cStatus::MsgOsdTextItem(NULL, NORMALKEY(keyP) == kUp || NORMALKEY(keyP) == kLeft); return osContinue; default: break; } eOSState state = cOsdMenu::ProcessKey(keyP); if (state == osUnknown) { switch (keyP) { case kOk: return osBack; case kRed: pageM = SATIP_DEVICE_INFO_GENERAL; UpdateInfo(); break; case kGreen: pageM = SATIP_DEVICE_INFO_PIDS; UpdateInfo(); break; case kYellow: pageM = SATIP_DEVICE_INFO_FILTERS; UpdateInfo(); break; case kBlue: SatipConfig.SetUseBytes(SatipConfig.GetUseBytes() ? 0 : 1); UpdateInfo(); break; default: if (timeoutM.TimedOut()) UpdateInfo(); state = osContinue; break; } } return state; }
/******************************************************************************* * Function Name : Mass_Storage_Recovery * Description : Erases the NAND Flash Content. * Input : None * Output : None * Return : None *******************************************************************************/ void Mass_Storage_Recovery (void) { /* Disble the JoyStick interrupts */ IntExtOnOffConfig(DISABLE); while(ReadKey() != NOKEY) { } LCD_Clear(White); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); /* Set the Back Color */ LCD_SetBackColor(Blue); /* Set the Text Color */ LCD_SetTextColor(White); LCD_DisplayStringLine(Line4, " Erase NAND Content "); LCD_DisplayStringLine(Line5, "Please wait... "); /* FSMC Initialization */ FSMC_NAND_Init(); NAND_Format(); /* Display the "To stop Press SEL" message */ LCD_DisplayStringLine(Line4, " NAND Erased "); LCD_DisplayStringLine(Line5, " To exit Press SEL "); /* Loop until SEL key pressed */ while(ReadKey() != SEL) { } LCD_Clear(White); DisplayMenu(); IntExtOnOffConfig(ENABLE); }