static int wmt_display_main (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { int tmp; switch (argc) { case 0: case 1: printf ("Usage:\n%s\n", cmdtp->usage); return 0; default: if (strncmp(argv[1], "init", 2) == 0) { if (argc == 3) { if (strcmp(argv[2], "force") == 0) { display_init(1, 1); return 0; } } display_init(1, 0); return 0; } if (strncmp(argv[1], "clear", 2) == 0) { display_clear(); return 0; } if (strncmp(argv[1], "show", 2) == 0) { if (4 == argc) { g_logo_x = simple_strtoul(argv[2], NULL, 10); g_logo_y = simple_strtoul(argv[3], NULL, 10); printf("(%d, %d) ", g_logo_x, g_logo_y); } else { g_logo_x = -1; g_logo_y = -1; } display_show(0); return 0; } if (strncmp(argv[1], "setpwm", 2) == 0) { if (argc == 3) { if (argv[2] != NULL) { display_set_pwm(argv[2], 1); return 0; } } else if (argc == 4) { tmp = simple_strtoul(argv[2], NULL, 10); if (argv[3] != NULL) { display_set_pwm(argv[3], tmp); return 0; } } } printf ("Usage:\n%s\n", cmdtp->usage); return 0; } return 0; }
int main(void) { sei(); // enable interrupts leds_init(); pwm_init(); bot_init(); i2c_init(); if (display_init()!=0) { leds_set_displaylight(50); if (display_type==2) { gfx_init(); } } gfx_fill(0x00); gfx_move(15, 0); gfx_set_proportional(1); gfx_print_text("nibo"); gfx_set_proportional(0); uint8_t pos=0; uint8_t state=0; gfx_term_print("Move 0\n"); nds3_move(0); while (nds3_get_busy()) { delay(1); } while (1) { gfx_draw_mode(GFX_DM_JAM2); check_voltage(); //gfx_term_print("Measure 90, 15\n"); delay(1); nds3_measure(180, 1); while (nds3_get_busy()) { delay(1); } delay(1); //gfx_term_print("Read -90, 15\n"); do_plot(); delay(1); nds3_measure(0, 1); while (nds3_get_busy()) { delay(1); } delay(1); //gfx_term_print("Read 90, 15\n"); nds3_read(0, 15); do_plot(); } }
//************************************************************** // main() //************************************************************** int main(){ #define Adresse 0x9E // evtl 9F für schreiben? #define Read 1 #define Write 0 unsigned char ucTemp1,ucTemp2; // Deklaration der Variablen display_init(); // Initialisiere Display int i; while(1) { signed int avg = 0; for(i = 0; i < 64; i++) { // Setzen der Startbedingung und warten bis slave antwortet mit ACK0 while(i2c_start(Adresse+Read)); ucTemp1 = i2c_rbyte(0); // Erstes Byte einlesen ucTemp2 = i2c_rbyte(1); // Zweites Byte einlesen i2c_stop(); // I2C wieder freigeben // Ausgabe der gelesenen Werte display_set_cursor(0, 0); print_temp(tempwert(ucTemp1, ucTemp2)); avg += tempwert(ucTemp1, ucTemp2); delay5ms(100); // Verzögerung 100 ms } display_set_cursor(0, 1); print_temp(avg >> 6); } while(1); // Endlosschleife }
/* main */ int main(void) { /* initialise kernel */ si_kernel_init(); /* initialise UI channel */ si_ui_init(); /* initialise display */ display_init(); /* initialise variables */ clock_init(); /* create tasks */ si_task_create(clock_task, &Clock_Stack[STACK_SIZE-1], 20); si_task_create(alarm_task, &Alarm_Stack[STACK_SIZE-1],17); si_task_create(set_task, &Set_Stack[STACK_SIZE-1], 15); /* start the kernel */ si_kernel_start(); /* will never be here! */ return 0; }
int main(int argc, char *argv[]) { printf("Initializing game\n"); clock_t start, end; int remaining_time; display_init(); gamepad_init(); grid_init(grid); players_init(grid, players); display_fill_screen(0); g_running = 1; while(g_running) { start = clock(); update_pos(grid, players); end = clock(); remaining_time = TIME_PER_LOOP - (((end - start)/CLOCKS_PER_SEC)*1000); if(remaining_time > 0) { usleep(remaining_time*1000); } continue; } exit(EXIT_SUCCESS); }
int main(int argc, char* argv[]) { glutInit(&argc, argv); display_init(); comm_initialize(); /* Call backs */ glutDisplayFunc( display); glutReshapeFunc( reshape); glutKeyboardFunc( keyboard); glutIdleFunc( comm_read); satellite = add_element("Satellite"); satellite_camera = new Camera(); current_camera = satellite_camera; planet = add_element("Ball"); for (int ii=0; ii<3 ; ii++) { planet->pos[ii] = 0.0; } glutMainLoop(); return 0; }
int main(void) { uart_init(); shift_init(); timer_init(); display_init(); keypad_init(); serial_init(); edit_init(); clock_init(); watchdog_init(WDTO_15MS, &oops); sei(); // enable interrupts printf("\r\n*** BOOTED ***\r\nSpaceTime, yay!\r\n"); timer_beep(10); while(1) { display_update(); serial_update(); edit_update(); clock_update(); } }
ty340word ty340_reset(void *dptr) { struct type340 *u = UNIT(0); #ifndef TY340_NODISPLAY if (!u->initialized) { display_init(DIS_TYPE340, 1, dptr); /* XXX check return? */ u->initialized = 1; } #endif u->xpos = u->ypos = 0; u->mode = 0; u->status = 0; u->scale = 1; #if TYPE342 u->shift = 0; u->width = 6; u->height = 9; #endif #if TYPE347 u->SAVE_FF = 0; #endif ty340_rfd(); /* ready for data */ return u->status; }
// Inits the tic-tac-toe display, draws the lines that form the board. void ticTacToeDisplay_init(){ display_init(); // Must init all of the software and underlying hardware for LCD. display_fillScreen(DISPLAY_BLACK); // Blank the screen. display_setRotation(true); buttons_init(); ticTacToeDisplay_drawBoardLines(); /* ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_0, TICTACTOE_DISP_ROW_0); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_1, TICTACTOE_DISP_ROW_0); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_2, TICTACTOE_DISP_ROW_0); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_0, TICTACTOE_DISP_ROW_1); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_1, TICTACTOE_DISP_ROW_1); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_2, TICTACTOE_DISP_ROW_1); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_0, TICTACTOE_DISP_ROW_2); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_1, TICTACTOE_DISP_ROW_2); ticTacToeDisplay_drawX(TICTACTOE_DISP_COLUMN_2, TICTACTOE_DISP_ROW_2); */ /* ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_0, TICTACTOE_DISP_ROW_0); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_0, TICTACTOE_DISP_ROW_1); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_0, TICTACTOE_DISP_ROW_2); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_1, TICTACTOE_DISP_ROW_0); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_1, TICTACTOE_DISP_ROW_1); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_1, TICTACTOE_DISP_ROW_2); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_2, TICTACTOE_DISP_ROW_0); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_2, TICTACTOE_DISP_ROW_1); ticTacToeDisplay_drawO(TICTACTOE_DISP_COLUMN_2, TICTACTOE_DISP_ROW_2);*/ }
int ng_init(void *dev, int debug) { ng_dptr = dev; ng_dbit = debug; return display_init(DIS_NG, ng_scale, ng_dptr); }
int main() { bool newreadings; bool buttonschanged; load_init(); initsystem(); watchdog_init(); initserial(); timer_init(); display_init(); initfan(); adc_init(); buttons_init(); enableInterrupts(); protocol_onbooted(); while (1) { watchdog_kick(); newreadings = adc_updatereadings(); if (newreadings) { checkstate(); } buttonschanged = buttons_check(); if (newreadings || buttonschanged) { protocol_sendstate(); display_update(); } protocol_checkcommand(); } }
int main(int ac, char **av) { t_args option; if (ac < 5) return (usage(av[0])); signal(SIGINT, &signal_handler); signal(SIGPIPE, SIG_IGN); srand(time(NULL) + getpid()); init_args(&option); if (check_args(ac, av, &option) == false || check_all_args(&option) == false) return (usage(av[0])); display_init(&option); g_s.global_time = 0; g_s.id_egg = 1; g_s.other_size = 0; if ((g_s.sock = init_server(option.port)) == -1) return (display_error("Error : Could not init the server.\n")); printf("**** Initialization done\n"); init_map(&g_s, option.width, option.height); init_team(&g_s, option.nb_client, option.team_name); init_stone(&g_s, option.width * option.height); g_s.option = &option; server_loop(&g_s); xclose(g_s.sock); return (0); }
void board_init(void) { /* Configure the memory interface */ calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1); calypso_mem_cfg(CALYPSO_nCS1, 3, CALYPSO_MEM_16bit, 1); calypso_mem_cfg(CALYPSO_nCS2, 5, CALYPSO_MEM_16bit, 1); calypso_mem_cfg(CALYPSO_nCS3, 5, CALYPSO_MEM_16bit, 1); calypso_mem_cfg(CALYPSO_CS4, 0, CALYPSO_MEM_8bit, 1); calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1); calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0); /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */ calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2); /* Configure the RHEA bridge with some sane default values */ calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0); /* Initialize board-specific GPIO */ board_io_init(); /* Enable bootrom mapping to route exception vectors to RAM */ calypso_bootrom(1); calypso_exceptions_install(); /* Initialize interrupt controller */ irq_init(); /* initialize MODEM UART to be used for sercomm*/ uart_init(SERCOMM_UART_NR, 1); uart_baudrate(SERCOMM_UART_NR, UART_115200); /* Initialize IRDA UART to be used for old-school console code. * note: IRDA uart only accessible on C115 and C117 PCB */ uart_init(CONS_UART_NR, 1); uart_baudrate(CONS_UART_NR, UART_115200); /* Initialize hardware timers */ hwtimer_init(); /* Initialize DMA controller */ dma_init(); /* Initialize real time clock */ rtc_init(); /* Initialize system timers (uses hwtimer 2) */ timer_init(); /* Initialize LCD driver (uses I2C) and backlight */ display = &st7558_display; display_init(); bl_mode_pwl(1); bl_level(50); /* Initialize keypad driver */ keypad_init(1); /* Initialize ABB driver (uses SPI) */ twl3025_init(); }
void target_init(void) { uint32_t base_addr; uint8_t slot; dprintf(INFO, "target_init()\n"); spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID); target_keystatus(); if (target_use_signed_kernel()) target_crypto_init_params(); /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN dprintf(INFO, "Display Init: Start\n"); display_init(); dprintf(INFO, "Display Init: Done\n"); #endif /* Trying Slot 1*/ slot = 1; base_addr = mmc_sdc_base[slot - 1]; if (mmc_boot_main(slot, base_addr)) { /* Trying Slot 2 next */ slot = 2; base_addr = mmc_sdc_base[slot - 1]; if (mmc_boot_main(slot, base_addr)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } } }
void target_init(void) { dprintf(INFO, "target_init()\n"); spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID); /* Save PM8941 version info. */ pmic_ver = pm8x41_get_pmic_rev(); target_keystatus(); if (target_use_signed_kernel()) target_crypto_init_params(); /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN dprintf(INFO, "Display Init: Start\n"); if (board_hardware_subtype() != HW_PLATFORM_SUBTYPE_CDP_INTERPOSER) { display_init(); } dprintf(INFO, "Display Init: Done\n"); #endif /* * Set drive strength & pull ctrl for * emmc */ set_sdc_power_ctrl(); #if MMC_SDHCI_SUPPORT target_mmc_sdhci_init(); #else target_mmc_mci_init(); #endif }
int main(void) { /* Set up peripheral bus clock */ /* OSCCONbits.PBDIV = 1; */ OSCCONCLR = 0x100000; /* clear PBDIV bit 1 */ OSCCONSET = 0x080000; /* set PBDIV bit 0 */ /* Set up output pins */ AD1PCFG = 0xFFFF; ODCE = 0x0; TRISECLR = 0xFF; PORTE = 0x0; /* Output pins for display signals */ PORTF = 0xFFFF; PORTG = (1 << 9); ODCF = 0x0; ODCG = 0x0; TRISFCLR = 0x70; TRISGCLR = 0x200; /* Set up input pins */ TRISDSET = (1 << 8); TRISFSET = (1 << 1); /* Set up SPI as master */ SPI2CON = 0; SPI2BRG = 4; /* SPI2STAT bit SPIROV = 0; */ SPI2STATCLR = 0x40; /* SPI2CON bit CKP = 1; */ SPI2CONSET = 0x40; /* SPI2CON bit MSTEN = 1; */ SPI2CONSET = 0x20; /* SPI2CON bit ON = 1; */ SPI2CONSET = 0x8000; int i,c,k; display_init(); display_update(); for(i = 0;i<3;i++){ display_frommatrix(disco); for(c = 0;c<1000;c++){ quicksleep(10000); } display_frommatrixinv(tetris); for(k = 0;k<1000;k++){ quicksleep(10000); } } labinit(); /* Do any lab-specific initialization */ while(1) { labwork(); /* Do lab-specific things again and again */ } return 0; }
// common/keyboard.c invokes this when the keyboard is initialized. // This is our entry point. void matrix_init() { // To use PORTF disable JTAG with writing JTD bit twice within four cycles. MCUCR |= (1<<JTD); MCUCR |= (1<<JTD); // initialize row and col unselect_rows(); init_cols(); // initialize matrix state: all keys off for ( uint8_t i=0; i < MATRIX_ROWS; i++ ) { matrix[ i ] = (matrix_row_t) 0; matrix_debouncing[ i ] = (matrix_row_t) 0; } // Initialize LED control logic: led_init(); // Initialize the OLED display: #ifdef DISPLAY_ENABLE display_init(); #endif }
void TicTacToeDisplay_runTest() { display_init(); TicTacToeDisplay_init(); char number = buttons_read(); char read = number & HEX_F; char s_read = switches_read(); display_clearOldTouchData(); bool go = true; while(go) { s_read = switches_read(); number = buttons_read(); read = number & HEX_F; utils_msDelay(50); if(display_isTouched()) { utils_msDelay(50); display_clearOldTouchData(); if(display_isTouched()) TicTacToeDisplay_touchScreenComputeBoardRowColumn(&row, &column); if(s_read == 0x1) { TicTacToeDisplay_drawO(row, column);display_clearOldTouchData(); } else { TicTacToeDisplay_drawX(row, column);display_clearOldTouchData(); } display_clearOldTouchData(); } if((read & 0x1) == HEX_ONE) { TicTacToeDisplay_init(); } if((read & 0x2) == 0x02) { TicTacToeDisplay_complete(); go = false; } display_clearOldTouchData(); } }
int main(void) { //allow everything to settle/boot/etc //(mainly the mp3 chip takes a while to boot up) _delay_ms(2000); servo_init(); keypad_init(); display_init(); thermistor_init(); ssr_init(); init_timers(); mp3_init(); tea_off(); PMIC.CTRL |= PMIC_MEDLVLEN_bm | PMIC_LOLVLEN_bm | PMIC_HILVLEN_bm; sei(); //another 100 for things to settle _delay_ms(100); //welcome mp3_play(10); while (1) { char key; if ((key = keypad_getc())) handle_key(key); } }
int display_putc(int chr) { struct msg_head msg; int r; if(display_queid==0) { r=display_init(); if(r<0) return r; } msg.size=sizeof(struct msg_head); msg.service=DISPLAY_SRV_DISPLAY; msg.command=DISPLAY_CMD_PUTC; msg.arg=chr; for(;;) { r=message_send(display_queid, &msg); if(r!=ERRNO_OVER) break; syscall_wait(10); } if(r<0) { syscall_puts("putc sndcmd="); long2hex(-r,s); syscall_puts(s); syscall_puts("\n"); return r; } return 0; }
int main() { // init the display so we can draw on it! display_init(); // fill the display with black so it's all ready to have buttons drawn on it display_fillScreen(DISPLAY_BLACK); // Init all interrupts (but does not enable the interrupts at the devices). // Prints an error message if an internal failure occurs because the argument = true. interrupts_initAll(true); interrupts_setPrivateTimerLoadValue(TIMER_LOAD_VALUE); printf("timer load value:%ld\n\r", (int32_t) TIMER_LOAD_VALUE); u32 privateTimerTicksPerSecond = interrupts_getPrivateTimerTicksPerSecond(); printf("private timer ticks per second: %ld\n\r", privateTimerTicksPerSecond); interrupts_enableTimerGlobalInts(); // Initialization of the clock display is not time-dependent, do it outside of the state machine. // clockDisplay_init(); // Start the private ARM timer running. interrupts_startArmPrivateTimer(); // Enable interrupts at the ARM. interrupts_enableArmInts(); // The while-loop just waits until the total number of timer ticks have occurred before proceeding. while (interrupts_isrInvocationCount() < (TOTAL_SECONDS * privateTimerTicksPerSecond)); // All done, now disable interrupts and print out the interrupt counts. interrupts_disableArmInts(); printf("isr invocation count: %ld\n\r", interrupts_isrInvocationCount()); printf("internal interrupt count: %ld\n\r", isr_functionCallCount); return 0; }
void firmware() { display_init(); gfx_init_ctxt(&gfx_ctxt, display_init_framebuffer(), 720, 1280, 768); gfx_clear_color(&gfx_ctxt, 0xFF000000); gfx_con_init(&gfx_con, &gfx_ctxt); gfx_con_setcol(&gfx_con, DEFAULT_TEXT_COL, 0, 0); while (!sdMount()) { error("Failed to init SD card!\n"); print("Press POWER to power off, any other key to retry\n"); if (btn_wait() & BTN_POWER) i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF); btn_wait(); } if(PMC(APBDEV_PMC_SCRATCH49) != 69 && fopen("/ReiNX.bin", "rb")) { fread((void*)PAYLOAD_ADDR, fsize(), 1); fclose(); sdUnmount(); display_end(); CLOCK(CLK_RST_CONTROLLER_CLK_OUT_ENB_V) |= 0x400; // Enable AHUB clock. CLOCK(CLK_RST_CONTROLLER_CLK_OUT_ENB_Y) |= 0x40; // Enable APE clock. PMC(APBDEV_PMC_SCRATCH49) = 69; ((void (*)())PAYLOAD_ADDR)(); } SYSREG(AHB_AHB_SPARE_REG) = (volatile vu32)0xFFFFFF9F; PMC(APBDEV_PMC_SCRATCH49) = 0; print("Welcome to ReiNX %s!\n", VERSION); loadFirm(); drawSplash(); launch(); }
void target_init(void) { target_shutdown_for_rtc_alarm(); dprintf(INFO, "target_init()\n"); setup_fpga(); /* Setting Debug LEDs ON */ debug_led_write(0xFF); #if (!ENABLE_NANDWRITE) keys_init(); keypad_init(); #endif /* Display splash screen if enabled */ #if DISPLAY_SPLASH_SCREEN display_init(); dprintf(SPEW, "Diplay initialized\n"); display_image_on_screen(); #endif if (mmc_boot_main(MMC_SLOT, MSM_SDC1_BASE)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } }
int main(void) { // init clocks clock_init(); // init GPIO pin states gpio_init(); // init serial console console_init(); // wait for RTC to start up delay_ms(1000); // init RTC rtc_init(); // init calibration cal_init(); // init display (rtc_init(), cal_init() must must be called first!) display_init(); // call menu menu(); }
int main_alt() { Individual ind; ind.genInitial(); display_init(); std::ifstream fd("current.csv"); { std::string ign; fd >> ign; } ISSDraw model; { char ign; fd >> model.alpha; fd >> ign >> beta; fd >> ign >> model.yaw; fd >> ign >> ind.state[0].SARJ[0].a; fd >> ign >> ind.state[0].SARJ[1].a; for(int j = 0; j < 8; ++j) { fd >> ign >> ind.state[0].BGA[j].a; } } model.state = &ind.state[0]; while(handle_input()) frame(model); }
void target_init(void) { uint32_t base_addr; uint8_t slot; dprintf(INFO, "target_init()\n"); /* Initialize PMIC driver */ pmic.read = pa1_ssbi2_read_bytes; pmic.write = pa1_ssbi2_write_bytes; pm8921_init(&pmic); /* Keypad init */ keys_init(); keypad_init(); /* fbcon */ display_init(); /* Trying Slot 1 first */ slot = 1; base_addr = mmc_sdc_base[slot-1]; if(mmc_boot_main(slot, base_addr)) { /* Trying Slot 3 next */ slot = 3; base_addr = mmc_sdc_base[slot-1]; if(mmc_boot_main(slot, base_addr)) { dprintf(CRITICAL, "mmc init failed!"); ASSERT(0); } } }
cpu_state_t *cpu_load_state(const char *filename) { cpu_state_t *state = MALLOC(sizeof(cpu_state_t)); FILE *fp = FOPEN(filename, "rb"); int temp0, version; size_t temp1; temp0 = fscanf(fp, "GBEMU%d", &version); if(temp0 != 1) { log_error("%s is not a savestate.\n"); } if(version != VERSION) { log_warning("Timestamp of emulator does not match that of the save state.\n"); } temp0 = getc(fp); temp1 = fread(state->registers, sizeof(reg_t), NUM_REGISTERS, fp); X(pc); X(success); X(DI_Pending); X(EI_Pending); X(arg); X(clock_counter); X(halt); X(paused); X(step); X(frame_limit); X(slow); state->memory = memory_load_state(fp); state->display = display_init(state); fclose(fp); return state; }
int main(int argv, char **argc) { int i; sim_object_t * object; /*Create a sim_data object*/ sim_data_t* test_sim = sim_new(); sim_init(test_sim,1, 10, 192, 120); /*Create a display_state*/ display_state_t * state = calloc(1,sizeof(display_state_t)); /* memset(state, 0, sizeof(*state)); */ bcm_egl_openvg_init(state); display_init(state, 0); state->showfps = true; /* for(i = 0; i < 1000; i++) */ while(1) { sim_tick(test_sim); /*Pass to display and alter*/ display_draw(state, test_sim); /* for(i = 0; i < test_sim->size; i++) { object = test_sim->objects[i]; object->x += 1; object->y += 1; } */ } return EXIT_SUCCESS; }
int main ( void ) { /* Initialize all MPLAB Harmony modules, including application(s). */ char message[100]; SYS_Initialize ( NULL ); //set up accelerometer acc_setup(); //set up display display_init(); display_clear(); sprintf(message,"System Initialised!"); write_string(message,0,0); display_draw(); while ( true ) { /* Maintain state machines of all polled MPLAB Harmony modules. */ SYS_Tasks ( ); } /* Execution should not come here during normal operation */ return ( EXIT_FAILURE ); }
int main(void) { init(); alarm_init(); clock_init(); display_init(); sei(); for(;;) { clock_update(); buttons_update(); handle_buttons(); handle_display(); handle_led(); buttons_age(); clock_ticked = false; // Check display timeout if (mode != mode_off || status != status_none || !clock_set) { // Need the main clock set_sleep_mode(SLEEP_MODE_IDLE); } else { set_sleep_mode(SLEEP_MODE_PWR_SAVE); } sleep_enable(); sleep_cpu(); sleep_disable(); } }