Example #1
0
static enum piglit_result
init_other_display(EGLDisplay *out_other_dpy, EGLDisplay orig_dpy)
{
	enum piglit_result result = PIGLIT_PASS;
	EGLDisplay other_dpy = 0;
	int i;

	static const EGLint platforms[] = {
		EGL_PLATFORM_X11_EXT,
		EGL_PLATFORM_WAYLAND_EXT,
		EGL_PLATFORM_GBM_MESA,
		0,
	};

	for (i = 0; platforms[i] != 0; ++i) {
		result = init_display(platforms[i], &other_dpy);
		switch (result) {
		case PIGLIT_SKIP:
			break;
		case PIGLIT_PASS:
			if (other_dpy && other_dpy != orig_dpy) {
				*out_other_dpy = other_dpy;
				return PIGLIT_PASS;
			} else {
				result = PIGLIT_SKIP;
				break;
			}
		default:
			break;
		}
			
	}

	return result;
}
/************************************************************************
 * @brief 	main function	
 * @param[in]	None
 * @return		None
 ***********************************************************************/
int main(void)
{
	uint16_t i;
	uint16_t ReData;
	SystemInit();
	USART_Config();
	init_display ();

	USART1_Puts("This msg from USART1\n\r");
	USART2_Puts("This msg from USART2\n\r");
	
	
	while(1)
	{
#if 0	
		
		ReData = USART2_GetChar();
		//USART2_Puts((unsigned char*)ReData);
		USART_SendData(USART2, ReData);
		
#endif
		
#if 1
		
		
		USART2_Puts("*STS#");
		
		GLCD_displayStringLn(Line7, "Sending: *STS#");
		USART2_SmartCardGet(4); //updating data
		if (USART2_BufferCompare((uint8_t *)"*CP#", 4))
		{
			USART2_Puts("*R0802#");
			
			GLCD_displayStringLn(Line8, "Sending: *R0802#");
			USART2_SmartCardGet(12); //updating data
			if (USART2_BufferCompare((uint8_t *)"*RD08024344#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 1");
					//break;
				}
			
			if (USART2_BufferCompare((uint8_t *)"*RD08024142#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 2");
					//break;
				}
			
			if (USART2_BufferCompare((uint8_t *)"*RD08024143#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 3");
					//break;
				}
					
			}
#endif		
		}
}
Example #3
0
int16_t main(void) {
    init_clock();
    init_ui();
    init_pin();
    init_timer();
    init_i2c();
    InitUSB();
    init_oc();

    init_display(&i2c3, 0x70, 0x71);
    init_game(&timer1, &timer2, &A[0], &disp1, &disp2);
    init_gun(&D[13], &A[1], &A[2], &timer3);
    init_launcher(&D[5], &D[8], &D[3], &D[4]);
    init_shooter(&D[6], &D[9], &D[1], &D[2], &D[7], &D[0], &oc3, &oc4);
    init_baller(&D[10], &oc2, &timer4, &shooter, &launcher);
    init_pix(&D[11], &timer5, 30, 0.05);
    init_audio(&D[12]);

    uint8_t level = 0;
    uint8_t hit_flag = 0;
    while (1) {
        ServiceUSB(); // usb times out if not checked fast enough :/
        level = run_game(hit_flag);
        ServiceUSB();
        hit_flag = run_gun(level);
        ServiceUSB();
        run_baller(level);
    }
}
Example #4
0
/**
 * Setup state before each subtest begins.
 */
static enum piglit_result
test_setup(void)
{
	enum piglit_result result = PIGLIT_PASS;

	/* Just in case the previous test forgot to unset these pointers... */
	g_dpy = EGL_NO_DISPLAY;
	g_ctx = EGL_NO_CONTEXT;

	result = init_display(EGL_NONE, &g_dpy);
	if (result != PIGLIT_PASS) {
		goto cleanup;
	}


	result = init_context(g_dpy, &g_ctx);
	if (result != PIGLIT_PASS) {
		goto cleanup;
	}
	/* Ensure that a context is bound so that the test can create syncs. */
	eglMakeCurrent(g_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, g_ctx);

cleanup:
	if (result != PIGLIT_PASS) {
		test_cleanup(EGL_NO_SYNC_KHR, &result);
	}
	return result;
}
Example #5
0
File: lsc.c Project: wcheswick/ex
int
main(int argc, char *argv[]) {
	prog = argv[0];

	fps_flag = (getenv("FPS") != NULL);

	load_config("lsc");
	init_font_locale(lookup("locale", 0, 0));
	srandom(0);
	set_screen_size(SCREEN_WIDTH, SCREEN_HEIGHT);
	layout_screen();
	init_polar();
	init_transforms();
	init_video_in();
	init_display(argc, argv, prog);
	set_category(primary_buttons[Cat_change_color].b);
	gettimeofday(&last_busy, 0);

	ARGBEGIN {
	case 'd':	debug++;			break;
	case 'g':	grabtimeout = atoi(ARGF());	break;
	case 'i':	idletime = atoi(ARGF());	break;
	default:
		return usage();
	} ARGEND;

	if (grabtimeout != 0 && grabtimeout < ALARMTIME) {
		fprintf(stderr, "unreasonable grab time limit\n");
		exit(14);
	}

	state = Live;
	io_main_loop();
	return 0;
}
Example #6
0
void start_task(void)
{
        uint16_t dtycyl, adc_val;

        init_display();
        while(1) {
                adc_val = adc_read(0);
                dtycyl = duty_cycle(adc_val);
                if (red != dtycyl) {
                        red = dtycyl;
                        VT100_cur_pos(ROW_A, COL_A + 4);
                        printf("%04d", adc_val);
                        Timer1_set_dtcyl(red);
                }

                adc_val = adc_read(1);
                dtycyl = duty_cycle(adc_val);
                if (green != dtycyl) {
                        green = dtycyl;
                        VT100_cur_pos(ROW_B, COL_B + 4);
                        printf("%04d", adc_val);
                        Timer2_set_dtcyl(green);
                }

                adc_val = adc_read(2);
                dtycyl = duty_cycle(adc_val);
                if (blue != dtycyl) {
                        blue = dtycyl;
                        VT100_cur_pos(ROW_C, COL_C + 4);
                        printf("%04d", adc_val);
                        Timer0_set_dtcyl(blue);
                }

        }
}
Example #7
0
File: talk.c Project: 274914765/C
int main (int argc, char *argv[])
{
    int index;

    set_program_name (argv[0]);
    iu_argp_init ("talk", program_authors);
    argp_parse (&argp, argc, argv, 0, &index, NULL);

    argc -= index;
    argv += index;

    if (argc == 0)
    {
        printf ("Usage: talk user [ttyname]\n");
        exit (-1);
    }
    if (!isatty (0))
    {
        printf ("Standard input must be a tty, not a pipe or a file\n");
        exit (-1);
    }

    get_names (argc, argv);
    init_display ();
    open_ctl ();
    open_sockt ();
    start_msgs ();
    if (!check_local ())
        invite_remote ();
    end_msgs ();
    set_edit_chars ();
    talk ();
}
Example #8
0
File: main.c Project: geky/atoc-old
int main(int argc, char **argv) {
    int i, type = 0, delay = 1000;
    void (*display)(void);
    errno = 0;

    for (i=1; i<argc; i++) {
        if (!strcmp(argv[i], "-f")) {
            i++;

            if (strcmp(argv[i],"0"))
                delay = (int)(1000.0 / strtod(argv[i], 0));
            else
                delay = 0;
        } else if (!strcmp(argv[i], "-c")) {
            type = 1;
        } else if (!strcmp(argv[i]+strlen(argv[i])-3, ".ao")) {
            load_file(argv[i]);
        }        
    }

    signal(SIGINT, handle_kill);

    display = init_display(type, delay);
    run(display);

    exit(0);
}
Example #9
0
void			*main_rootine(void *param)
{
	time_t	t1;
	time_t	t2;
	WINDOW	*info;
	WINDOW	*graph;
	WINDOW	*philo[NB_PHILO + 2];

	(void)param;
	time(&t1);
	time(&t2);
	init_display();
	while (no_philo_dead() && (t2 - t1 <= TIMEOUT))
	{
		initndisplay_graph(&graph, &info);
		init_philo_win(philo, graph);
		display_info(&info);
		display_philo(philo, 0);
		time(&t2);
	}
	finish(philo);
	if (no_philo_dead())
		ft_putendl(WIN_MESSAGE);
	else
		ft_putendl("You lose");
	return (NULL);
}
Example #10
0
Bool glXMakeCurrent(Display *display,
                    int drawable,
                    GLXContext context) {

    if (eglDisplay != NULL) {
        eglMakeCurrent(eglDisplay, NULL, NULL, EGL_NO_CONTEXT);
        if (eglSurface != NULL) {
            eglDestroySurface(eglDisplay, eglSurface);
        }
    }
    // call with NULL to just destroy old stuff.
    if (! context) {
        return true;
    }
    if (eglDisplay == NULL) {
        init_display(display);
    }

    if (g_usefb)
        drawable = 0;
    eglSurface = eglCreateWindowSurface(eglDisplay, eglConfigs[0], drawable, NULL);
    CheckEGLErrors();

    EGLBoolean result = eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
    CheckEGLErrors();
    if (result) {
        return true;
    }
    return false;
}
Example #11
0
static void x11video_init(MSFilter  *f){
	X11Video *obj=(X11Video*)ms_new0(X11Video,1);
	MSVideoSize def_size;
	def_size.width=MS_VIDEO_SIZE_CIF_W;
	def_size.height=MS_VIDEO_SIZE_CIF_H;
	obj->local_msg=NULL;
	obj->corner=0;
	obj->scale_factor=SCALE_FACTOR;
	obj->background_color[0]=obj->background_color[1]=obj->background_color[2]=0;
	obj->sws2=NULL;
	obj->own_window=FALSE;
	obj->auto_window=TRUE;
	obj->ready=FALSE;
	obj->autofit=TRUE;
	obj->mirror=FALSE;
	obj->display=init_display();
	obj->vsize=def_size; /* the size of the main video*/
	obj->lsize=def_size; /* the size of the local preview*/
	obj->wsize=def_size; /* the size of the window*/
	obj->show=TRUE;
	obj->port=-1;
	f->data=obj;

	XSetErrorHandler(x11error_handler);
}
Example #12
0
int main(int argc, char **argv) {

	int result,i;
	int i2c_fd;

	i2c_fd=init_i2c("/dev/i2c-1");
	if (i2c_fd < 0) {
		fprintf(stderr,"Error opening device!\n");
		return -1;
	}

	/* Init display */
	if (init_display(i2c_fd,HT16K33_ADDRESS0,10)) {
		fprintf(stderr,"Error opening display\n");
		return -1;
	}

	result=load_font("tbfont.tb1");

	while(1) {
		for(i=32;i<127;i++) {
			result=put_letter(i,i2c_fd);
			usleep(500000);
		}
	}

	return result;
}
Example #13
0
int				menu_over(t_game *g)
{
	int		key;

	init_display();
	wrefresh(stdscr);
	g->display_choose = 0;
	draw_menu(g);
	while ((key = getch()))
	{
		if (key == 10 && g->display_choose == 0)
		{
			retry(g);
			ft_init_map(g);
			return (endwin(), 1);
		}
		if (key == 10 && g->display_choose == 1)
			menu_hightscores(g);
		if (key == 10 && g->display_choose == 2)
			return (endwin(), 0);
		func_choose(g, key);
		draw_menu(g);
	}
	return (1);
}
Example #14
0
void SessionRep::init(
    const char* name, int& argc, char** argv,
    const OptionDesc* opts, const PropertyData* initprops, Display* display
) {
    argc_ = argc;
    argv_ = new char*[argc + 1];
    for (int i = 0; i < argc; i++) {
	argv_[i] = argv[i];
    }
    argv_[argc_] = nil;

    init_style(name, initprops);
    if (opts != nil) {
	parse_args(argc, argv, opts);
    }
    parse_args(argc, argv, defoptions);
    init_display(display);

    Cursor::init();

#ifdef sgi
    if (style_->value_is_on("malloc_debug")) {
	mallopt(M_DEBUG, 1);
    }
#endif
}
Example #15
0
static int blob_process(uint8_t* frame, int width, int height, int size)
{
	init_display(width, height);

	if (!initialized || process_changed) {
		blob.setGraphics(true);
		blob.setGraphicsThickness(2);
		initialized = true;
		process_changed = false;
	}

	prepare_display(frame, width, height, size);

	//compute blob
	if (!init_track) {
		blob.initTracking(*grey_img, germ);
		init_track = true;
	}
	else {
		blob.track(*grey_img);
	}

	int bat = jakopter_com_read_int(com_in, 0);
	std::ostringstream bat_str;
	bat_str << bat;
	vpDisplay::displayText(*display_img, (int)display_img->getHeight()-25, 10,
		"Battery : " + bat_str.str() + " %%", vpColor::red);

	vpDisplay::flush(*display_img);
	return 0;
}
Example #16
0
int main()
{
// seed the RNG.  TODO: wrap this
  srand(time(NULL));

// Start up our display (e.g. ncurses)
  init_display();

// Init the game data!
  if (!init_all_data()) {
    debugmsg("Failed to init data!");
    return 1;
  }

  if (!set_directories()) {
    debugmsg("Failed to set directories!");
    return 1;
  }

// Set up a game.
  GAME = new Game;

  Interface interface;
  interface.init();

  if (interface.starting_screen()) {
    interface.main_loop();
  }

  endwin();
  return 0;
}
Example #17
0
int
main(int argc, char *argv[])
{
	if (pledge("stdio rpath inet dns getpw tty", NULL) == -1)
		err(1, "pledge");

	get_names(argc, argv);
	init_display();
	open_ctl();
	open_sockt();
	start_msgs();
	if (!check_local())
		invite_remote();
	end_msgs();
	set_edit_chars();

	if (his_machine_addr.s_addr == my_machine_addr.s_addr) {
		if (pledge("stdio tty", NULL) == -1)
			err(1, "pledge");
	} else {
		if (pledge("stdio inet tty", NULL) == -1)
			err(1, "pledge");
	}

	talk();
	return (0);
}
Example #18
0
/**
 * \brief Main entry of example application
 */
int main(void)
{
	/* Variable to store the last winner */
	uint8_t winner;

	system_init();
	delay_init();
	gfx_mono_init();

	init_buttons();
	init_display();

	/* Start game */
	while (true) {
		winner = 0;
		/* Wait for button interaction */
		while (get_button() == BUTTON_NONE) {
		}
		/* Draw empty board */
		setup_board();

		/* Start playing */
		for (int i = 0; i < 5; i++) {
			/* User's turn */
			user_turn();

			/* Check if the game is over */
			winner = we_have_a_winner();
			if (winner || i == 4) {
				break;
			}

			/* Add a delay for the opponent to "think" */
			delay_ms(500);
			/* Opponent's turn */
			opponent_turn();

			/* Check if the game is over */
			winner = we_have_a_winner();
			if (winner) {
				break;
			}
		}

		/* Game over, print winner and get ready for restart */
		if (winner == 1) {
			/* User won */
			gfx_mono_draw_string("You won!", STRING_X, 0, &sysfont);
			wins++;
		} else if (winner == 2) {
			gfx_mono_draw_string("You lost!", STRING_X, 0, &sysfont);
		} else {
			gfx_mono_draw_string("No winner!", STRING_X, 0, &sysfont);
		}

		gfx_mono_draw_string("Press a button", STRING_X, SQUARE3_Y, &sysfont);
		games++;
	}
}
Example #19
0
int main(int argc, char* argv[])
{
    init_display();
    init_std_threads();
    init_servo();
    shutdown_std_threads();

    return 0;
}
Example #20
0
void new_game(void) {
	char c = 0;
	cancel_software_timer(foodTimerNum);
	cancel_software_timer(ratsTimerNum);
	empty_display();

	//wait for space
	while(c != ' ' && c != 'l' && c != 'L'){
		if(input_available())
			c = fgetc(stdin);

		if(c == 'M' || c == 'm'){
			toggle_sound();
			display_sound_status();
			c = 0;
		}
	}
	
	init_display();
	
	if(c == 'l' || c == 'L'){
		if(load_state())
			render_board();
		else {
			/* Initialise internal representations. */
			init_board();
			init_score();
		}
	}
	else {
		/* Initialise internal representations. */
		init_board();
		init_score();
	}
	clear_terminal();

	//Place scores
	update_score();

	//place sound status
	display_sound_status();

	show_instruction(PLAYING);

	/* Make food blink 5 times a second. We should call blink_food
	** 10 times a second which is 100ms
	*/
	foodTimerNum = execute_function_periodically(BLINKRATE, blink_food);
	ratsTimerNum = execute_function_periodically(RATSPEED, move_rats);

	/* Debug *
	move_cursor(0, TITLEY-1);
	printf_P(PSTR("new_game %u"), get_score());
	wait_for(1000);
	//*/
}
Example #21
0
int main(int argc, char *argv[])
{
    init_display(&argc, &argv);
    init();
    
    gtk_widget_show(main_wnd);
    
    gtk_main();
    return 0;
}
Example #22
0
void main(int argc, char **argv)
{
  MyProgram mydata;

  InitDatabase(&mydata);

  init_display(argc, argv, &mydata);  /* setup the display */

  MainLoop();                         /* go right into the main loop */
}
Example #23
0
void sys_init(void)
{
#if defined(UART_ENABLE)
    uart_init();
    deg_str("power on\n");
#endif
    SYS_POWER_OFF();	

    core_power_on();
    OTP_CLK_DIV2();
    DECODER_DIV2();
    SYSTEM_CLK_DIV4();
#if (NO_DISP != monitor)
    init_display();
#endif
    sd_speed_init(0,100);

//#if SDMMC_CMD_MODE
//    sd_chk_ctl(SET_SD_H_CHK);
//#endif
    init_port_sd();
    //kv_init(); ///按键音初始化函数

#if RTC_ENABLE
    rtc_init();			//RTC初始化,检测是否闹钟开机
    //{
        //work_mode = RTC_MODE;
    //}
#else
    {
        u8 rtc_reg = read_rtc_reg();
        if (rtc_reg & BIT(7))					//检测是否掉电
        {
            rtc_reg &= ~BIT(7); 				//清零PDFLAG
            write_rtc_reg(rtc_reg);
#if USE_RTC_RAM
            reset_rtc_ram();
#endif
        }
    }
#endif

    SYS_POWER_OFF();	
    key_init();
    bsp_init();
    SYS_POWER_OFF();	
    //interrupt_init(15, rtcisr);
    interrupt_init(3, timer3isr);
    interrupt_init(0, timer0isr);
#if defined(BLUE_TOOTH_UART_FUNC)
    interrupt_init(7, uart_isr);
#endif
    enable_interrupt();
   /// flashled(3);
}
Example #24
0
void start_game()
{
	seed_rng();

	load_data("config.txt");
	load_data("Data/FFCG.txt");
	
	init_display();

	message(
"Welcome to Final Fantasy!   Copyright 1985, Peter Deal & Ron Keating.");
	message("Would you like to (B)egin a new game, or (R)estore an old one?");

	int ch;

	do 
	{
		ch = _getch(INPUT_START);

		switch(ch)
		{
		case 'b':
		case 'B':
			Party.create();
			Dungeon.push_back(CDungeon(DOM_OVERWORLD, FEA_DUNGEON));
			set_new_savefile();
			Party.describe_location();
			break;

		case 'r':
		case 'R':
			if (restore_game())
			{
				Party.describe_location();
			}
			else
			{
				message(
"Couldn't find any savefiles!  Press (B) to begin a new game.");
				ch = KEY_ACCEPT;
			}
			break;

		default:
			ch = KEY_ACCEPT;
			break;
		}
	} while (ch == KEY_ACCEPT);

	time(&Party.start_time);

	message("Press ? for a list of commands.");

	Party.draw(rightWindow);
}
Example #25
0
int				display(t_context *c)
{
	move_myass(c, c->keyboard);
	init_display(c);
	draw_flush_image(c->x, c->x->img);
	display_stats(c);
	mlx_put_image_to_window(c->x->mlxptr, c->x->winptr,
		c->map.tex[1].img,
		(c->x->width / 2) - c->map.tex[1].width / 2,
		c->x->height - c->map.tex[1].height);
	return (0);
}
int main( int argc, char** argv )
{
	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
	Player *pPlayer = player_new();
	player_set_decoder( pPlayer, init_decoder() );
	player_set_display( pPlayer, init_display() );
	SDL_CreateThread( player_play, pPlayer );
	player_run( pPlayer );
	_CrtDumpMemoryLeaks();
	getchar();
	return 0;
}
Example #27
0
static void init () {
  /* Add System initialisation code here */

  init_io ();
  init_display ();
  init_TcpNet ();

  /* Setup and enable the SysTick timer for 10ms. */
  SystemCoreClockUpdate();
  SysTick->LOAD = (SystemCoreClock / 100) - 1;
  SysTick->CTRL = 0x05;
}
Example #28
0
int main(void) {

	init_buttons();
	init_leds();
	init_display(intensity);
	init_uart();

	uart_interrupt_enable();

	sei();

	// main loop
	while(1) {

		// while button 1 is pressed, increment display brightness (mod 16)
		uint8_t button_status = debounce(&BUTTON0_PIN, BUTTON0);
		if(button_status == 1) {
			intensity = (intensity + 1) % 16;
			set_register_b(REG_INTENSITY, intensity);
		} else if(button_status == 2) {
			LIGHT_PORT ^= (1<<LIGHT);
		}

		// if timer is stopped (but not yet resetted) ...
		if(state == 'S') {
			
			// ... and button 0 has been pressed (and released),
			// save the current time in the times array (only once!)
			if(debounce(&BUTTON1_PIN, BUTTON1) && !time_already_saved) {
				uart_interrupt_disable();
				append(times, TIMES, last_correct_decoded_time);
				led_blink(2);
				time_already_saved = 1;
				uart_interrupt_enable();
			}

		}

		// if timer has been stopped or reset ...
		if(state == 'I' || state == 'S') {

			// ... and button 0 is pressed, show the current average
			if(!(BUTTON2_PIN & (1<<BUTTON2))) {
				uart_interrupt_disable();
				display_uint16_time(average());
				my_delay_ms(1500);
				while(!(BUTTON2_PIN & (1<<BUTTON2)));
				uart_interrupt_enable();
			}

		}
	}
}
Example #29
0
int main(void) {
	device_init();
	init_display();

	PIO_Set(&display_pins[0]);
	PIO_Clear(&display_pins[1]);
	PIO_Clear(&display_pins[2]);
	PIO_Set(&display_pins[3]);
	while(1){

	}
}
Example #30
0
static void glxvideo_init(MSFilter	*f){
	GLXVideo *obj=(GLXVideo*)ms_new0(GLXVideo,1);
	MSVideoSize def_size;
	def_size.width=MS_VIDEO_SIZE_CIF_W;
	def_size.height=MS_VIDEO_SIZE_CIF_H;
	obj->display=init_display();
	obj->own_window=FALSE;
	obj->ready=FALSE;
	obj->vsize=def_size; /* the size of the main video*/
	obj->wsize=def_size; /* the size of the window*/
	obj->show=TRUE;
	f->data=obj;
}