Ejemplo n.º 1
0
int main(){

	printf("Lcd driver and lib demo\n");

	display = get_display();
	if (display == NULL) {
		printf("Failed to get display\n");
		return -1;
	}

	disable_waiting_for_enter();

	build_vars();
	intro_animation();

	char key = 0;
	int position = 0;

	while(running){
		position = menu_selection(position);
	}
	clear_screen();

	restore_terminal_settings();
	release_display(display);
}
Ejemplo n.º 2
0
int main(){
	printf("Get display\n");

	display = get_display();

	if (display == NULL) {
		printf("Failed to get display\n");
		return -1;
	}

	//lcd_load_bmp("blani.bmp", display);
	lcd_load_bmp("blani.bmp", display);
	getc(stdin);
	lcd_set_bmp(0,0,display);
	getc(stdin);

	lcd_backlight(LCD_OFF, display);
	getc(stdin);
	lcd_backlight(LCD_ON, display);
	getc(stdin);
	lcd_sleep(LCD_ON, display);
	getc(stdin);
	lcd_sleep(LCD_OFF, display);
	getc(stdin);
	lcd_onoff(LCD_OFF, display);
	getc(stdin);
	lcd_onoff(LCD_ON, display);
	getc(stdin);

	printf("Lcd rect\n");
	lcd_set_rect(20, 20, 50, 50, NOFILL, WHITE, display);
	getc(stdin);
	lcd_set_rect(20, 60, 50, 90, NOFILL, RED, display);
	getc(stdin);
	lcd_set_rect(60, 20, 90, 50, NOFILL, BLUE, display);
	getc(stdin);
	lcd_set_rect(60, 60, 90, 90, NOFILL, ORANGE, display);
	getc(stdin);
//	printf("Lcd pixel\n");
//	lcd_set_pixel(100, 100, WHITE, display);

	lcd_set_line(2,0, 20, 78, RED, display);
	getc(stdin);
	lcd_set_line(30,19, 98, 34, BLUE, display);
	getc(stdin);
	lcd_set_line(129,129, 20, 60, GREEN, display);
	getc(stdin);
	lcd_put_str("Test str 1\n", 10, 10, SMALL, YELLOW, display);
	getc(stdin);
	lcd_put_str("Test str 2\n", 30, 10, MEDIUM, GREEN, display);
	getc(stdin);
	lcd_put_str("Test str 3\n", 50, 10, LARGE, ORANGE, display);
	getc(stdin);

	printf("Release display\n");
	release_display(display);
}
/******************************************************************************
 * Example to show vid1 in YUV format,OSD0 in RGB565 format
 *  and OSD1 is attribute format.
 ******************************************************************************/
static int vpbe_UE_1(void)
{
	int ret = 0;
	v4l2_std_id cur_std;

	DBGENTER;

	/* Setup Capture */
	if (initialize_capture(&cur_std) < 0) {
		printf("Failed to intialize capture\n");
		return ret;
	}

	/* Setup Display */
	if (cur_std & V4L2_STD_NTSC) {
		if (change_sysfs_attrib(ATTRIB_OUTPUT, DISPLAY_INTERFACE_COMPOSITE))
			return FAILURE;
		if (change_sysfs_attrib(ATTRIB_MODE, DISPLAY_MODE_NTSC))
			return FAILURE;
		file_size = WIDTH_NTSC * HEIGHT_NTSC * 2;
	}
	else if (cur_std & V4L2_STD_PAL) {
		if (change_sysfs_attrib(ATTRIB_OUTPUT, DISPLAY_INTERFACE_COMPOSITE))
			return FAILURE;
		if (change_sysfs_attrib(ATTRIB_MODE, DISPLAY_MODE_PAL))
			return FAILURE;
		file_size = WIDTH_PAL * HEIGHT_PAL * 2;
	}
	else if (cur_std & V4L2_STD_720P_60) {
		if (change_sysfs_attrib(ATTRIB_OUTPUT, DISPLAY_INTERFACE_COMPONENT))
			return FAILURE;
		if (change_sysfs_attrib(ATTRIB_MODE, DISPLAY_MODE_720P))
			return FAILURE;
		file_size = WIDTH_720P * HEIGHT_720P * 2;
	}
	else if (cur_std & V4L2_STD_1080I_60) {
		if (change_sysfs_attrib(ATTRIB_OUTPUT, DISPLAY_INTERFACE_COMPONENT))
			return FAILURE;
		if (change_sysfs_attrib(ATTRIB_MODE, DISPLAY_MODE_1080I))
			return FAILURE;
		file_size = WIDTH_1080I * HEIGHT_1080I * 2;
	} else {
		printf("Cannot display this standard\n");
		return FAILURE;
	}

	/* Setup VID1 output */
	if ((init_vid1_device(cur_std)) < 0) {
		printf("\nFailed to init vid1 window ");
		return FAILURE;
	}
	
	ret = start_loop();
	if (ret)
		printf("\tError: Video loopback had some errors\n");
	printf("Video loopback completed successfully\n");

	/*
	 * Once the streaming is done  stop the display
	 * hardware
	 */
	printf(" Test STREAM_OFF - \n");
	ret = stop_display(fd_vid1);
	if (ret < 0) {
		printf("\tError: Could not stop display\n");
		return ret;
	}

	/* Release display channel */
	printf(" Test buffer unmapping & closing of device - \n");
	release_display(&fd_vid1);

	ret = stop_capture(fdCapture);
	if (ret < 0)
		printf("Error in VIDIOC_STREAMOFF:capture\n");

	release_capture(&fdCapture);
	close(fd_osd0);
	printf("DONE ALL\n\n\n");

	DBGEXIT;
	return ret;
}
Ejemplo n.º 4
0
/*
 * APOLLO_init
 *
 *	initialises window to occupy current window
 */
APOLLO_init()
{
	pad_$window_desc_t 	window;
	int 	size, prefx, prefy, prefxs, prefys, x, y, w, h;
	short 	i;

	pad_$set_scale(stream_$stdout,
		       1,
		       1,
		       status);

	pad_$inq_windows(stream_$stdout,
			 window_info,
				  10,
			   n_windows,
			     status);

	w = window_info[0].width;
	h = window_info[0].height;
	x = window_info[0].left;
	y = window_info[0].top;

	getprefposandsize(&prefx, &prefy, &prefxs, &prefys);

	if (prefx > -1) {
		x = prefx;
		y = prefy;
	}

	if (prefxs > -1) {
		w = prefxs;
		h = prefys;
	}

	size = MIN(w, h);
	vdevice.sizeX = vdevice.sizeY = size - 1;
	vdevice.sizeSx = w - 1;
	vdevice.sizeSy = h - 1;

        init_bitmap_size.x_size = w;
        init_bitmap_size.y_size = h;

	source.window_base.x_coord = source.window_base.y_coord = 0;
	source.window_size.x_size = init_bitmap_size.x_size;
	source.window_size.y_size = init_bitmap_size.y_size;
	dest_pos.x_coord = dest_pos.y_coord = 0;

	/*
	 * Inquire about the actual display ....
	 */

	gpr_$inq_disp_characteristics(mode,
				      stream_$stdout,
				      (short)60,
				      disp,
				      disp_len,
				      status);

	vdevice.depth = disp.n_planes;
	hi_plane_id = disp.n_planes - 1;

	if (prefx == -1 && prefxs == -1) {
		stream_id = stream_$stdout;
	} else {
		window.top = y;
		window.left = x;
		window.width = w;
		window.height = h;

		pad_$create_window("", 0,
				pad_$transcript, 
				1, 
				window,
				stream_id,
				status
		);

		pad_$set_auto_close(stream_id, 1, true, status);
	}

        gpr_$init(mode,
                  stream_id,
                  init_bitmap_size,
                  hi_plane_id,
                  front_bitmap,
                  status);

	current_bitmap = front_bitmap;

	gpr_$set_auto_refresh(true, status);
  
	gpr_$set_cursor_active(false,status);

	/*  Set up all the character stuff  */

	first_time = 1;

	/*  create a key set for the event interupts  */

	lib_$init_set(keys, (short)256);
	lib_$init_set(mouse_keys, (short)6);

	lib_$add_to_set(mouse_keys, (short)6, KBD_$M1D);
	lib_$add_to_set(mouse_keys, (short)6, KBD_$M2D);
	lib_$add_to_set(mouse_keys, (short)6, KBD_$M3D);
	lib_$add_to_set(mouse_keys, (short)6, KBD_$M1U);
	lib_$add_to_set(mouse_keys, (short)6, KBD_$M2U);
	lib_$add_to_set(mouse_keys, (short)6, KBD_$M3U);

	for (i = 0; i < 128; i++) 
		lib_$add_to_set(keys, (short)256, (short)i);

	gpr_$enable_input(gpr_$keystroke, keys, status);
	gpr_$enable_input(gpr_$buttons, keys, status);
	gpr_$enable_input(gpr_$locator, keys, status);

	/*  set default color (colour)   */

	if (disp.n_planes > 1) {
		gpr_$inq_color_map(0L, (short)MAXCOLORS, old_color_value, status);
		gpr_$inq_color_map(0L, (short)MAXCOLORS, color_value, status);

		color_value[0] = COLOR_ENTRY(0,0,0);         /* color--black   */
		color_value[1] = COLOR_ENTRY(255,0,0);       /* color--red     */
		color_value[2] = COLOR_ENTRY(0,255,0);       /* color--green   */
		color_value[3] = COLOR_ENTRY(255,255,0);     /* color--yellow  */
		color_value[4] = COLOR_ENTRY(0,0,255);       /* color--blue    */
		color_value[5] = COLOR_ENTRY(255,0,255);     /* color--magenta */
		color_value[6] = COLOR_ENTRY(0,255,255);     /* color--cyan    */
		color_value[7] = COLOR_ENTRY(255,255,255);   /* color--white   */

		/* modify color table */
		gpr_$acquire_display(status);
		gpr_$set_color_map((long)0,
				    (short)MAXCOLORS,
				    color_value,
				    status);
		gpr_$release_display(status);
	}

	back_used = 0;

	return(1);
}