[Lcdproc] LCDproc patch for Samsung,20S206DA6 & 20S207DA4

Peter Schumann kaputnik@wh2.tu-dresden.de
Mon Jan 14 14:03:02 2008


This is a multi-part message in MIME format.
--------------090704020607020603020200
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

Hello,

I've wrote an patch to make the custom characters for the Samsung
20S206DA6 & 20S207DA4 work properly. It's in basic the same as the
serialVFD - Futaba type.

These displays have 16 user def. chars I had not tried them all but I
think is should work.

Maybe some one add it to the CVS

Greets Peter


--------------090704020607020603020200
Content-Type: text/x-patch;
 name="lcdproc_samsung_custchar.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="lcdproc_samsung_custchar.patch"

diff -Naur ./lcdproc.old/server/drivers/serialVFD.c ./lcdproc/server/drivers/serialVFD.c
--- ./lcdproc.old/server/drivers/serialVFD.c	2008-01-12 00:25:00.000000000 +0100
+++ ./lcdproc/server/drivers/serialVFD.c	2008-01-11 23:51:21.000000000 +0100
@@ -198,8 +198,8 @@
 
 	/* Which displaytype */
 	tmp = drvthis->config_get_int(drvthis->name, "Type", 0, DEFAULT_DISPLAYTYPE);
-	if ((tmp < 0) || (tmp > 3)) {
-		report(RPT_WARNING, "%s: Type must be between 0 and 3; using default %d",
+	if ((tmp < 0) || (tmp > 4)) {
+		report(RPT_WARNING, "%s: Type must be between 0 and 4; using default %d",
 			drvthis->name, DEFAULT_DISPLAYTYPE);
 		tmp = DEFAULT_DISPLAYTYPE;
 	}
diff -Naur ./lcdproc.old/server/drivers/serialVFD_displays.c ./lcdproc/server/drivers/serialVFD_displays.c
--- ./lcdproc.old/server/drivers/serialVFD_displays.c	2008-01-12 00:25:14.000000000 +0100
+++ ./lcdproc/server/drivers/serialVFD_displays.c	2008-01-12 00:13:18.000000000 +0100
@@ -36,7 +36,7 @@
 void serialVFD_load_KD (Driver *drvthis);
 void serialVFD_load_Noritake (Driver *drvthis);
 void serialVFD_load_Futaba (Driver *drvthis);
-
+void serialVFD_load_Samsung (Driver *drvthis);
 
 void serialVFD_load_display_data(Driver *drvthis)
 {
@@ -54,7 +54,10 @@
 		case 3:
 			serialVFD_load_Futaba(drvthis);
 			break;
-	}
+		case 4:
+			serialVFD_load_Samsung(drvthis);
+			break;
+		}
 }
 
 
@@ -294,7 +297,7 @@
 				{1	,0x10,},	// move cursor
 				{1	,0x1F},		// reset
 				{2	,0x11,0x14},  	// init
-				{1	,0x03}, 	// set user char
+				{1	,0x1B}, 	// set user char
 				{1	,0x09}}; 	// tab
 	for (tmp = 0; tmp < 10; tmp++)
 		for (w = 0; w < 4; w++)
@@ -342,3 +345,78 @@
 	for (tmp = 0; tmp < 31; tmp++)
 		p->usr_chr_mapping[tmp] = usr_chr_mapping[tmp];
 }
+serialVFD_load_Samsung (Driver *drvthis)
+{ 		//Samsung 20S207DA4 & 20S207DA6
+	PrivateData *p = (PrivateData*) drvthis->private_data;
+	int tmp, w;
+
+	if (p->customchars == -83)
+		p->customchars = 16;	// number of custom characters the display provides
+	p->vbar_cc_offset = 0;	// character offset of the bars
+	p->hbar_cc_offset = 0;	// character offset of the bars
+	p->predefined_hbar = 0;   // the display has predefined hbar-characters
+	p->predefined_vbar = 0;   // the display has predefined vbar-characters
+
+	// hardwarespecific commands:
+	//  hw_cmd[Command][data]  = 	{{commandlength , command 1},
+	//					.....
+	//				 {commandlength , command N}}
+	const char hw_cmd[10][4] = {{2    ,0x04, 0x20},	// dark
+				{2      ,0x04, 0x40},
+				{2	,0x04, 0x60},
+				{2	,0x04, 0xFF},	// bright
+				{2	,0x10, 0x00},	// pos1
+				{1	,0x10,},	// move cursor
+				{1	,0x1F},		// reset
+				{2	,0x11,0x14},  	// init
+				{1	,0x1B}, 	// set user char
+				{1	,0x09}}; 	// tab
+	for (tmp = 0; tmp < 10; tmp++)
+		for (w = 0; w < 4; w++)
+			p->hw_cmd[tmp][w] = hw_cmd[tmp][w];
+
+	// Translates ISO 8859-1 to display charset.
+	const unsigned char charmap[] = {
+		/* #128  = 0x80 */
+		128, 129, 130, 131, 132, 133, 134, 135,
+		136, 137, 138, 139, 140, 141, 142, 143,
+		144, 145, 146, 147, 148, 149, 150, 151,
+		152, 153, 154, 155, 156, 157, 158, 159,
+		/* #160 = 0xA0 */
+		160,  0xAD, 0x9B, 0x9C, 0xC8, 0x9D, 0x7C, 0xC0,
+		'"',   '?', 0xA6, 0xAE, 0xAA,  '-',  '?',  '?',
+		0xEF, 0xCA, 0xC6, 0xC7, 0x27, 0xB8,  '?',  '.',
+		',',   '?', 0xA7, 0xAF, 0xAC, 0xAB,  '?', 0xA8,
+		/* #192 = 0xC0 */
+		0xD0,  'A', 0xD5,  'A', 0x8E, 0x8F, 0x92, 0x80,
+		0xD1, 0x90, 0xD6, 0xD3, 'I',   'I', 0xD7, 0xD4,
+		'D',  0xA5,  'O',  'O', 0xD8,  'O', 0x99,  'x',
+		'0',  0xD2,  'U', 0xD9, 0x9A,  'Y',  'p', 0xB1,
+		/* #224 = 0xE0 */
+		0x85, 0xA0, 0x83,  'a', 0x84, 0x86, 0x91, 0x87,
+		0x8A, 0x82, 0x88, 0x89, 0x8D, 0xA1, 0x8C, 0x8B,
+		'o',  0xA4, 0x95, 0xA9, 0x93,  'o', 0x94,  '/',
+		'0',  0x97, 0xA3, 0x96, 0x81,  'y',  'p', 0x89 };
+	for (tmp = 0; tmp < 128; tmp++)
+		p->charmap[tmp] = charmap[tmp];
+
+	// {bytes to send, icon bit mapped to bit 0, icon bit mapped to bit 1, ...}
+	const int usr_chr_dot_assignment[57] = { 5,
+						 8, 7, 6, 5, 4, 3, 2, 1,
+						16,15,14,13,12,11,10, 9,
+						24,23,22,21,20,19,18,17,
+						32,31,30,29,28,27,26,25,
+						 0, 0, 0, 0, 0,35,34,33 };
+	for (tmp = 0; tmp < 57; tmp++)
+		p->usr_chr_dot_assignment[tmp] = usr_chr_dot_assignment[tmp];
+
+	// Where to place the usercharacters (0..30) in the asciicode.
+	// Also used to map standardcharacters in the usercharacterspace(0..30)
+	// (useful for displays with less then 30 usercharacters and predefined bars)
+	const unsigned int usr_chr_mapping[31] = { 0xCD, 0xCE, 0xCF, 0xEE,
+						   0xFF, 0x05, 0x06, 0x07,
+						   0x0B, 0x0C, 0x0E, 0x0F,
+						   0x17, 0x1A, 0x1C, 0x1D };
+	for (tmp = 0; tmp < 31; tmp++)
+		p->usr_chr_mapping[tmp] = usr_chr_mapping[tmp];
+}

--------------090704020607020603020200--