/* $Id$ * $URL$ * * LUIse lcd4linux driver * * Copyright (C) 2005 Theo Schneider * Copyright (C) 2005 The LCD4Linux Team * * This file is part of LCD4Linux. * * LCD4Linux is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * * exported fuctions: * * struct DRIVER drv_LUIse * */ #include "config.h" #include #include #include #include #include #include #include "debug.h" #include "cfg.h" #include "qprintf.h" #include "udelay.h" #include "plugin.h" #include "drv.h" #include "drv_generic_graphic.h" static char Name[] = "LUIse"; /* default Wert */ static int devNum = 0; /****************************************/ /*** hardware dependant functions ***/ /****************************************/ static void drv_LUIse_clear(void) { unsigned char buf[9600]; int x; // clear text LUI_Text(devNum, 0, 0, 320, 240, 0, 0, 1, 1, ""); // clear picture for (x = 0; x < 9600; x++) buf[x] = 0x00; LUI_Bitmap(devNum, 0, 0, 0, 0, 0, DCOLS, DROWS, DCOLS, DROWS, buf); LUI_Bitmap(devNum, 1, 0, 0, 0, 0, DCOLS, DROWS, DCOLS, DROWS, buf); } static void drv_LUIse_blit(const int row, const int col, const int height, const int width) { int r, c; for (r = row; r < row + height; r++) { for (c = col; c < col + width; c++) { if (drv_generic_graphic_black(r, c)) { LUI_SetPixel(devNum, 0, c, r, 1); } else { LUI_SetPixel(devNum, 0, c, r, 0); } } } } static int drv_LUIse_contrast(int contrast) { /* adjust limits according to the display */ if (contrast < 0) contrast = 0; if (contrast > 255) contrast = 255; LUI_SetContrast(devNum, contrast); return contrast; } static int drv_LUIse_backlight(int backlight) { if (backlight < 0) backlight = 0; if (backlight > 1) backlight = 1; LUI_CCFL(devNum, backlight); return backlight; } /* start graphic display */ static int drv_LUIse_start(const char *section) { char *s; int gfxmode, gfxinvert, ScreenRotation, IOrefresh; int contrast, backlight; /* read devNum from config */ s = cfg_get(section, "DeviceNum", 0); if (s == NULL || *s == '\0') { error("%s: no '%s.DeviceNum' entry from %s", Name, section, cfg_source()); return -1; } if (sscanf(s, "%d", &devNum) < 0 || devNum > 4) { error("%s: bad DeviceNum '%s' from %s", Name, s, cfg_source()); return -1; } info("%s: using DeviceNum '%d'", Name, devNum); /* open communication with the display */ if (LUI_OpenDevice(devNum) > 0) { error("unable to open DeviceNum: %d", devNum); return -1; } /* * 0 : gfxmode 0 = or, 1 = and, 2 = xor * 0 : gfxinvert 0 = normal, 1 = invert * 0 : ScreenRotation 0 =, 1 =, 2 =, 3 =, * 2 : IOrefresh 0 = 25ms...255=256*25ms */ s = cfg_get(section, "Mode", "0.0.0.2"); if (s == NULL || *s == '\0') { error("%s: no '%s.Mode' entry from %s", Name, section, cfg_source()); return -1; } if (sscanf(s, "%d.%d.%d.%d", &gfxmode, &gfxinvert, &ScreenRotation, &IOrefresh) != 4 || gfxmode < 0 || gfxmode > 2 || gfxinvert < 0 || gfxinvert > 1 || ScreenRotation < 0 || ScreenRotation > 255 || IOrefresh < 0 || IOrefresh > 255) { error("%s: bad Mode '%s' from %s", Name, s, cfg_source()); return -1; } if (LUI_LCDmode(devNum, gfxmode, gfxinvert, ScreenRotation, IOrefresh) > 0) { error("Error LUI_LCDmode"); return -1; } switch (ScreenRotation) { case 0:{ DCOLS = 320; DROWS = 240; break; } case 1:{ DCOLS = 240; DROWS = 320; break; } case 2:{ DCOLS = 320; DROWS = 240; break; } case 3:{ DCOLS = 240; DROWS = 320; break; } } s = cfg_get(section, "Font", "6x8"); if (s == NULL || *s == '\0') { error("%s: no '%s.Font' entry from %s", Name, section, cfg_source()); return -1; } XRES = -1; YRES = -1; if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) { error("%s: bad Font '%s' from %s", Name, s, cfg_source()); return -1; } /* Fixme: provider other fonts someday... */ if (XRES != 6 && YRES != 8) { error("%s: bad Font '%s' fr
/*
 * driver for display modules from Crystalfontz
 *
 * Copyright 2000 by Herbert Rosmanith (herp@wildsau.idv.uni-linz.ac.at)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


/* see: 634full.pdf, avail. from www.crystalfontz.com
 * values here are octal
 */

#define	CRYFON_NULL			"\000"
#define	CRYFON_CURSOR_HOME		"\001"
#define	CRYFON_HOME			CRYFON_CURSOR_HOME
#define	CRYFON_HIDE_DISPLAY		"\002"
#define	CRYFON_RESTORE_DISPLAY		"\003"
#define	CRYFON_HIDE_CURSOR		"\004"
#define	CRYFON_SHOW_UL_CURSOR		"\005"
#define	CRYFON_SHOW_BLK_CURSOR		"\006"
#define	CRYFON_SHOW_INV_CURSOR		"\007"
#define	CRYFON_BACKSPACE		"\010"
/*not used: 9 (tab), 011 octal */
#define	CRYFON_LF			"\012"
#define	CRYFON_DEL_IN_PLACE		"\013"
#define	CRYFON_FF			"\014"
#define	CRYFON_CR			"\015"
#define	CRYFON_BACKLIGHT_CTRL		"\016"
#define	CRYFON_CONTRAST_CTRL		"\017"
/*not used: 16, 020 octal */
#define	CRYFON_SET_CURSOR_POS		"\021"
#define	CRYFON_GOTO			CRYFON_SET_CURSOR_POS
#define	CRYFON_HORIZONTAL_BAR		"\022"
#define	CRYFON_SCROLL_ON		"\023"
#define	CRYFON_SCROLL_OFF		"\024"
#define	CRYFON_SET_SCROLL_MARQU		"\025"
#define	CRYFON_ENABLE_SCROLL_MARQU	"\026"
#define	CRYFON_WRAP_ON			"\027"
#define	CRYFON_WRAP_OFF			"\030"
#define	CRYFON_SET_CUSTOM_CHAR_BITMAP	"\031"
#define	CRYFON_REBOOT			"\032"
#define	CRYFON_ESC			"\033"
#define	CRYFON_LARGE_BLK_NUM		"\034"
/*not used: 29, 035 octal*/
#define	CRYFON_SEND_DATA_DIRECT		"\036"
#define	CRYFON_SHOW_INFO		"\037"
#define	CRYFON_CUST_CHAR0		"\200"
#define	CRYFON_CUST_CHAR1		"\201"
#define	CRYFON_CUST_CHAR2		"\202"
#define	CRYFON_CUST_CHAR3		"\203"
#define	CRYFON_CUST_CHAR4		"\204"
#define	CRYFON_CUST_CHAR5		"\205"
#define	CRYFON_CUST_CHAR6		"\206"
#define	CRYFON_CUST_CHAR7		"\207"