Fix the last line not being used by custom characters (ID: 3466136). There
was a lastline setting used which was neither initialized nor read from config. While there, re-comment the file.
This commit is contained in:
@@ -22,6 +22,7 @@ v0.5dev (ongoing development)
|
|||||||
* lcdproc client: On FreeBSD show only unique processes in 'S' screen
|
* lcdproc client: On FreeBSD show only unique processes in 'S' screen
|
||||||
* picolcd: Use libusb-1.0 asynchronous transfers to fix missed keys (M. Jones)
|
* picolcd: Use libusb-1.0 asynchronous transfers to fix missed keys (M. Jones)
|
||||||
* sed1520: Make it work without using an external inverter
|
* sed1520: Make it work without using an external inverter
|
||||||
|
* lis driver: Make the last pixel row work (add lastline option parsing)
|
||||||
|
|
||||||
v0.5.5
|
v0.5.5
|
||||||
+ sed1330 driver: Add support for HG25504 (L. Lagendijk)
|
+ sed1330 driver: Add support for HG25504 (L. Lagendijk)
|
||||||
|
|||||||
@@ -783,6 +783,10 @@ Size=16x2
|
|||||||
# Change only if testing a compatible device.
|
# Change only if testing a compatible device.
|
||||||
#ProductID=0x6001
|
#ProductID=0x6001
|
||||||
|
|
||||||
|
# Specifies if the last line is pixel addressable (yes) or it only controls an
|
||||||
|
# underline effect (no). [default: yes; legal: yes, no]
|
||||||
|
#Lastline=yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##The driver for the VFD of the Medion MD8800 PC ##
|
##The driver for the VFD of the Medion MD8800 PC ##
|
||||||
|
|||||||
+130
-158
@@ -1,30 +1,23 @@
|
|||||||
/** \file server/drivers/lis.c
|
/** \file server/drivers/lis.c
|
||||||
* LCDd \c lis driver for the L.I.S MCE VFD by vlsys.co.kr.
|
* LCDd \c lis driver for the L.I.S MCE VFD by vlsys.co.kr. This is a 20x2 VFD
|
||||||
|
* using NEC UPD16314 driver and FTDI FT232RQ USB-to-serial converter.
|
||||||
|
*
|
||||||
|
* \note This driver uses the libftdi library to interface to the FTDI chip.
|
||||||
|
* Make sure kernel module ftdi_sio doesn't claim the device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*-
|
||||||
* LIS driver for lcdproc
|
* Copyright (c) 2007, Daryl Fonseca-Holt <wyatt@prairieturtle.ca>
|
||||||
* For the L.I.S MCE vacuum fluorescent display from vlsys.co.kr
|
|
||||||
* 20x2 display using NEC UPD16314 driver and FTDI FT232RQ USB-to-serial
|
|
||||||
* converter.
|
|
||||||
*
|
*
|
||||||
* This driver uses the libftdi library to interface to the FTDI chip. Make
|
* Based on:
|
||||||
* sure kernel module ftdi_sio doesn't claim the device.
|
* ula200 driver, Copyright (C) 2006, Bernhard Walle
|
||||||
*
|
* IOWarrior driver, Copyright(C) 2004-2006 Peter Marschall <peter@adpm.de>
|
||||||
* Based on: ula200 driver Copyright (C) 2006, Bernhard Walle
|
|
||||||
* IOWarrior driver Copyright(C) 2004-2006 Peter Marschall <peter@adpm.de>
|
|
||||||
*
|
|
||||||
* Copyright (c) 2007, Daryl Fonseca-Holt <wyatt@prairieturtle.ca>
|
|
||||||
*
|
*
|
||||||
* This file is released under the GNU General Public License. Refer to the
|
* This file is released under the GNU General Public License. Refer to the
|
||||||
* COPYING file distributed with this package.
|
* COPYING file distributed with this package.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*-
|
||||||
* Notes on this driver
|
* Notes on this driver
|
||||||
*
|
*
|
||||||
* vlsys is unwilling to provide information about the protocol for this
|
* vlsys is unwilling to provide information about the protocol for this
|
||||||
@@ -37,21 +30,9 @@
|
|||||||
* was which line would be written at column 1.
|
* was which line would be written at column 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* CHANGES:
|
#ifdef HAVE_CONFIG_H
|
||||||
*
|
# include "config.h"
|
||||||
* 2007/05/22 Removed useless Device= config option.
|
#endif
|
||||||
* Added VendorID= and ProductID= config
|
|
||||||
* option parsting. Moved constants to
|
|
||||||
* lis.h where they belong. Added
|
|
||||||
* lis_cellheight() and lis_cellwidth().
|
|
||||||
* Completely commented out lis_test() to
|
|
||||||
* save memory.
|
|
||||||
* 2007/05/30 Remove set_custom_chars(). Implement
|
|
||||||
* lis_set_chars(), lis_vbar(), lis_hbar()
|
|
||||||
* and lis_num() using helper functions.
|
|
||||||
* 2007/11/01 Change Linux-centric clone() to POSIX
|
|
||||||
* threads for portability.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -63,10 +44,6 @@
|
|||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#include <ftdi.h>
|
#include <ftdi.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "lis.h"
|
#include "lis.h"
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
@@ -83,24 +60,13 @@ MODULE_EXPORT int supports_multiple = 1;
|
|||||||
MODULE_EXPORT char *symbol_prefix = "lis_";
|
MODULE_EXPORT char *symbol_prefix = "lis_";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Charactar mapping for UPD16314 device by Daryl Fonseca-Holt
|
* UPD16314 table. Charactar mapping for UPD16314 device by Daryl Fonseca-Holt
|
||||||
* <wyatt@prairieturtle.ca> taken from Mark Haemmerling's HD44780 table.
|
* <wyatt@prairieturtle.ca> taken from Mark Haemmerling's HD44780 table.
|
||||||
* Character mapping for HD44780 devices by Mark Haemmerling <mail@markh.de>.
|
* Character mapping for HD44780 devices by Mark Haemmerling <mail@markh.de>.
|
||||||
*
|
*
|
||||||
* Translates ISO 8859-1 to any HD44780 charset.
|
* Translates ISO 8859-1 to any HD44780 charset.
|
||||||
*
|
|
||||||
* Charmap selector (C) 2006 Pillon Matteo <matteo.pillon@email.it>
|
|
||||||
*
|
|
||||||
* This file is released under the GNU General Public License.
|
|
||||||
* Refer to the COPYING file distributed with this package.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* UPD16314 table
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const unsigned char UPD16314_charmap[] = {
|
const unsigned char UPD16314_charmap[] = {
|
||||||
/* #0 */
|
/* #0 */
|
||||||
0, 1, 2, 3, 4, 5, 6, 7,
|
0, 1, 2, 3, 4, 5, 6, 7,
|
||||||
@@ -144,12 +110,14 @@ const unsigned char UPD16314_charmap[] = {
|
|||||||
248, 249, 250, 251, 252, 253, 254, 1
|
248, 249, 250, 251, 252, 253, 254, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/**
|
||||||
// Cache standard custom chars
|
* Setup standard custom chars. By default, the full block character is placed
|
||||||
void
|
* at 0x01 as the UPD16314 has none.
|
||||||
lis_standard_custom_chars (Driver *drvthis) {
|
*/
|
||||||
|
static void
|
||||||
PrivateData *p = drvthis->private_data;
|
lis_standard_custom_chars (Driver *drvthis)
|
||||||
|
{
|
||||||
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
static unsigned char checkbox_gray[] =
|
static unsigned char checkbox_gray[] =
|
||||||
{ b_______,
|
{ b_______,
|
||||||
@@ -171,21 +139,19 @@ PrivateData *p = drvthis->private_data;
|
|||||||
b__XXXXX,
|
b__XXXXX,
|
||||||
b__XXXXX };
|
b__XXXXX };
|
||||||
|
|
||||||
lis_set_char(drvthis, 1, block_filled);
|
lis_set_char(drvthis, 1, block_filled);
|
||||||
lis_set_char(drvthis, 2, checkbox_gray);
|
lis_set_char(drvthis, 2, checkbox_gray);
|
||||||
|
p->ccmode = standard;
|
||||||
p->ccmode = standard;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Write a command to the display.
|
* Write a command to the display.
|
||||||
//
|
*
|
||||||
// @param p the private data
|
* \param drvthis Pointer to Driver
|
||||||
// @param data the data bytes
|
* \param data Data bytes
|
||||||
// @param length the number of bytes in @p data which are valid
|
* \param length The number of bytes in data which are valid
|
||||||
// @return 0 on success, negative value on error
|
* \return 0 on success, negative value on error
|
||||||
//
|
*/
|
||||||
static int
|
static int
|
||||||
lis_ftdi_write_command(Driver *drvthis, unsigned char *data, int length)
|
lis_ftdi_write_command(Driver *drvthis, unsigned char *data, int length)
|
||||||
{
|
{
|
||||||
@@ -203,9 +169,16 @@ lis_ftdi_write_command(Driver *drvthis, unsigned char *data, int length)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Displays a string at line n (n typically 1 or 2)
|
* Displays a string at line n (n typically 1 or 2), starting in the first
|
||||||
//
|
* column.
|
||||||
|
*
|
||||||
|
* \param drvthis Pointer to Driver
|
||||||
|
* \param line The line number (counting from 1)
|
||||||
|
* \param string Pointer to data bytes
|
||||||
|
* \param len The number of bytes in string which are valid
|
||||||
|
* \return 0 on success, negative value on error
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
lis_ftdi_line_to_display(Driver *drvthis, int line, unsigned char *string, int len)
|
lis_ftdi_line_to_display(Driver *drvthis, int line, unsigned char *string, int len)
|
||||||
{
|
{
|
||||||
@@ -236,9 +209,9 @@ lis_ftdi_line_to_display(Driver *drvthis, int line, unsigned char *string, int l
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Flush the framebuffer to the display
|
* API: Flush the framebuffer to the display.
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
lis_flush(Driver *drvthis)
|
lis_flush(Driver *drvthis)
|
||||||
{
|
{
|
||||||
@@ -304,12 +277,11 @@ lis_read_thread(void *arg)
|
|||||||
}
|
}
|
||||||
p->parent_flag = 0;
|
p->parent_flag = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Control the display brightness
|
* API: Control the display brightness
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_set_brightness(Driver *drvthis, int state, int promille)
|
lis_set_brightness(Driver *drvthis, int state, int promille)
|
||||||
{
|
{
|
||||||
@@ -319,37 +291,37 @@ lis_set_brightness(Driver *drvthis, int state, int promille)
|
|||||||
|
|
||||||
if (promille < 0 || promille > 1000) {
|
if (promille < 0 || promille > 1000) {
|
||||||
report(RPT_WARNING, "%s: invalid brightness %d less then 0 or greater than 1000",
|
report(RPT_WARNING, "%s: invalid brightness %d less then 0 or greater than 1000",
|
||||||
drvthis->name, promille);
|
drvthis->name, promille);
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[0] = 0xA5;
|
buffer[0] = 0xA5;
|
||||||
if ( promille < 251 )
|
if (promille < 251)
|
||||||
buffer[1] = 0x3; // 25%
|
buffer[1] = 0x3;/* 25% */
|
||||||
else if ( promille < 501 )
|
else if (promille < 501)
|
||||||
buffer[1] = 0x2; // 50%
|
buffer[1] = 0x2;/* 50% */
|
||||||
else if ( promille < 751 )
|
else if (promille < 751)
|
||||||
buffer[1] = 0x1; // 75%
|
buffer[1] = 0x1;/* 75% */
|
||||||
else
|
else
|
||||||
buffer[1] = 0x0; // 100%
|
buffer[1] = 0x0;/* 100% */
|
||||||
|
|
||||||
err = ftdi_write_data(&p->ftdic, buffer, 2);
|
err = ftdi_write_data(&p->ftdic, buffer, 2);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
report(RPT_WARNING, "%s: lis_set_brightness(): ftdi_write_data failed with %d", drvthis->name, err);
|
report(RPT_WARNING, "%s: lis_set_brightness(): ftdi_write_data failed with %d",
|
||||||
|
drvthis->name, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p->brightness = promille;
|
p->brightness = promille;
|
||||||
|
|
||||||
report(RPT_DEBUG, "%s: brightness set to %d",
|
report(RPT_DEBUG, "%s: brightness set to %d", drvthis->name, promille);
|
||||||
drvthis->name, promille);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/***
|
||||||
// Get the brightness setting
|
* API: Get the brightness setting
|
||||||
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_get_brightness(Driver *drvthis, int state)
|
lis_get_brightness(Driver *drvthis, int state)
|
||||||
{
|
{
|
||||||
@@ -361,9 +333,9 @@ lis_get_brightness(Driver *drvthis, int state)
|
|||||||
return p->brightness;
|
return p->brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Init the driver and display
|
* API: Init the driver and display
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_init(Driver *drvthis)
|
lis_init(Driver *drvthis)
|
||||||
{
|
{
|
||||||
@@ -405,7 +377,7 @@ lis_init(Driver *drvthis)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (count = 0; count < p->height; count++)
|
for (count = 0; count < p->height; count++)
|
||||||
p->line_flags[count] = 1; // dirty!
|
p->line_flags[count] = 1; /* dirty! */
|
||||||
|
|
||||||
/* Which display brightness */
|
/* Which display brightness */
|
||||||
count = drvthis->config_get_int(drvthis->name, "Brightness", 0, DEFAULT_BRIGHTNESS);
|
count = drvthis->config_get_int(drvthis->name, "Brightness", 0, DEFAULT_BRIGHTNESS);
|
||||||
@@ -419,6 +391,7 @@ lis_init(Driver *drvthis)
|
|||||||
p->VendorID = drvthis->config_get_int(drvthis->name, "VendorID", 0, DISPLAY_VENDOR_ID);
|
p->VendorID = drvthis->config_get_int(drvthis->name, "VendorID", 0, DISPLAY_VENDOR_ID);
|
||||||
p->ProductID = drvthis->config_get_int(drvthis->name, "ProductID", 0, DISPLAY_PRODUCT_ID);
|
p->ProductID = drvthis->config_get_int(drvthis->name, "ProductID", 0, DISPLAY_PRODUCT_ID);
|
||||||
|
|
||||||
|
p->lastline = drvthis->config_get_bool(drvthis->name, "lastline", 0, 1);
|
||||||
/* End of config file parsing */
|
/* End of config file parsing */
|
||||||
|
|
||||||
|
|
||||||
@@ -1164,18 +1137,17 @@ err_begin:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Clean-up
|
* API: Clean-up
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
lis_close(Driver *drvthis)
|
lis_close(Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
|
|
||||||
report(RPT_DEBUG, "%s: closing driver",
|
report(RPT_DEBUG, "%s: closing driver", drvthis->name);
|
||||||
drvthis->name);
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
if (p->parent_flag) { // terminate the child
|
if (p->parent_flag) { /* terminate the child */
|
||||||
p->child_flag = 1;
|
p->child_flag = 1;
|
||||||
while(p->parent_flag)
|
while(p->parent_flag)
|
||||||
timing_uPause(5*16000);
|
timing_uPause(5*16000);
|
||||||
@@ -1185,16 +1157,16 @@ lis_close(Driver *drvthis)
|
|||||||
ftdi_deinit(&p->ftdic);
|
ftdi_deinit(&p->ftdic);
|
||||||
|
|
||||||
if (p->framebuf != NULL)
|
if (p->framebuf != NULL)
|
||||||
free(p->framebuf);
|
free(p->framebuf);
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
drvthis->store_private_ptr(drvthis, NULL);
|
drvthis->store_private_ptr(drvthis, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Returns the display width
|
* API: Returns the display width
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_width (Driver *drvthis)
|
lis_width (Driver *drvthis)
|
||||||
{
|
{
|
||||||
@@ -1203,28 +1175,27 @@ lis_width (Driver *drvthis)
|
|||||||
return p->width;
|
return p->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Returns the display height
|
* API: Returns the display height
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_height (Driver *drvthis)
|
lis_height(Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
|
|
||||||
return p->height;
|
return p->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Clear the framebuffer
|
* API: Clear the framebuffer
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
lis_clear (Driver *drvthis)
|
lis_clear(Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
int line;
|
int line;
|
||||||
|
|
||||||
report(RPT_DEBUG, "%s: Clearing display",
|
report(RPT_DEBUG, "%s: Clearing display", drvthis->name);
|
||||||
drvthis->name);
|
|
||||||
for (line = 0; line < p->height; line++) {
|
for (line = 0; line < p->height; line++) {
|
||||||
memset(p->framebuf + (line * p->width), ' ', p->width);
|
memset(p->framebuf + (line * p->width), ' ', p->width);
|
||||||
p->line_flags[line] = 1;
|
p->line_flags[line] = 1;
|
||||||
@@ -1232,70 +1203,71 @@ lis_clear (Driver *drvthis)
|
|||||||
lis_standard_custom_chars(drvthis);
|
lis_standard_custom_chars(drvthis);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Place a character in the framebuffer
|
* API: Place a character in the framebuffer
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
lis_chr (Driver *drvthis, int x, int y, unsigned char ch)
|
lis_chr(Driver *drvthis, int x, int y, unsigned char ch)
|
||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
|
|
||||||
// ignore out-of-range
|
/* ignore out-of-range */
|
||||||
if (y > p->height || x > p->width) {
|
if (y > p->height || x > p->width) {
|
||||||
report(RPT_WARNING, "%s: Writing char %x at %d,%d"
|
report(RPT_WARNING, "%s: Writing char %x at %d,%d"
|
||||||
" ignored out of range %d,%d",
|
" ignored out of range %d,%d",
|
||||||
drvthis->name, ch, x, y, p->height, p->width);
|
drvthis->name, ch, x, y, p->height, p->width);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
y--;
|
y--;
|
||||||
x--;
|
x--;
|
||||||
|
|
||||||
if ( p->framebuf[ (y * p->width) + x] != ch) {
|
if (p->framebuf[(y * p->width) + x] != ch) {
|
||||||
p->framebuf[ (y * p->width) + x] = ch;
|
p->framebuf[(y * p->width) + x] = ch;
|
||||||
|
|
||||||
p->line_flags[y] = 1;
|
p->line_flags[y] = 1;
|
||||||
report(RPT_DEBUG, "%s: Caching char %x at %d,%d",
|
report(RPT_DEBUG, "%s: Caching char %x at %d,%d",
|
||||||
drvthis->name, ch, x, y);
|
drvthis->name, ch, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Place a string in the framebuffer
|
* API: Place a string in the framebuffer
|
||||||
//
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
lis_string (Driver *drvthis, int x, int y, char *s)
|
lis_string(Driver *drvthis, int x, int y, char *s)
|
||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
x --; // Convert 1-based coords to 0-based
|
x--; /* Convert 1-based coords to 0-based */
|
||||||
y --;
|
y--;
|
||||||
|
|
||||||
report(RPT_DEBUG, "%s: Write string to framebuffer %d,%d \"%s\"",
|
report(RPT_DEBUG, "%s: Write string to framebuffer %d,%d \"%s\"",
|
||||||
drvthis->name, x, y, s);
|
drvthis->name, x, y, s);
|
||||||
|
|
||||||
for (i = 0; s[i]; i++) {
|
for (i = 0; s[i]; i++) {
|
||||||
// Check for buffer overflows...
|
/* Check for buffer overflows... */
|
||||||
if ((y * p->width) + x + i > (p->width * p->height)) {
|
if ((y * p->width) + x + i > (p->width * p->height)) {
|
||||||
report(RPT_WARNING, "%s: Writing string ignored, out of range",
|
report(RPT_WARNING, "%s: Writing string ignored, out of range",
|
||||||
drvthis->name, x, y);
|
drvthis->name, x, y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p->framebuf[(y*p->width) + x + i] != s[i] ) {
|
if (p->framebuf[(y * p->width) + x + i] != s[i]) {
|
||||||
p->framebuf[(y*p->width) + x + i] = s[i];
|
p->framebuf[(y * p->width) + x + i] = s[i];
|
||||||
p->line_flags[((y*p->width) + x + i ) / p->width ] = 1; // dirty
|
p->line_flags[((y * p->width) + x + i) / p->width] = 1; /* dirty */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Set default icon into a userdef char
|
* API: Place an icon on the screen. The uPD16314 comes with a lot of icons
|
||||||
//
|
* already in CGROM, so use them.
|
||||||
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_icon (Driver *drvthis, int x, int y, int icon)
|
lis_icon(Driver *drvthis, int x, int y, int icon)
|
||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
unsigned char ch;
|
unsigned char ch;
|
||||||
@@ -1409,9 +1381,9 @@ lis_set_char(Driver *drvthis, int n, unsigned char *dat)
|
|||||||
|
|
||||||
|
|
||||||
if ((n < 0) || (n >= NUM_CCs))
|
if ((n < 0) || (n >= NUM_CCs))
|
||||||
return;
|
return;
|
||||||
if (dat == NULL)
|
if (dat == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (row = 0; row < p->cellheight; row++) {
|
for (row = 0; row < p->cellheight; row++) {
|
||||||
int letter = 0;
|
int letter = 0;
|
||||||
@@ -1420,12 +1392,12 @@ lis_set_char(Driver *drvthis, int n, unsigned char *dat)
|
|||||||
letter = dat[row] & mask;
|
letter = dat[row] & mask;
|
||||||
|
|
||||||
if (p->cc[n].cache[row] != letter) {
|
if (p->cc[n].cache[row] != letter) {
|
||||||
p->cc[n].clean = 0; /* only mark dirty if really different */
|
p->cc[n].clean = 0; /* only mark dirty if really
|
||||||
}
|
* different */
|
||||||
|
}
|
||||||
p->cc[n].cache[row] = letter;
|
p->cc[n].cache[row] = letter;
|
||||||
}
|
}
|
||||||
report(RPT_DEBUG, "%s: cached custom character #%d",
|
report(RPT_DEBUG, "%s: cached custom character #%d", drvthis->name, n);
|
||||||
drvthis->name, n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1530,7 +1502,7 @@ lis_num(Driver *drvthis, int x, int num)
|
|||||||
if (p->ccmode != standard) {
|
if (p->ccmode != standard) {
|
||||||
/* Not supported (yet) */
|
/* Not supported (yet) */
|
||||||
report(RPT_WARNING, "%s: num: cannot combine two modes using user-defined characters",
|
report(RPT_WARNING, "%s: num: cannot combine two modes using user-defined characters",
|
||||||
drvthis->name);
|
drvthis->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1538,11 +1510,12 @@ lis_num(Driver *drvthis, int x, int num)
|
|||||||
|
|
||||||
do_init = 1;
|
do_init = 1;
|
||||||
}
|
}
|
||||||
report(RPT_DEBUG, "%s: big number %d @ %d",
|
report(RPT_DEBUG, "%s: big number %d @ %d", drvthis->name, x, num);
|
||||||
drvthis->name, x, num);
|
|
||||||
|
|
||||||
// Lib_adv_bignum does everything needed to show the bignumbers.
|
/*
|
||||||
// offset by 2 because driver uses first three custom characters
|
* Lib_adv_bignum does everything needed to show the bignumbers.
|
||||||
|
* offset by 2 because driver uses first three custom characters
|
||||||
|
*/
|
||||||
lib_adv_bignum(drvthis, x, num, 3, do_init);
|
lib_adv_bignum(drvthis, x, num, 3, do_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1553,10 +1526,9 @@ lis_num(Driver *drvthis, int x, int num)
|
|||||||
* \return Number of custom characters.
|
* \return Number of custom characters.
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
lis_get_free_chars (Driver *drvthis)
|
lis_get_free_chars(Driver *drvthis)
|
||||||
{
|
{
|
||||||
//PrivateData *p = drvthis->private_data;
|
return NUM_CCs - 3; /* first three are reserved */
|
||||||
|
|
||||||
return NUM_CCs - 3; // first three are reserved
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|||||||
+39
-54
@@ -1,33 +1,18 @@
|
|||||||
|
/*-
|
||||||
/*
|
* Copyright (c) 2007, Daryl Fonseca-Holt <wyatt@prairieturtle.ca>
|
||||||
Based on the lis driver Copyright (C) 2006, Bernhard Walle
|
*
|
||||||
Copyright (c) 2007, Daryl Fonseca-Holt <wyatt@prairieturtle.ca>
|
* Based on:
|
||||||
|
* ula200 driver, Copyright (C) 2006, Bernhard Walle
|
||||||
This program is free software; you can redistribute it and/or modify
|
* IOWarrior driver, Copyright(C) 2004-2006 Peter Marschall <peter@adpm.de>
|
||||||
it under the terms of the GNU General Public License as published by
|
*
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
* This file is released under the GNU General Public License. Refer to the
|
||||||
any later version.
|
* COPYING file distributed with this package.
|
||||||
|
*/
|
||||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */
|
|
||||||
#ifndef LIS_H
|
#ifndef LIS_H
|
||||||
#define LIS_H
|
#define LIS_H
|
||||||
|
|
||||||
#ifndef bool
|
/*----------------------------- Constants ---------------------------------*/
|
||||||
# define bool short
|
|
||||||
# define true 1
|
|
||||||
# define false 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// constants
|
|
||||||
//
|
|
||||||
#define DISPLAY_VENDOR_ID 0x0403
|
#define DISPLAY_VENDOR_ID 0x0403
|
||||||
#define DISPLAY_PRODUCT_ID 0x6001
|
#define DISPLAY_PRODUCT_ID 0x6001
|
||||||
|
|
||||||
@@ -39,9 +24,8 @@
|
|||||||
#define NUM_CCs 8
|
#define NUM_CCs 8
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/*------------------------ Private data types -----------------------------*/
|
||||||
// private data types
|
|
||||||
//
|
|
||||||
typedef struct cgram_cache {
|
typedef struct cgram_cache {
|
||||||
unsigned char cache[CELLHEIGHT];
|
unsigned char cache[CELLHEIGHT];
|
||||||
int clean;
|
int clean;
|
||||||
@@ -50,60 +34,61 @@ typedef struct cgram_cache {
|
|||||||
|
|
||||||
/** private data for the \c lis driver */
|
/** private data for the \c lis driver */
|
||||||
typedef struct lis_private_data {
|
typedef struct lis_private_data {
|
||||||
// the handle for the USB FTDI library
|
/* the handle for the USB FTDI library */
|
||||||
struct ftdi_context ftdic;
|
struct ftdi_context ftdic;
|
||||||
|
|
||||||
// the width and the height (in number of characters) of the display
|
/* the width and the height (in number of characters) of the display */
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
// pixel width and height of each character
|
/* pixel width and height of each character */
|
||||||
int cellwidth, cellheight;
|
int cellwidth, cellheight;
|
||||||
|
|
||||||
// The framebuffer and the framebuffer for the last contents (incr. update)
|
/* The framebuffer and the framebuffer for the last contents (incr. update) */
|
||||||
unsigned char *framebuf;
|
unsigned char *framebuf;
|
||||||
|
|
||||||
// dirty line flags
|
/* dirty line flags */
|
||||||
unsigned int *line_flags;
|
unsigned int *line_flags;
|
||||||
|
|
||||||
// child thread flag
|
/* child thread flag */
|
||||||
int child_flag;
|
int child_flag;
|
||||||
|
|
||||||
// parent thread flag
|
/* parent thread flag */
|
||||||
int parent_flag;
|
int parent_flag;
|
||||||
|
|
||||||
// display brightness 0-1000
|
/* display brightness 0-1000 */
|
||||||
int brightness;
|
int brightness;
|
||||||
|
|
||||||
// ustom characters
|
/* custom characters */
|
||||||
CGram cc[NUM_CCs];
|
CGram cc[NUM_CCs];
|
||||||
CGmode ccmode;
|
CGmode ccmode;
|
||||||
|
|
||||||
// USB Vendor ID
|
/* USB Vendor ID */
|
||||||
int VendorID;
|
int VendorID;
|
||||||
|
|
||||||
// USB Product ID
|
/* USB Product ID */
|
||||||
int ProductID;
|
int ProductID;
|
||||||
|
|
||||||
/* lastline controls the use of the last line, if pixel addressable (true, default) or */
|
/*
|
||||||
/* underline effect (false). To avoid the underline effect in the latter case, the last */
|
* flag if the last row of each character can be set when defining
|
||||||
/* line is always zeroed for whatever redefined character */
|
* custom characters.
|
||||||
|
*/
|
||||||
char lastline;
|
char lastline;
|
||||||
} PrivateData;
|
} PrivateData;
|
||||||
|
|
||||||
|
|
||||||
MODULE_EXPORT int lis_init(Driver *drvthis);
|
MODULE_EXPORT int lis_init(Driver *drvthis);
|
||||||
MODULE_EXPORT void lis_close (Driver *drvthis);
|
MODULE_EXPORT void lis_close(Driver *drvthis);
|
||||||
MODULE_EXPORT int lis_width (Driver *drvthis);
|
MODULE_EXPORT int lis_width(Driver *drvthis);
|
||||||
MODULE_EXPORT int lis_height (Driver *drvthis);
|
MODULE_EXPORT int lis_height(Driver *drvthis);
|
||||||
MODULE_EXPORT void lis_clear (Driver * drvthis);
|
MODULE_EXPORT void lis_clear(Driver * drvthis);
|
||||||
MODULE_EXPORT void lis_string (Driver * drvthis, int x, int y, char string[]);
|
MODULE_EXPORT void lis_string(Driver * drvthis, int x, int y, char string[]);
|
||||||
MODULE_EXPORT void lis_chr (Driver * drvthis, int x, int y, unsigned char c);
|
MODULE_EXPORT void lis_chr(Driver * drvthis, int x, int y, unsigned char c);
|
||||||
MODULE_EXPORT void lis_flush (Driver * drvthis);
|
MODULE_EXPORT void lis_flush(Driver * drvthis);
|
||||||
MODULE_EXPORT void lis_vbar (Driver * drvthis, int x, int y, int len, int promille, int options);
|
MODULE_EXPORT void lis_vbar(Driver * drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT void lis_hbar (Driver * drvthis, int x, int y, int len, int promille, int options);
|
MODULE_EXPORT void lis_hbar(Driver * drvthis, int x, int y, int len, int promille, int options);
|
||||||
MODULE_EXPORT int lis_icon(Driver * drvthis, int x, int y, int icon);
|
MODULE_EXPORT int lis_icon(Driver * drvthis, int x, int y, int icon);
|
||||||
MODULE_EXPORT int lis_cellheight (Driver *drvthis);
|
MODULE_EXPORT int lis_cellheight(Driver *drvthis);
|
||||||
MODULE_EXPORT int lis_cellwidth (Driver *drvthis);
|
MODULE_EXPORT int lis_cellwidth(Driver *drvthis);
|
||||||
MODULE_EXPORT void lis_num(Driver *drvthis, int x, int num);
|
MODULE_EXPORT void lis_num(Driver *drvthis, int x, int num);
|
||||||
MODULE_EXPORT int lis_get_free_chars(Driver *drvthis);
|
MODULE_EXPORT int lis_get_free_chars(Driver *drvthis);
|
||||||
MODULE_EXPORT void lis_set_char(Driver *drvthis, int n, unsigned char *dat);
|
MODULE_EXPORT void lis_set_char(Driver *drvthis, int n, unsigned char *dat);
|
||||||
|
|||||||
Reference in New Issue
Block a user