New common 5x8 font for t6963, sed1520, mdm166a and i2500vfd. It resembles

the original font of the HD44780 with European character set, but includes
only characters from ISO 8859-1 and has been extended with bar graph and icons.

The t6963 driver now has its size to be configured in pixels! The size in
characters is automatically calculated based on the cell size. This makes
internal calculations more easy.
This commit is contained in:
mmdolze
2011-04-03 18:07:15 +00:00
parent 788ef58b99
commit 3bb27d1611
15 changed files with 1695 additions and 3950 deletions
+1
View File
@@ -31,6 +31,7 @@ v.0.5dev (ongoing development)
* Build system: Fix trying to install svga driver twice
+ imon: Add bignum support (Y. Scheglyuk)
* hd44780/ethlcd: fix LCDd hang up on network error (exits now) (M. Bialonczyk)
+ New common 5x8 font for t6963, sed1520, mdm166a and i2500vfd
v0.5.4
* Update driver includes and LDFLAGS (fixed glk and bayrad binding error)
+2 -2
View File
@@ -1098,8 +1098,8 @@ Size=20x4
## Toshiba T6963 driver ##
[t6963]
# set display size [default: 20x6]
Size=20x6
# set display size in pixels [default: 128x64]
Size=128x64
# port to use [default: 0x378; legal: 0x200 - 0x400]
Port=0x378
+6 -7
View File
@@ -9,8 +9,9 @@ displays that can often act as a screen.
<para>
The driver uses the text mode of the chipset with a custom font loaded which
resembles the characters from Code Page 437. If your display has a 'Font Select'
pin it must be wired to use the 6x8 font.
resembles the characters from HD44780 ROM 002 character set (European
character set). If your display has a 'Font Select' pin it must be wired to
use the 6x8 font.
</para>
<para>
@@ -130,11 +131,9 @@ can be done by specifying "--enable-drivers=all" or by
<property>Size</property> = &parameters.size;
</term>
<listitem><para>
Set display size in characters [default: <literal>20x6</literal>]. Do set
it as close as possible to the pixel size of the display (based on a
<literal>6x8</literal> font). Otherwise characters will repeat on the
right of a line. Example: <literal>21x8</literal> on a <literal>128x64</literal>
display.
Set display size in pixels [default: <literal>128x64</literal>]. The size
in characters is automatically calculated assuming the font size is set to
<literal>6x8</literal> for the display.
</para></listitem>
</varlistentry>
+4 -4
View File
@@ -90,7 +90,7 @@ glcdlib_SOURCES = lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
hd44780_SOURCES = lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.h
EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-usbtiny.c hd44780-usbtiny.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h hd44780-ftdi.c hd44780-ftdi.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-uss720.c hd44780-uss720.h hd44780-usblcd.c hd44780-usblcd.h port.h lpt-port.h timing.h
i2500vfd_SOURCES = lcd.h i2500vfd.c i2500vfd.h i2500vfdfm.c i2500vfdfm.h report.h
i2500vfd_SOURCES = lcd.h i2500vfd.c i2500vfd.h glcd_font5x8.h report.h
icp_a106_SOURCES = lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
imon_SOURCES = lcd.h lcd_lib.h hd44780-charmap.h imon.h imon.c report.h adv_bignum.h
imonlcd_SOURCES = lcd.h lcd_lib.h imonlcd.h imonlcd_font.h imonlcd.c report.h
@@ -104,7 +104,7 @@ lcterm_SOURCES = lcd.h lcd_lib.h lcterm.c lcterm.h report.h
lirc_SOURCES = lcd.h lircin.c lircin.h report.h
lis_SOURCES = lcd.h lcd_lib.h lis.h lis.c report.h
MD8800_SOURCES = lcd.h lcd_lib.h MD8800.c MD8800.h report.h
mdm166a_SOURCES = lcd.h mdm166a.c mdm166a.h i2500vfdfm.c i2500vfdfm.h report.h
mdm166a_SOURCES = lcd.h mdm166a.c mdm166a.h glcd_font5x8.h report.h
ms6931_SOURCES = lcd.h lcd_lib.h ms6931.h ms6931.c report.h
mtc_s16209x_SOURCES = lcd.h lcd_lib.h mtc_s16209x.c mtc_s16209x.h report.h
MtxOrb_SOURCES = lcd.h lcd_lib.h MtxOrb.c MtxOrb.h report.h adv_bignum.h
@@ -113,7 +113,7 @@ NoritakeVFD_SOURCES = lcd.h lcd_lib.h NoritakeVFD.c NoritakeVFD.h report.h adv_b
picolcd_SOURCES = lcd.h picolcd.h picolcd.c report.h
pyramid_SOURCES = lcd.h pylcd.c pylcd.h
sed1330_SOURCES = lcd.h sed1330.h sed1330.c port.h lpt-port.h timing.h report.h
sed1520_SOURCES = lcd.h sed1520.c sed1520.h sed1520fm.c sed1520fm.h port.h report.h
sed1520_SOURCES = lcd.h sed1520.c sed1520.h port.h report.h glcd_font5x8.h sed1520fm.h
serialPOS_SOURCES = lcd.h lcd_lib.h serialPOS.c serialPOS.h report.h adv_bignum.h
serialVFD_SOURCES = lcd.h lcd_lib.h serialVFD.c serialVFD.h report.h adv_bignum.h serialVFD_displays.c serialVFD_displays.h serialVFD_io.c serialVFD_io.h
shuttleVFD_SOURCES = lcd.h shuttleVFD.c shuttleVFD.h report.h
@@ -121,7 +121,7 @@ sli_SOURCES = lcd.h lcd_lib.h wirz-sli.h wirz-sli.c report.h
stv5730_SOURCES = lcd.h stv5730.c stv5730.h report.h
SureElec_SOURCES = lcd.h lcd_lib.h SureElec.c SureElec.h report.h adv_bignum.h
svga_SOURCES = lcd.h svgalib_drv.c svgalib_drv.h report.h
t6963_SOURCES = lcd.h lcd_lib.h t6963.c t6963.h t6963_font.h report.h
t6963_SOURCES = lcd.h lcd_lib.h t6963.c t6963.h glcd_font5x8.h report.h
text_SOURCES = lcd.h text.h text.c report.h
tyan_SOURCES = lcd.h lcd_lib.h tyan_lcdm.h tyan_lcdm.c report.h adv_bignum.h
ula200_SOURCES = lcd.h adv_bignum.h ula200.h ula200.c report.h
File diff suppressed because it is too large Load Diff
+11 -27
View File
@@ -24,23 +24,21 @@
// package for further details. //
//////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "i2500vfdfm.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <ftdi.h>
#include "lcd.h"
#include "i2500vfd.h"
#include "glcd_font5x8.h"
#include "report.h"
#include <ftdi.h>
// The display itself stores three pixels in one byte
// We waste a little memory as we store one pixel per byte
// as we want to keep the drawing code simple.
@@ -89,7 +87,7 @@ drawchar2fb (Driver *drvthis, int x, int y, unsigned char z)
int font_x, font_y;
for (font_y = 0; font_y < 8; font_y++) {
for (font_x = 5; font_x > -1; font_x--) {
if ((i2500vfd_fontmap[z][font_y] & 1<<font_x) == 1<<font_x)
if ((glcd_iso8859_1[z][font_y] & 1<<font_x) == 1<<font_x)
p->framebuf[INTRA2NET_VFD_XSHIFT+x*6-font_x + (y*8+font_y)*140] = 1;
else
p->framebuf[INTRA2NET_VFD_XSHIFT+x*6-font_x + (y*8+font_y)*140] = 0;
@@ -340,7 +338,7 @@ i2500vfd_set_char (Driver *drvthis, int n, char *dat)
return;
for (row = 0; row < CELLHEIGHT; row++) {
i2500vfd_fontmap[n][row] = dat[row] & mask;
glcd_iso8859_1[n][row] = dat[row] & mask;
}
}
@@ -396,7 +394,7 @@ i2500vfd_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern)
return;
}
offset = INTRA2NET_VFD_XSHIFT + 2 + x*CELLWIDTH + y*INTRA2NET_VFD_XSIZE*CELLHEIGHT;
offset = INTRA2NET_VFD_XSHIFT + 2 + x*CELLWIDTH + (y*CELLHEIGHT+1)*INTRA2NET_VFD_XSIZE;
// calculate length of bar
pixels = len*CELLWIDTH*promille/1000;
@@ -419,19 +417,5 @@ i2500vfd_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern)
MODULE_EXPORT int
i2500vfd_icon (Driver *drvthis, int x, int y, int icon)
{
switch (icon) {
case ICON_BLOCK_FILLED:
i2500vfd_chr(drvthis, x, y, 255);
break;
case ICON_HEART_FILLED:
i2500vfd_chr(drvthis, x, y, 3);
break;
case ICON_HEART_OPEN:
i2500vfd_chr(drvthis, x, y, 4);
break;
default:
return -1;
}
return 0;
return (glcd_icon5x8(drvthis, x, y, icon));
}
-851
View File
@@ -1,851 +0,0 @@
//////////////////////////////////////////////////////////////////////////
// This file contains a HD44780 font and a font for big numbers. //
// The HD44780 font in this file was shamelessly stolen from //
// Michael Reinelt / lcd4linux and is //
// Copyright 1999, 2000 by Michael Reinelt (reinelt@eunet.at) //
// The rest of this file is //
// //
// (C) 2001 Robin Adams ( robin@adams-online.de ) //
// //
// This file is released under the GPL. See file COPYING in this //
// package for further details. //
//////////////////////////////////////////////////////////////////////////
#define b______ 0x00
#define b_____O 0x01
#define b____O_ 0x02
#define b____OO 0x03
#define b___O__ 0x04
#define b___O_O 0x05
#define b___OO_ 0x06
#define b___OOO 0x07
#define b__O___ 0x08
#define b__O__O 0x09
#define b__O_O_ 0x0a
#define b__O_OO 0x0b
#define b__OO__ 0x0c
#define b__OO_O 0x0d
#define b__OOO_ 0x0e
#define b__OOOO 0x0f
#define b_O____ 0x10
#define b_O___O 0x11
#define b_O__O_ 0x12
#define b_O__OO 0x13
#define b_O_O__ 0x14
#define b_O_O_O 0x15
#define b_O_OO_ 0x16
#define b_O_OOO 0x17
#define b_OO___ 0x18
#define b_OO__O 0x19
#define b_OO_O_ 0x1a
#define b_OO_OO 0x1b
#define b_OOO__ 0x1c
#define b_OOO_O 0x1d
#define b_OOOO_ 0x1e
#define b_OOOOO 0x1f
#define b_OOOOO 0x1f
#define bOOOOOO 0x3f
unsigned char i2500vfd_fontmap[256][8] = {
[0x03] {b_OOOOO,
b_O_O_O,
b__O_O_,
b__OOO_,
b__OOO_,
b_O_O_O,
b_OO_OO,
b_OOOOO},
[0x04] {b_OOOOO,
b_O_O_O,
b______,
b______,
b______,
b_O___O,
b_OO_OO,
b_OOOOO},
[0x20] {b______,
b______,
b______,
b______,
b______,
b______,
b______,
b______},
[0x21] {b___O__,
b___O__,
b___O__,
b___O__,
b______,
b______,
b___O__,
b______},
[0x22] {b__O_O_,
b__O_O_,
b__O_O_,
b______,
b______,
b______,
b______,
b______},
[0x23] {b__O_O_,
b__O_O_,
b_OOOOO,
b__O_O_,
b_OOOOO,
b__O_O_,
b__O_O_,
b______},
[0x24] {b___O__,
b__OOOO,
b_O_O__,
b__OOO_,
b___O_O,
b_OOOO_,
b___O__,
b______},
[0x25] {b_OO___,
b_OO__O,
b____O_,
b___O__,
b__O___,
b_O__OO,
b____OO,
b______},
[0x26] {b__OO__,
b_O__O_,
b_O_O__,
b__O___,
b_O_O_O,
b_O__O_,
b__OO_O,
b______},
[0x27] {b__OO__,
b___O__,
b__O___,
b______,
b______,
b______,
b______,
b______},
[0x28] {b____O_,
b___O__,
b__O___,
b__O___,
b__O___,
b___O__,
b____O_,
b______},
[0x29] {b__O___,
b___O__,
b____O_,
b____O_,
b____O_,
b___O__,
b__O___,
b______},
[0x2a] {b______,
b___O__,
b_O_O_O,
b__OOO_,
b_O_O_O,
b___O__,
b______,
b______},
[0x2b] {b______,
b___O__,
b___O__,
b_OOOOO,
b___O__,
b___O__,
b______,
b______},
[0x2c] {b______,
b______,
b______,
b______,
b__OO__,
b___O__,
b__O___,
b______},
[0x2d] {b______,
b______,
b______,
b_OOOOO,
b______,
b______,
b______,
b______},
[0x2e] {b______,
b______,
b______,
b______,
b______,
b__OO__,
b__OO__,
b______},
[0x2f] {b______,
b_____O,
b____O_,
b___O__,
b__O___,
b_O____,
b______,
b______},
[0x30] {b__OOO_,
b_O___O,
b_O__OO,
b_O_O_O,
b_OO__O,
b_O___O,
b__OOO_,
b______},
[0x31] {b___O__,
b__OO__,
b___O__,
b___O__,
b___O__,
b___O__,
b__OOO_,
b______},
[0x32] {b__OOO_,
b_O___O,
b_____O,
b____O_,
b___O__,
b__O___,
b_OOOOO,
b______},
[0x33] {b_OOOOO,
b____O_,
b___O__,
b____O_,
b_____O,
b_O___O,
b__OOO_,
b______},
[0x34] {b____O_,
b___OO_,
b__O_O_,
b_O__O_,
b_OOOOO,
b____O_,
b____O_,
b______},
[0x35] {b_OOOOO,
b_O____,
b_O____,
b_OOOO_,
b_____O,
b_O___O,
b__OOO_,
b______},
[0x36] {b___OO_,
b__O___,
b_O____,
b_OOOO_,
b_O___O,
b_O___O,
b__OOO_,
b______},
[0x37] {b_OOOOO,
b_____O,
b____O_,
b___O__,
b__O___,
b__O___,
b__O___,
b______},
[0x38] {b__OOO_,
b_O___O,
b_O___O,
b__OOO_,
b_O___O,
b_O___O,
b__OOO_,
b______},
[0x39] {b__OOO_,
b_O___O,
b_O___O,
b__OOOO,
b_____O,
b____O_,
b__OO__,
b______},
[0x3a] {b______,
b__OO__,
b__OO__,
b______,
b__OO__,
b__OO__,
b______,
b______},
[0x3b] {b______,
b__OO__,
b__OO__,
b______,
b__OO__,
b___O__,
b__O___,
b______},
[0x3c] {b____O_,
b___O__,
b__O___,
b_O____,
b__O___,
b___O__,
b____O_,
b______},
[0x3d] {b______,
b______,
b_OOOOO,
b______,
b_OOOOO,
b______,
b______,
b______},
[0x3e] {b_O____,
b__O___,
b___O__,
b____O_,
b___O__,
b__O___,
b_O____,
b______},
[0x3f] {b__OOO_,
b_O___O,
b_____O,
b____O_,
b___O__,
b______,
b___O__,
b______},
[0x40] {b__OOO_,
b_O___O,
b_____O,
b__OO_O,
b_O_O_O,
b_O_O_O,
b__OOO_,
b______},
[0x41] {b__OOO_,
b_O___O,
b_O___O,
b_O___O,
b_OOOOO,
b_O___O,
b_O___O,
b______},
[0x42] {b_OOOO_,
b_O___O,
b_O___O,
b_OOOO_,
b_O___O,
b_O___O,
b_OOOO_,
b______},
[0x43] {b__OOO_,
b_O___O,
b_O____,
b_O____,
b_O____,
b_O___O,
b__OOO_,
b______},
[0x44] {b_OOO__,
b_O__O_,
b_O___O,
b_O___O,
b_O___O,
b_O__O_,
b_OOO__,
b______},
[0x45] {b_OOOOO,
b_O____,
b_O____,
b_OOOO_,
b_O____,
b_O____,
b_OOOOO,
b______},
[0x46] {b_OOOOO,
b_O____,
b_O____,
b_OOOO_,
b_O____,
b_O____,
b_O____,
b______},
[0x47] {b__OOO_,
b_O___O,
b_O____,
b_O_OOO,
b_O___O,
b_O___O,
b__OOOO,
b______},
[0x48] {b_O___O,
b_O___O,
b_O___O,
b_OOOOO,
b_O___O,
b_O___O,
b_O___O,
b______},
[0x49] {b__OOO_,
b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b__OOO_,
b______},
[0x4a] {b___OOO,
b____O_,
b____O_,
b____O_,
b____O_,
b_O__O_,
b__OO__,
b______},
[0x4b] {b_O___O,
b_O__O_,
b_O_O__,
b_OO___,
b_O_O__,
b_O__O_,
b_O___O,
b______},
[0x4c] {b_O____,
b_O____,
b_O____,
b_O____,
b_O____,
b_O____,
b_OOOOO,
b______},
[0x4d] {b_O___O,
b_OO_OO,
b_O_O_O,
b_O_O_O,
b_O___O,
b_O___O,
b_O___O,
b______},
[0x4e] {b_O___O,
b_O___O,
b_OO__O,
b_O_O_O,
b_O__OO,
b_O___O,
b_O___O,
b______},
[0x4f] {b__OOO_,
b_O___O,
b_O___O,
b_O___O,
b_O___O,
b_O___O,
b__OOO_,
b______},
[0x50] {b_OOOO_,
b_O___O,
b_O___O,
b_OOOO_,
b_O____,
b_O____,
b_O____,
b______},
[0x51] {b__OOO_,
b_O___O,
b_O___O,
b_O___O,
b_O_O_O,
b_O__O_,
b__OO_O,
b______},
[0x52] {b_OOOO_,
b_O___O,
b_O___O,
b_OOOO_,
b_O_O__,
b_O__O_,
b_O___O,
b______},
[0x53] {b__OOOO,
b_O____,
b_O____,
b__OOO_,
b_____O,
b_____O,
b_OOOO_,
b______},
[0x54] {b_OOOOO,
b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b______},
[0x55] {b_O___O,
b_O___O,
b_O___O,
b_O___O,
b_O___O,
b_O___O,
b__OOO_,
b______},
[0x56] {b_O___O,
b_O___O,
b_O___O,
b_O___O,
b_O___O,
b__O_O_,
b___O__,
b______},
[0x57] {b_O___O,
b_O___O,
b_O___O,
b_O_O_O,
b_O_O_O,
b_O_O_O,
b__O_O_,
b______},
[0x58] {b_O___O,
b_O___O,
b__O_O_,
b___O__,
b__O_O_,
b_O___O,
b_O___O,
b______},
[0x59] {b_O___O,
b_O___O,
b_O___O,
b__O_O_,
b___O__,
b___O__,
b___O__,
b______},
[0x5a] {b_OOOOO,
b_____O,
b____O_,
b___O__,
b__O___,
b_O____,
b_OOOOO,
b______},
[0x5b] {b__OOO_,
b__O___,
b__O___,
b__O___,
b__O___,
b__O___,
b__OOO_,
b______},
[0x5c] {b_O___O,
b__O_O_,
b_OOOOO,
b___O__,
b_OOOOO,
b___O__,
b___O__,
b______},
[0x5d] {b__OOO_,
b____O_,
b____O_,
b____O_,
b____O_,
b____O_,
b__OOO_,
b______},
[0x5e] {b___O__,
b__O_O_,
b_O___O,
b______,
b______,
b______,
b______,
b______},
[0x5f] {b______,
b______,
b______,
b______,
b______,
b______,
b_OOOOO,
b______},
[0x60] {b__O___,
b___O__,
b____O_,
b______,
b______,
b______,
b______,
b______},
[0x61] {b______,
b______,
b__OOO_,
b_____O,
b__OOOO,
b_O___O,
b__OOOO,
b______},
[0x62] {b_O____,
b_O____,
b_O____,
b_O_OO_,
b_OO__O,
b_O___O,
b_OOOO_,
b______},
[0x63] {b______,
b______,
b__OOO_,
b_O____,
b_O____,
b_O___O,
b__OOO_,
b______},
[0x64] {b_____O,
b_____O,
b_____O,
b__OO_O,
b_O__OO,
b_O___O,
b__OOOO,
b______},
[0x65] {b______,
b______,
b__OOO_,
b_O___O,
b_OOOOO,
b_O____,
b__OOO_,
b______},
[0x66] {b___OO_,
b__O__O,
b__O___,
b_OOO__,
b__O___,
b__O___,
b__O___,
b______},
[0x67] {b______,
b__OOOO,
b_O___O,
b_O___O,
b__OOOO,
b_____O,
b__OOO_,
b______},
[0x68] {b_O____,
b_O____,
b_O_OO_,
b_OO__O,
b_O___O,
b_O___O,
b_O___O,
b______},
[0x69] {b___O__,
b______,
b__OO__,
b___O__,
b___O__,
b___O__,
b__OOO_,
b______},
[0x6a] {b____O_,
b______,
b___OO_,
b____O_,
b____O_,
b_O__O_,
b__OO__,
b______},
[0x6b] {b__O___,
b__O___,
b__O__O,
b__O_O_,
b__OO__,
b__O_O_,
b__O__O,
b______},
[0x6c] {b__OO__,
b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b__OOO_,
b______},
[0x6d] {b______,
b______,
b_OO_O_,
b_O_O_O,
b_O_O_O,
b_O___O,
b_O___O,
b______},
[0x6e] {b______,
b______,
b_OOOO_,
b_O___O,
b_O___O,
b_O___O,
b_O___O,
b______},
[0x6f] {b______,
b______,
b__OOO_,
b_O___O,
b_O___O,
b_O___O,
b__OOO_,
b______},
[0x70] {b______,
b______,
b_OOOO_,
b_O___O,
b_OOOO_,
b_O____,
b_O____,
b______},
[0x71] {b______,
b______,
b__OO_O,
b_O__OO,
b__OOOO,
b_____O,
b_____O,
b______},
[0x72] {b______,
b______,
b_O_OO_,
b_OO__O,
b_O____,
b_O____,
b_O____,
b______},
[0x73] {b______,
b______,
b__OOO_,
b_O____,
b__OOO_,
b_____O,
b_OOOO_,
b______},
[0x74] {b__O___,
b_OOO__,
b__O___,
b__O___,
b__O___,
b__O__O,
b___OO_,
b______},
[0x75] {b______,
b______,
b_O___O,
b_O___O,
b_O___O,
b_O__OO,
b__OO_O,
b______},
[0x76] {b______,
b______,
b_O___O,
b_O___O,
b_O___O,
b__O_O_,
b___O__,
b______},
[0x77] {b______,
b______,
b_O___O,
b_O___O,
b_O___O,
b_O_O_O,
b__O_O_,
b______},
[0x78] {b______,
b______,
b_O___O,
b__O_O_,
b___O__,
b__O_O_,
b_O___O,
b______},
[0x79] {b______,
b______,
b_O___O,
b_O___O,
b__OOOO,
b_____O,
b__OOO_,
b______},
[0x7a] {b______,
b______,
b_OOOOO,
b____O_,
b___O__,
b__O___,
b_OOOOO,
b______},
[0x7b] {b____O_,
b___O__,
b___O__,
b__O___,
b___O__,
b___O__,
b____O_,
b______},
[0x7c] {b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b___O__,
b______},
[0x7d] {b__O___,
b___O__,
b___O__,
b____O_,
b___O__,
b___O__,
b__O___,
b______},
[0x7e] {b______,
b___O__,
b____O_,
b_OOOOO,
b____O_,
b___O__,
b______,
b______},
[0x7f] {b______,
b___O__,
b__O___,
b_OOOOO,
b__O___,
b___O__,
b______,
b______},
[0xb0] {b__OOO_,
b__O_O_,
b__OOO_,
b______,
b______,
b______,
b______,
b______},
[0xff] {bOOOOOO,
bOOOOOO,
bOOOOOO,
bOOOOOO,
bOOOOOO,
bOOOOOO,
bOOOOOO,
bOOOOOO},
};
-6
View File
@@ -1,6 +0,0 @@
#ifndef I2500VFDFM_H
#define I2500VFDFM_H
unsigned char i2500vfd_fontmap[256][8];
#endif
+18 -36
View File
@@ -1,23 +1,17 @@
/** \file server/drivers/mdm166a.c
* LCDd \c mdm166a driver for Futuba MDM166A displays.
*
* The 96x16 pixel dot matrix area is used for 2x16 characters with a
* 6x8 pixel font. The icons on the display are supported by using the
* output-function.
* The 96x16 pixel dot matrix area is used for 16x2 characters with a
* 5x8 pixel font (in a 6x8 cell). The icons on the display are supported by
* using the output-function.
*
* The display features a self-running clock mode, which can be
* activated in the config file and will be shown on LCDproc shutdown.
*/
/*-
* (C) 2010 Christoph Rasim (christoph@rasim.net)
*
* Code here is basend on i2500vfd.c:
* (C) 2003,2007 Intra2net AG
*
* i2500vfdfm.c is used for the font, no need for another copy of it.
* The HD44780 font in i2500vfdfm.c was taken from Michael Reinelt /
* lcd4linux and is (C) 2000 by him.
* Copyright (C) 2003,2007 Intra2net AG
* 2010 Christoph Rasim (christoph@rasim.net)
*
* This driver is released under the GPL. See file COPYING in this
* package for further details.
@@ -35,11 +29,11 @@
#include "lcd.h"
#include "mdm166a.h"
#include "i2500vfdfm.h"
#include "glcd_font5x8.h"
#include "report.h"
/*
* The display itself stores eight pixels in one byte We waste a little
* The display itself stores eight pixels in one byte. We waste a little
* memory as we store one pixel per byte as we want to keep the drawing code
* simple. Take a look at mdm166a_flush for the conversion.
*/
@@ -118,7 +112,7 @@ drawchar2fb(Driver *drvthis, int x, int y, unsigned char z)
for (font_y = 0; font_y < 8; font_y++) {
for (font_x = 5; font_x > -1; font_x--) {
if ((i2500vfd_fontmap[z][font_y] & 1 << font_x) == 1 << font_x)
if ((glcd_iso8859_1[z][font_y] & 1 << font_x) == 1 << font_x)
p->framebuf[x * 6 - 1 - font_x + (y * 8 + font_y) * MDM166A_XSIZE] = 1;
else
p->framebuf[x * 6 - 1 - font_x + (y * 8 + font_y) * MDM166A_XSIZE] = 0;
@@ -455,10 +449,12 @@ mdm166a_chr(Driver *drvthis, int x, int y, char c)
/**
* Define a custom character and write it to the VFD.
* Define a custom character and write it to the VFD. As the font is completely
* held in memory every character may be overridden.
*
* \param drvthis Pointer to driver structure.
* \param n Custom character to define [0 - (p->customchars)].
* \param dat Array of 7(=cellheight) bytes, each representing a pixel row
* \param n Custom character to define [0 - 255].
* \param dat Array of 8 (=cellheight) bytes, each representing a pixel row
* starting from the top to bottom. \n
* The bits in each byte represent the pixels where the LSB
* (least significant bit) is the rightmost pixel in each pixel row.
@@ -475,7 +471,7 @@ mdm166a_set_char(Driver *drvthis, int n, char *dat)
return;
for (row = 0; row < CELLHEIGHT; row++) {
i2500vfd_fontmap[n][row] = dat[row] & mask;
glcd_iso8859_1[n][row] = dat[row] & mask;
}
}
@@ -496,7 +492,7 @@ mdm166a_vbar(Driver *drvthis, int x, int y, int len, int promille, int pattern)
unsigned int offset;
int i, j, pixels;
debug(RPT_INFO, "%s: x=%i, y=%i, len=%i, promille=%i, options=%i",
debug(RPT_DEBUG, "%s: x=%i, y=%i, len=%i, promille=%i, options=%i",
__FUNCTION__, x, y, len, promille, pattern);
x--;
@@ -537,7 +533,7 @@ mdm166a_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern)
unsigned int offset;
int i, j, pixels;
debug(RPT_INFO, "%s: x=%i, y=%i, len=%i, promille=%i, options=%i",
debug(RPT_DEBUG, "%s: x=%i, y=%i, len=%i, promille=%i, options=%i",
__FUNCTION__, x, y, len, promille, pattern);
x--;
@@ -551,7 +547,7 @@ mdm166a_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern)
* Calculate starting point in framebuffer. Leave the leftmost column
* empty (+1). Shorten the length by 1 then.
*/
offset = x * CELLWIDTH + y * MDM166A_XSIZE * CELLHEIGHT + 1;
offset = x * CELLWIDTH + (y * CELLHEIGHT + 1) * MDM166A_XSIZE + 1;
/* calculate length of bar */
pixels = len * CELLWIDTH * promille / 1000 - 1;
@@ -580,21 +576,7 @@ mdm166a_hbar(Driver *drvthis, int x, int y, int len, int promille, int pattern)
MODULE_EXPORT int
mdm166a_icon(Driver *drvthis, int x, int y, int icon)
{
switch (icon) {
case ICON_BLOCK_FILLED:
mdm166a_chr(drvthis, x, y, 255);
break;
case ICON_HEART_FILLED:
mdm166a_chr(drvthis, x, y, 3);
break;
case ICON_HEART_OPEN:
mdm166a_chr(drvthis, x, y, 4);
break;
default:
return -1;
}
return 0;
return (glcd_icon5x8(drvthis, x, y, icon));
}
+22 -92
View File
@@ -15,18 +15,6 @@
* COPYING file distributed with this package.
*/
/*-
* Driver history:
* 2001, Guillaume Filion <gfk@logidac.com>:
* - Moved the delay timing code by Charles Steinkuehler to timing.h.
* 2011, Markus Dolze:
* - Add 68-familiy style interface support and make it configurable
* - Make delay configurable
* - Correct swapped display halves
* - Resurrect vBar / hBar functions
* - Fix icon definitions and modify set_char for common data format
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -37,10 +25,11 @@
#include "lcd.h"
#include "sed1520.h"
#include "glcd_font5x8.h"
#include "sed1520fm.h"
#include "report.h"
#include "port.h"
#include "timing.h"
#include "sed1520fm.h"
#include "lpt-port.h"
#define uPause timing_uPause
@@ -88,7 +77,7 @@ MODULE_EXPORT char *symbol_prefix = "sed1520_";
* \note It is a little code duplication having writecommand and writedata
* both, but I leave it that way.
*/
void
static void
writecommand(PrivateData *p, int value, int chip)
{
if (p->interface == 68) {
@@ -121,7 +110,7 @@ writecommand(PrivateData *p, int value, int chip)
* \param value Data byte to write
* \param chip Bitmap of controllers to send value to
*/
void
static void
writedata(PrivateData *p, int value, int chip)
{
if (p->interface == 68) {
@@ -148,7 +137,7 @@ writedata(PrivateData *p, int value, int chip)
* \param p Pointer to private data structure
* \param page Page (=row) number (0-3)
*/
void
static void
selectpage(PrivateData *p, int page)
{
writecommand(p, PAGE_ADR + (page & 0x03), CS1 + CS2);
@@ -160,7 +149,7 @@ selectpage(PrivateData *p, int page)
* \param column Select column (segment) in controller (0-60)
* \param chip Bitmap of controllers to send value to
*/
void
static void
selectcolumn(PrivateData *p, int column, int chip)
{
writecommand(p, COLUMN_ADR + (column & 0x7F), chip);
@@ -191,7 +180,7 @@ selectcolumn(PrivateData *p, int column, int chip)
* \param y Line (zero-based)
* \param z Character index in fontmap
*/
void
static void
drawchar2fb(unsigned char *framebuf, int x, int y, unsigned char z)
{
int i, j;
@@ -205,7 +194,7 @@ drawchar2fb(unsigned char *framebuf, int x, int y, unsigned char z)
/* gather the bits from the fontmap for each raster row */
for (j = 0; j < CELLHEIGHT; j++)
k |= ((fontmap[(int)z][j] >> (i - 1)) & 0x01) << j;
k |= ((glcd_iso8859_1[(int)z][j] >> (i - 1)) & 0x01) << j;
/* And store it in framebuffer pixel column */
framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + (CELLWIDTH - i)] = k;
@@ -401,14 +390,12 @@ sed1520_chr(Driver * drvthis, int x, int y, char c)
* API: This function draws a number num into the last 3 rows of the
* framebuffer at 1-based position x. It should draw a 4-row font, but me
* thinks this would look a little stretched. When num=10 a colon is drawn.
*
* FIXME: make big numbers use less memory
*/
MODULE_EXPORT void
sed1520_num(Driver * drvthis, int x, int num)
{
PrivateData *p = drvthis->private_data;
int z, c, i, s;
int z, c;
x--;
@@ -416,39 +403,21 @@ sed1520_num(Driver * drvthis, int x, int num)
if ((x >= WIDTH) || (num < 0) || (num > 10))
return;
if (num == 10) { /* colon */
for (z = 0; z < 3; z++) { /* 3 rows at 8 dots */
for (c = 0; c < 6; c++) { /* 6 columns */
s = 0;
/* convert font definition to bitmap */
for (i = 0; i < 8; i++) {
s >>= 1;
if (*(fontbigdp[(z * 8) + i] + c) == '.')
s |= 0x80;
}
/* Draw directly into framebuffer */
if ((x * CELLWIDTH + c >= 0) && (x * CELLWIDTH + c < PIXELWIDTH))
p->framebuf[((z + 1) * PIXELWIDTH) + (x * CELLWIDTH) + c] = s;
}
}
}
else { /* digits 0 - 9 */
for (z = 0; z < 3; z++) { /* 3 rows at 8 dots */
for (c = 0; c < 18; c++) { /* 18 columns */
s = 0;
for (i = 0; i < 8; i++) {
s >>= 1;
if (*(fontbignum[num][z * 8 + i] + c) == '.')
s |= 0x80;
}
if ((x * CELLWIDTH + c >= 0) && (x * CELLWIDTH + c < PIXELWIDTH))
p->framebuf[((z + 1) * PIXELWIDTH) + (x * CELLWIDTH) + c] = s;
/*
* For each page (= row of 8 dots) starting in page 1 (page 0 is left
* empty - thus the numbers are aligned at the bottom of the display),
* copy <width> number of bytes into the framebuffer.
*/
for (z = 0; z < 3; z++) {
for (c = 0; c < widtbl_NUM[num]; c++) {
if ((x * CELLWIDTH + c >= 0) && (x * CELLWIDTH + c < PIXELWIDTH)) {
p->framebuf[((z + 1) * PIXELWIDTH) + (x * CELLWIDTH) + c] =
chrtbl_NUM[num][c * 3 + z];
}
}
}
}
/**
* API: Changes the font of character n to a pattern given by *dat.
* HD44780 controllers only posses 8 programmable chars. But we store the
@@ -470,7 +439,7 @@ sed1520_set_char(Driver * drvthis, int n, char *dat)
return;
for (row = 0; row < CELLHEIGHT; row++)
fontmap[n][row] = dat[row] & mask;
glcd_iso8859_1[n][row] = dat[row] & mask;
}
/**
@@ -534,7 +503,7 @@ sed1520_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
* column in a page. Use 5 dots in the middle (0x3E).
*/
for (i = 0; i < pixels; i++)
p->framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + i] = 0x3E;
p->framebuf[(y * PIXELWIDTH) + (x * CELLWIDTH) + i] = 0x7C;
}
/**
@@ -543,44 +512,5 @@ sed1520_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
MODULE_EXPORT int
sed1520_icon(Driver * drvthis, int x, int y, int icon)
{
static char heart_open[] =
{
b_OOOOO,
b_O_O_O,
b______,
b______,
b______,
b_O___O,
b_OO_OO,
b_OOOOO
};
static char heart_filled[] =
{
b_OOOOO,
b_O_O_O,
b__O_O_,
b__OOO_,
b__OOO_,
b_O_O_O,
b_OO_OO,
b_OOOOO
};
switch (icon) {
case ICON_BLOCK_FILLED:
sed1520_chr(drvthis, x, y, 255);
break;
case ICON_HEART_FILLED:
sed1520_set_char(drvthis, 0, heart_filled);
sed1520_chr(drvthis, x, y, 0);
break;
case ICON_HEART_OPEN:
sed1520_set_char(drvthis, 0, heart_open);
sed1520_chr(drvthis, x, y, 0);
break;
default:
return -1;
}
return 0;
return (glcd_icon5x8(drvthis, x, y, icon));
}
+2 -4
View File
@@ -25,12 +25,10 @@ MODULE_EXPORT void sed1520_clear (Driver *drvthis);
MODULE_EXPORT void sed1520_flush (Driver *drvthis);
MODULE_EXPORT void sed1520_string (Driver *drvthis, int x, int y, const char string[]);
MODULE_EXPORT void sed1520_chr (Driver *drvthis, int x, int y, char c);
MODULE_EXPORT void sed1520_old_vbar (Driver *drvthis, int x, int len);
MODULE_EXPORT void sed1520_old_hbar (Driver *drvthis, int x, int y, int len);
MODULE_EXPORT void sed1520_vbar (Driver *drvthis, int x, int y, int len, int promille, int options);
MODULE_EXPORT void sed1520_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
MODULE_EXPORT void sed1520_num (Driver *drvthis, int x, int num);
MODULE_EXPORT int sed1520_icon (Driver *drvthis, int x, int y, int icon);
MODULE_EXPORT void sed1520_set_char (Driver *drvthis, int n, char *dat);
#endif
File diff suppressed because it is too large Load Diff
+127 -37
View File
@@ -1,43 +1,133 @@
/** \file server/drivers/sed1520fm.h
* Font definitions for big numbers to be used with SED1520 display.
*
* The code in this file was created with Cosmicvoid's Font Editor (CFE) based
* on the original font by Robin Adams and manually optimized.
*/
/*-
* Copyright (c) 2001 Robin Adams <robin@adams-online.de>
* 2011 Markus Dolze <bsdfan@nurfuerspam.de>
*
* This file is released under the GNU General Public License. Refer to the
* COPYING file distributed with this package.
*/
#ifndef SED1520FM_H
#define SED1520FM_H
#define b______ 0x00
#define b_____O 0x01
#define b____O_ 0x02
#define b____OO 0x03
#define b___O__ 0x04
#define b___O_O 0x05
#define b___OO_ 0x06
#define b___OOO 0x07
#define b__O___ 0x08
#define b__O__O 0x09
#define b__O_O_ 0x0a
#define b__O_OO 0x0b
#define b__OO__ 0x0c
#define b__OO_O 0x0d
#define b__OOO_ 0x0e
#define b__OOOO 0x0f
#define b_O____ 0x10
#define b_O___O 0x11
#define b_O__O_ 0x12
#define b_O__OO 0x13
#define b_O_O__ 0x14
#define b_O_O_O 0x15
#define b_O_OO_ 0x16
#define b_O_OOO 0x17
#define b_OO___ 0x18
#define b_OO__O 0x19
#define b_OO_O_ 0x1a
#define b_OO_OO 0x1b
#define b_OOO__ 0x1c
#define b_OOO_O 0x1d
#define b_OOOO_ 0x1e
#define b_OOOOO 0x1f
#define b_OOOOO 0x1f
#define bOOOOOO 0x3f
/* Properties of this font (currently unused) */
#define nr_chrs_NUM 11
#define chr_hgt_NUM 24
#define data_size_NUM 8
#define firstchr_NUM 48
char fontmap[256][8];
char *fontbignum[10][24];
char *fontbigdp[24];
const unsigned char widtbl_NUM[11] =
{
16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 5
};
/* Column format, LSB top */
const unsigned char chr_NUM_30[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x01, 0xE0, 0xFF, 0x0F,
0xF0, 0xFF, 0x1F, 0xF0, 0xFF, 0x1F, 0x78, 0x00, 0x3C,
0x38, 0x00, 0x38, 0x38, 0x00, 0x38, 0x78, 0x00, 0x3C,
0xF0, 0xFF, 0x1F, 0xF0, 0xFF, 0x1F, 0xE0, 0xFF, 0x0F,
0x00, 0xFF, 0x01
};
const unsigned char chr_NUM_31[45] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1E, 0x00, 0x00, 0x0F, 0x00, 0x80, 0x0F, 0x00,
0xC0, 0x07, 0x00, 0xE0, 0x03, 0x00, 0xF0, 0xFF, 0x3F,
0xF8, 0xFF, 0x3F, 0xF8, 0xFF, 0x3F, 0xF8, 0xFF, 0x3F
};
const unsigned char chr_NUM_32[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x3C,
0xF0, 0x01, 0x3F, 0xF0, 0x81, 0x3F, 0x78, 0xC0, 0x3F,
0x38, 0xE0, 0x3F, 0x38, 0xF0, 0x3C, 0x38, 0x78, 0x3C,
0xF8, 0x7F, 0x3C, 0xF0, 0x3F, 0x3C, 0xF0, 0x0F, 0x3C,
0xC0, 0x07, 0x3C
};
const unsigned char chr_NUM_33[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC0, 0x00, 0x03, 0xF0, 0x00, 0x0F,
0xF0, 0x00, 0x1F, 0xF8, 0x00, 0x3F, 0x38, 0x00, 0x3C,
0x38, 0x1C, 0x38, 0x38, 0x1E, 0x38, 0xF8, 0x3F, 0x3C,
0xF0, 0xF7, 0x1F, 0xF0, 0xF7, 0x1F, 0xC0, 0xE1, 0x0F,
0x00, 0xC0, 0x03
};
const unsigned char chr_NUM_34[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC0, 0x03, 0x00, 0xE0, 0x03, 0x00, 0xF8, 0x03,
0x00, 0xBE, 0x03, 0x00, 0x9F, 0x03, 0xC0, 0x87, 0x03,
0xE0, 0x83, 0x03, 0xF8, 0xFF, 0x3F, 0xF8, 0xFF, 0x3F,
0xF8, 0xFF, 0x3F, 0xF8, 0xFF, 0x3F, 0x00, 0x80, 0x03,
0x00, 0x80, 0x03
};
const unsigned char chr_NUM_35[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1C, 0x03, 0xE0, 0x1F, 0x0F,
0xF8, 0x1F, 0x1F, 0xF8, 0x1F, 0x3F, 0xF8, 0x0C, 0x3C,
0x38, 0x0E, 0x38, 0x38, 0x0E, 0x38, 0x38, 0x1E, 0x3C,
0x38, 0xFE, 0x1F, 0x38, 0xFC, 0x1F, 0x38, 0xF8, 0x0F,
0x00, 0xF0, 0x03
};
const unsigned char chr_NUM_36[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x01, 0xC0, 0xFF, 0x07,
0xE0, 0xFF, 0x1F, 0xF0, 0xFF, 0x1F, 0x78, 0x38, 0x3C,
0x38, 0x1C, 0x38, 0x38, 0x1C, 0x38, 0x78, 0x3C, 0x3C,
0xF8, 0xFC, 0x3F, 0xF0, 0xF8, 0x1F, 0xF0, 0xF0, 0x0F,
0xC0, 0xE0, 0x07
};
const unsigned char chr_NUM_37[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00,
0x38, 0x00, 0x3C, 0x38, 0xC0, 0x3F, 0x38, 0xF0, 0x3F,
0x38, 0xFC, 0x3F, 0x38, 0xFF, 0x01, 0xB8, 0x3F, 0x00,
0xF8, 0x07, 0x00, 0xF8, 0x03, 0x00, 0xF8, 0x00, 0x00,
0x78, 0x00, 0x00
};
const unsigned char chr_NUM_38[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC0, 0xC3, 0x07, 0xF0, 0xE7, 0x1F,
0xF0, 0xFF, 0x1F, 0xF8, 0xFF, 0x3F, 0x38, 0x3C, 0x38,
0x18, 0x18, 0x30, 0x18, 0x18, 0x30, 0x38, 0x3C, 0x38,
0xF8, 0xFF, 0x3F, 0xF0, 0xFF, 0x1F, 0xF0, 0xE7, 0x1F,
0xC0, 0xC3, 0x07
};
const unsigned char chr_NUM_39[48] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC0, 0x0F, 0x06, 0xE0, 0x1F, 0x1E,
0xF0, 0x3F, 0x1E, 0xF8, 0x7F, 0x3E, 0x78, 0x78, 0x3C,
0x38, 0x70, 0x38, 0x38, 0x70, 0x38, 0x78, 0x38, 0x3C,
0xF0, 0xFF, 0x1F, 0xF0, 0xFF, 0x0F, 0xC0, 0xFF, 0x07,
0x00, 0xFF, 0x01
};
const unsigned char chr_NUM_3A[15] =
{
0x00, 0x00, 0x00, 0xE0, 0x81, 0x07, 0xE0, 0x81, 0x07,
0xE0, 0x81, 0x07, 0xE0, 0x81, 0x07
};
const unsigned char * chrtbl_NUM[11] =
{
chr_NUM_30, chr_NUM_31, chr_NUM_32, chr_NUM_33, chr_NUM_34, chr_NUM_35,
chr_NUM_36, chr_NUM_37, chr_NUM_38, chr_NUM_39, chr_NUM_3A
};
#endif
+74 -90
View File
@@ -13,6 +13,10 @@
* 17 (Slct) ------------ /RD
* + 5V --- FS (6x8 font)
*\endverbatim
*
* \note The driver does not provide cellwidth / cellheight API functions.
* Thus the default cell size of 5x8 is assumed by server core! This
* works fine with the 5x8 font loaded into the controller.
*/
/*-
@@ -30,7 +34,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -40,8 +43,7 @@
#include "lcd.h"
#include "t6963.h"
#include "t6963_font.h"
#include "glcd_font5x8.h"
#include "timing.h"
#include "report.h"
#include "lcd_lib.h"
@@ -53,17 +55,16 @@
#define nRD nSEL
#define nCE nLF
#define T_CMD INIT
#define T_DATA 0x00
#define T_DATA 0x00 /* ~INIT didn't work here */
/** private data for the \c t6963 driver */
typedef struct t6963_private_data {
u16 port;
u8 *display_buffer1;
int width;
int height;
int cellwidth;
int cellheight;
int px_width, px_heigth; /* size in pixels */
int width, height; /* size in characters */
int bytes_per_line; /* memory allocated per line */
short bidirectLPT;
short delayBus;
} PrivateData;
@@ -78,7 +79,7 @@ MODULE_EXPORT char *symbol_prefix = "t6963_";
* API: Initialize the driver.
*/
MODULE_EXPORT int
t6963_init(Driver * drvthis)
t6963_init(Driver *drvthis)
{
PrivateData *p;
int w, h;
@@ -93,15 +94,9 @@ t6963_init(Driver * drvthis)
if (drvthis->store_private_ptr(drvthis, p))
return -1;
/* initialize private data */
p->cellwidth = DEFAULT_CELL_WIDTH;
p->cellheight = DEFAULT_CELL_HEIGHT;
debug(RPT_DEBUG, "T6963: reading config file...");
/* Read config file */
/* Which size? */
/* Read display size in pixels */
strncpy(size, drvthis->config_get_string(drvthis->name, "Size", 0, DEFAULT_SIZE), sizeof(size));
size[sizeof(size) - 1] = '\0';
if ((sscanf(size, "%dx%d", &w, &h) != 2)
@@ -111,8 +106,18 @@ t6963_init(Driver * drvthis)
drvthis->name, size, DEFAULT_SIZE);
sscanf(DEFAULT_SIZE, "%dx%d", &w, &h);
}
p->width = w;
p->height = h;
p->px_width = w;
p->px_heigth = h;
/*
* Calculate the size in characters and the number of actual bytes
* required per display line. The number of bytes may be different
* to the number of columns if the the width in pixels is not a
* multiple of the cell width.
*/
p->width = p->px_width / DEFAULT_CELL_WIDTH;
p->bytes_per_line = (p->px_width % DEFAULT_CELL_WIDTH) ? p->width + 1 : p->width;
p->height = p->px_heigth / DEFAULT_CELL_HEIGHT;
/* Which port? */
p->port = drvthis->config_get_int(drvthis->name, "Port", 0, DEFAULT_PORT);
@@ -142,13 +147,13 @@ t6963_init(Driver * drvthis)
}
/* Allocate and clear memory for frame buffer */
p->display_buffer1 = malloc(p->width * p->height);
p->display_buffer1 = malloc(p->bytes_per_line * p->height);
if (p->display_buffer1 == NULL) {
report(RPT_ERR, "%s: No memory for frame buffer", drvthis->name);
t6963_close(drvthis);
return -1;
}
memset(p->display_buffer1, ' ', p->width * p->height);
memset(p->display_buffer1, ' ', p->bytes_per_line * p->height);
/* ------------------- I N I T I A L I Z A T I O N --------------- */
if (p->bidirectLPT == 1) {
@@ -163,22 +168,12 @@ t6963_init(Driver * drvthis)
}
debug(RPT_INFO, "T6963: Sending init to display...");
/*
* Note: I assume display has a width that is a multiple of 8 (e.g.
* 128, 160, 240, etc). If this is not a multiple of the cellwidth
* the display has excess pixels on the right. In this case make the
* controller think we have one column more which will be filled with
* a space on flush. This avoids incorrect excess pixels on the right.
*/
w = p->width;
if ((p->width * p->cellwidth) % 8)
w++;
/* Set text and graphic addresses */
t6963_low_command_word(drvthis, SET_GRAPHIC_HOME_ADDRESS, GRAPHIC_BASE);
t6963_low_command_word(drvthis, SET_GRAPHIC_AREA, w);
t6963_low_command_word(drvthis, SET_GRAPHIC_AREA, p->bytes_per_line);
t6963_low_command_word(drvthis, SET_TEXT_HOME_ADDRESS, TEXT_BASE);
t6963_low_command_word(drvthis, SET_TEXT_AREA, w);
t6963_low_command_word(drvthis, SET_TEXT_AREA, p->bytes_per_line);
/* Enable external character generator */
t6963_low_command(drvthis, SET_MODE | OR_MODE | EXTERNAL_CG);
@@ -206,7 +201,7 @@ t6963_init(Driver * drvthis)
* API: Close the driver.
*/
MODULE_EXPORT void
t6963_close(Driver * drvthis)
t6963_close(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
@@ -227,7 +222,7 @@ t6963_close(Driver * drvthis)
* API: Returns the display width
*/
MODULE_EXPORT int
t6963_width(Driver * drvthis)
t6963_width(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
@@ -238,7 +233,7 @@ t6963_width(Driver * drvthis)
* API: Returns the display height
*/
MODULE_EXPORT int
t6963_height(Driver * drvthis)
t6963_height(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
@@ -249,12 +244,12 @@ t6963_height(Driver * drvthis)
* API: Clears the LCD screen (clear display buffer)
*/
MODULE_EXPORT void
t6963_clear(Driver * drvthis)
t6963_clear(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
debug(RPT_DEBUG, "Clearing Display of size %d x %d", p->width, p->height);
memset(p->display_buffer1, ' ', p->width * p->height);
debug(RPT_DEBUG, "Clearing Display of size %d x %d", p->bytes_per_line, p->height);
memset(p->display_buffer1, ' ', p->bytes_per_line * p->height);
debug(RPT_DEBUG, "Done");
}
@@ -263,19 +258,11 @@ t6963_clear(Driver * drvthis)
* \param drvthis Pointer to driver structure.
*/
static void
t6963_graphic_clear(Driver * drvthis)
t6963_graphic_clear(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
int i, num;
/*
* If width * cellwidth is not a multiple of 8 we have an additional
* column on the right.
*/
if ((p->width * p->cellwidth) % 8)
num = (p->width + 1) * p->height * p->cellheight;
else
num = p->width * p->height * p->cellheight;
int num = p->bytes_per_line * p->px_heigth;
int i;
debug(RPT_DEBUG, "Clearing Graphic %d bytes", num);
@@ -290,7 +277,7 @@ t6963_graphic_clear(Driver * drvthis)
* API: Flushes all output to the lcd.
*/
MODULE_EXPORT void
t6963_flush(Driver * drvthis)
t6963_flush(Driver *drvthis)
{
PrivateData *p = drvthis->private_data;
int r, c, line_address;
@@ -313,10 +300,10 @@ t6963_flush(Driver * drvthis)
t6963_low_auto_write(drvthis, p->display_buffer1[line_address + c]);
}
/*
* If width * cellwidth is not a multiple of 8 write a space
* into an additional column on the right.
* If width is not identical with bytes_per_line there must be
* one additional empty column on the right.
*/
if ((p->width * p->cellwidth) % 8)
if (p->width != p->bytes_per_line)
t6963_low_auto_write(drvthis, ' ');
}
t6963_low_command(drvthis, AUTO_RESET);
@@ -327,7 +314,7 @@ t6963_flush(Driver * drvthis)
* upper-left is (1,1), and the lower right should be (width,height).
*/
MODULE_EXPORT void
t6963_string(Driver * drvthis, int x, int y, const char string[])
t6963_string(Driver *drvthis, int x, int y, const char string[])
{
PrivateData *p = drvthis->private_data;
int len;
@@ -354,7 +341,7 @@ t6963_string(Driver * drvthis, int x, int y, const char string[])
* upper-left is (1,1), and the lower right should be (width,height).
*/
MODULE_EXPORT void
t6963_chr(Driver * drvthis, int x, int y, char c)
t6963_chr(Driver *drvthis, int x, int y, char c)
{
PrivateData *p = drvthis->private_data;
@@ -381,18 +368,17 @@ t6963_chr(Driver * drvthis, int x, int y, char c)
static void
t6963_set_nchar(Driver *drvthis, int n, int num)
{
PrivateData *p = drvthis->private_data;
int chr, row;
char letter;
unsigned char mask = (1 << p->cellwidth) - 1;
unsigned char mask = (1 << GLCD_FONT_WIDTH) - 1;
debug(RPT_DEBUG, "Loading font");
t6963_low_command_word(drvthis, SET_ADDRESS_POINTER, CHARGEN_BASE + n * p->cellheight);
t6963_low_command_word(drvthis, SET_ADDRESS_POINTER, CHARGEN_BASE + n * DEFAULT_CELL_HEIGHT);
t6963_low_command(drvthis, AUTO_WRITE);
for (chr = 0; chr < num; chr++) {
for (row = 0; row < p->cellheight; row++) {
letter = fontdata_6x8[chr][row] & mask;
for (row = 0; row < DEFAULT_CELL_HEIGHT; row++) {
letter = glcd_iso8859_1[chr][row] & mask;
t6963_low_auto_write(drvthis, letter);
}
}
@@ -404,12 +390,12 @@ t6963_set_nchar(Driver *drvthis, int n, int num)
* overwriting an existing character.
*/
MODULE_EXPORT void
t6963_set_char(Driver * drvthis, int n, unsigned char *dat)
t6963_set_char(Driver *drvthis, int n, unsigned char *dat)
{
if (!dat || n < 0 || n > 255)
return;
memcpy(fontdata_6x8[n], dat, 8);
memcpy(glcd_iso8859_1[n], dat, 8);
t6963_set_nchar(drvthis, n, 1);
}
@@ -417,45 +403,43 @@ t6963_set_char(Driver * drvthis, int n, unsigned char *dat)
* API: Draws a vertical bar, from the bottom of the screen up.
*/
MODULE_EXPORT void
t6963_vbar(Driver * drvthis, int x, int y, int len, int promille, int options)
t6963_vbar(Driver *drvthis, int x, int y, int len, int promille, int options)
{
PrivateData *p = drvthis->private_data;
lib_vbar_static(drvthis, x, y, len, promille, options, p->cellheight, 211);
lib_vbar_static(drvthis, x, y, len, promille, options, DEFAULT_CELL_HEIGHT, 0x90);
}
/**
* API: Draws a horizontal bar to the right.
*
* \note For hBars the actual width of the font (5) has to be used instead
* of the cell width (6)!
*/
MODULE_EXPORT void
t6963_hbar(Driver * drvthis, int x, int y, int len, int promille, int options)
t6963_hbar(Driver *drvthis, int x, int y, int len, int promille, int options)
{
PrivateData *p = drvthis->private_data;
int pixels = ((long) 2 * len * GLCD_FONT_WIDTH) * promille / 2000;
int pos;
lib_hbar_static(drvthis, x, y, len, promille, options, p->cellwidth, 219);
for (pos = 0; pos < len; pos++) {
if (pixels >= GLCD_FONT_WIDTH )
t6963_chr(drvthis, x + pos, y, 0x9e);
else if (pixels >= 1)
t6963_chr(drvthis, x + pos, y, 0x99 + pixels);
else
; /* do nothing */
pixels -= GLCD_FONT_WIDTH;
}
}
/**
* API: Sets an icon...
*/
MODULE_EXPORT int
t6963_icon(Driver * drvthis, int x, int y, int icon)
t6963_icon(Driver *drvthis, int x, int y, int icon)
{
debug(RPT_DEBUG, "T6963: set icon %d", icon);
switch (icon) {
case ICON_BLOCK_FILLED:
t6963_chr(drvthis, x, y, 219);
break;
case ICON_HEART_FILLED:
t6963_chr(drvthis, x, y, 3);
break;
case ICON_HEART_OPEN:
t6963_chr(drvthis, x, y, 4);
break;
default:
return -1;
}
return 0;
return (glcd_icon5x8(drvthis, x, y, icon));
}
@@ -466,7 +450,7 @@ t6963_icon(Driver * drvthis, int x, int y, int icon)
* \return 0 on success, -1 if ready could not be read
*/
static inline int
t6963_low_dsp_ready(Driver * drvthis, u8 sta)
t6963_low_dsp_ready(Driver *drvthis, u8 sta)
{
PrivateData *p = drvthis->private_data;
int portcontrol = 0;
@@ -515,7 +499,7 @@ t6963_low_dsp_ready(Driver * drvthis, u8 sta)
* \param byte Data byte.
*/
static inline void
t6963_low_send(Driver * drvthis, u8 type, u8 byte)
t6963_low_send(Driver *drvthis, u8 type, u8 byte)
{
PrivateData *p = drvthis->private_data;
int portcontrol = 0;
@@ -539,7 +523,7 @@ t6963_low_send(Driver * drvthis, u8 type, u8 byte)
* \param byte Data byte.
*/
static void
t6963_low_data(Driver * drvthis, u8 byte)
t6963_low_data(Driver *drvthis, u8 byte)
{
t6963_low_dsp_ready(drvthis, STA0|STA1);
t6963_low_send(drvthis, T_DATA, byte);
@@ -551,7 +535,7 @@ t6963_low_data(Driver * drvthis, u8 byte)
* \param byte Command byte.
*/
static void
t6963_low_command(Driver * drvthis, u8 byte)
t6963_low_command(Driver *drvthis, u8 byte)
{
t6963_low_dsp_ready(drvthis, STA0|STA1);
t6963_low_send(drvthis, T_CMD, byte);
@@ -577,7 +561,7 @@ t6963_low_auto_write(Driver *drvthis, u8 byte)
* \param byte Data value.
*/
static void
t6963_low_command_byte(Driver * drvthis, u8 cmd, u8 byte)
t6963_low_command_byte(Driver *drvthis, u8 cmd, u8 byte)
{
t6963_low_data(drvthis, byte);
t6963_low_command(drvthis, cmd);
@@ -591,7 +575,7 @@ t6963_low_command_byte(Driver * drvthis, u8 cmd, u8 byte)
* \param word Data value (2 bytes)
*/
static void
t6963_low_command_word(Driver * drvthis, u8 cmd, u16 word)
t6963_low_command_word(Driver *drvthis, u8 cmd, u16 word)
{
t6963_low_data(drvthis, word & 0xFF);
t6963_low_data(drvthis, (word >> 8) & 0xFF);
+11 -5
View File
@@ -16,14 +16,20 @@
#define DEFAULT_CELL_WIDTH 6
#define DEFAULT_CELL_HEIGHT 8
#define DEFAULT_SIZE "20x6"
#define DEFAULT_SIZE "128x64"
#define DEFAULT_PORT 0x378
#define T6963_MAX_WIDTH 40 /* These value are for 240x128 */
#define T6963_MAX_HEIGHT 16
/*
* These are the maximum values the controller supports in single-scan
* setting (note that heigth of 128 is possible with dual-scan setting, too.
* This will not work with this driver, but there is no possibility to check
* this in software.
*/
#define T6963_MAX_WIDTH 80 * DEFAULT_CELL_WIDTH
#define T6963_MAX_HEIGHT 128
/* RAM layout base addresses (for 8 KB RAM) */
#define TEXT_BASE 0x0000 /* 1K, fine for 40x16 */
/* RAM layout base addresses (suitable for 8 KB RAM) */
#define TEXT_BASE 0x0000 /* 1K, fine for 40x16 or 80x8 */
#define GRAPHIC_BASE 0x0400 /* 5K, fine for 240x128 */
#define CHARGEN_BASE 0x1800 /* 2K, required for 256 CC */