CFontzPacket updates:
- Add a structure describing known models, their features and default settings. - Use partial screen updates for newer CFA633 versions. - For CFA533/633 use the same character mapping as for HD44780. - Fixed a few typos. - Use C-style comments only. - Add a warning about the driver being deprecated to CFontz633. Users should use CFontzPacket with Model=633 instead.
This commit is contained in:
@@ -24,6 +24,8 @@ v.0.5dev (ongoing development)
|
||||
* hd44780: Extended subdriver API and performance improvement for lcd2usb
|
||||
* hd44780: Add KOI8-R character mapping (Yura Scheglyuk)
|
||||
* shuttleVFD: Add support for devices with USB VID 0x1308 again
|
||||
* CFontzPacket: Add CFA-533. Use HD44780 character mapping for CFA533/633.
|
||||
* CFontz633: Deprecate this driver. Use CFontzPacket with Model=633 instead!
|
||||
|
||||
v0.5.3
|
||||
+ lcdexec: notification when called program finishes
|
||||
|
||||
@@ -181,6 +181,8 @@ Reboot=no
|
||||
|
||||
## CrystalFontz633 driver (for CF633 only) ##
|
||||
[CFontz633]
|
||||
# Note: Use of this driver is deprecated, please use CFontzPacket driver
|
||||
# with Model=633 instead.
|
||||
|
||||
# Select the output device to use [default: /dev/lcd]
|
||||
Device=/dev/ttyS0
|
||||
@@ -205,32 +207,46 @@ Reboot=yes
|
||||
|
||||
|
||||
|
||||
## CrystalFontz packet driver (for CF631, CF633 & CF635) ##
|
||||
## CrystalFontz packet driver (for CFA533, CFA631, CFA633 & CFA635) ##
|
||||
[CFontzPacket]
|
||||
|
||||
# Select the LCD model [default: 633; legal: 631, 633, 635]
|
||||
Model=635
|
||||
# Select the LCD model [default: 633; legal: 533, 631, 633, 635]
|
||||
Model=633
|
||||
|
||||
# Select the output device to use [default: /dev/lcd]
|
||||
Device=/dev/ttyUSB0
|
||||
# Select the LCD size [default: depending on model: 635: 20x4, 631: 20x2, 633: 16x2]
|
||||
Size=20x4
|
||||
|
||||
# Set the initial contrast [default: 560; legal: 0 - 1000]
|
||||
Contrast=350
|
||||
|
||||
# Set the initial brightness [default: 1000; legal: 0 - 1000]
|
||||
Brightness=1000
|
||||
|
||||
# Set the initial off-brightness [default: 0; legal: 0 - 1000]
|
||||
# This value is used when the display is normally
|
||||
# switched off in case LCDd is inactive
|
||||
OffBrightness=50
|
||||
# Set the communication speed [default: 9600; legal: 1200, 2400, 9600, 19200, 115200]
|
||||
Speed=115200
|
||||
# Set the firmware version (New means >= 2.0) [default: no; legal: yes, no]
|
||||
# Currently this flag is not in use, there is no such thing as NewFirmware. ;=)
|
||||
#NewFirmware=no
|
||||
# Reinitialize the LCD's BIOS [default: no; legal: yes, no]
|
||||
# I want to reboot the LCD to make sure we start from a known state
|
||||
|
||||
# Reinitialize the LCD's BIOS on driver start. [default: no; legal: yes, no]
|
||||
Reboot=yes
|
||||
|
||||
# Enable the USB flag if the device is connected to an USB port. For
|
||||
# serial ports leave it disabled. [default: no; legal: yes, no]
|
||||
#USB=yes
|
||||
|
||||
# Very old 633 firmware versions do not support partial screen updates using
|
||||
# 'Send Data to LCD' command (31). For those devices it may be necessary to
|
||||
# enable this flag. [default: no; legal: yes, no]
|
||||
#OldFirmware=yes
|
||||
|
||||
# Override the LCD size known for the selected model. Usually setting this
|
||||
# value should not be necessary.
|
||||
#Size=20x4
|
||||
|
||||
# Override the default communication speed known for the selected model.
|
||||
# [default: depending on model; legal: 19200, 115200]
|
||||
#Speed=115200
|
||||
|
||||
|
||||
|
||||
## Curses driver ##
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hd44780-charmap.h"
|
||||
|
||||
const unsigned char CFontz_charmap[] = { // mapped chars: ? means ToDo
|
||||
/* #0 */
|
||||
0, 1, 2, 3, 4, 5, 6, 7,
|
||||
|
||||
@@ -147,6 +147,9 @@ CFontz633_init (Driver *drvthis)
|
||||
|
||||
PrivateData *p;
|
||||
|
||||
report(RPT_WARNING, "Driver %s is deprecated! Use CFontzPacket instead",
|
||||
drvthis->name);
|
||||
|
||||
/* Allocate and store private data */
|
||||
p = (PrivateData *) calloc(1, sizeof(PrivateData));
|
||||
if (p == NULL)
|
||||
|
||||
@@ -36,7 +36,7 @@ MODULE_EXPORT void CFontz633_hbar (Driver *drvthis, int x, int y, int len, int p
|
||||
MODULE_EXPORT void CFontz633_num (Driver *drvthis, int x, int num);
|
||||
MODULE_EXPORT int CFontz633_icon(Driver *drvthis, int x, int y, int icon);
|
||||
|
||||
MODULE_EXPORT int CFontz633_iget_free_chars (Driver *drvthis);
|
||||
MODULE_EXPORT int CFontz633_get_free_chars (Driver *drvthis);
|
||||
MODULE_EXPORT void CFontz633_set_char (Driver *drvthis, int n, unsigned char *dat);
|
||||
|
||||
MODULE_EXPORT int CFontz633_get_contrast (Driver *drvthis);
|
||||
|
||||
@@ -518,8 +518,8 @@ test_packet(int fd, unsigned char response, COMMAND_PACKET *in)
|
||||
if (in->command == 0x80)
|
||||
AddKeyToKeyRing(&keyring, in->data[0]);
|
||||
else if (in->command == response)
|
||||
response_received = 1;
|
||||
}
|
||||
response_received = 1;
|
||||
}
|
||||
|
||||
is_msg = check_for_packet(fd, in, MAX_DATA_LENGTH);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#define CF633_Set_LCD_Contents_Line_One 7
|
||||
#define CF633_Set_LCD_Contents_Line_Two 8
|
||||
#define CF633_Set_LCD_Special_Character_Data 9
|
||||
#define CF633_Read_Height_Bytes_of_LCD_Memory 10
|
||||
#define CF633_Read_Eight_Bytes_of_LCD_Memory 10
|
||||
#define CF633_Set_LCD_Cursor_Position 11
|
||||
#define CF633_Set_LCD_Cursor_Style 12
|
||||
#define CF633_Set_LCD_Contrast 13
|
||||
|
||||
@@ -40,11 +40,7 @@
|
||||
* 03/09/2002: New icon incorporated
|
||||
* 27/01/2003: Adapted for CFontz 631
|
||||
* 16/05/2005: Adapted for CFontz 635
|
||||
*
|
||||
* THINGS NOT DONE:
|
||||
* + No checking if right hardware is connected (firmware/hardware)
|
||||
* + No support for multiple instance (private structure done)
|
||||
* + No cache of custom char usage (like in MtxOrb)
|
||||
* 24/01/2010: Add CFontz 533, add model description
|
||||
*
|
||||
* THINGS DONE:
|
||||
* + Stopping the live reporting (of temperature)
|
||||
@@ -128,10 +124,12 @@ typedef struct CFontzPacket_private_data {
|
||||
int fd;
|
||||
|
||||
int model;
|
||||
int newfirmware;
|
||||
int oldfirmware;
|
||||
int usb;
|
||||
int speed;
|
||||
|
||||
CFA_Model *model_desc;
|
||||
|
||||
/* dimensions */
|
||||
int width, height;
|
||||
int cellwidth, cellheight;
|
||||
@@ -152,6 +150,15 @@ typedef struct CFontzPacket_private_data {
|
||||
} PrivateData;
|
||||
|
||||
|
||||
static CFA_Model CFA_ModelList[] = {
|
||||
{533, "16x2", 19200 , HD44780_charmap, CFA_HAS_TEMP | CFA_HAS_4_TEMP_SLOTS},
|
||||
{631, "20x2", 115200, CFontz_charmap , CFA_HAS_FAN | CFA_HAS_TEMP |
|
||||
CFA_HAS_KS0073 | CFA_HAS_4_TEMP_SLOTS},
|
||||
{633, "16x2", 19200 , HD44780_charmap, CFA_HAS_FAN | CFA_HAS_TEMP},
|
||||
{635, "20x4", 115200, CFontz_charmap , CFA_HAS_KS0073},
|
||||
{0, NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
/* Vars for the server core */
|
||||
MODULE_EXPORT char *api_version = API_VERSION;
|
||||
MODULE_EXPORT int stay_in_foreground = 0;
|
||||
@@ -175,11 +182,9 @@ MODULE_EXPORT int
|
||||
CFontzPacket_init (Driver *drvthis)
|
||||
{
|
||||
struct termios portset;
|
||||
int tmp, w, h;
|
||||
int tmp, w, h, i;
|
||||
int cf_reboot = 0;
|
||||
char size[200] = DEFAULT_SIZE;
|
||||
int default_speed = DEFAULT_SPEED;
|
||||
char *default_size = DEFAULT_SIZE;
|
||||
|
||||
PrivateData *p;
|
||||
|
||||
@@ -203,42 +208,38 @@ CFontzPacket_init (Driver *drvthis)
|
||||
EmptyReceiveBuffer(&receivebuffer);
|
||||
|
||||
/* Read config file */
|
||||
/* Which model is it (CF633, CF631 or CF635)? */
|
||||
|
||||
/* Try to find a matching model from our list of known modules */
|
||||
tmp = drvthis->config_get_int(drvthis->name, "Model", 0, 633);
|
||||
debug(RPT_INFO, "%s: Model (in config) is '%d'", __FUNCTION__, tmp);
|
||||
if ((tmp != 631) && (tmp != 633) && (tmp != 635)) {
|
||||
tmp = 633;
|
||||
report(RPT_WARNING, "%s: Model must be 631, 633 or 635; using default %d",
|
||||
drvthis->name, tmp);
|
||||
i = 0;
|
||||
while ((CFA_ModelList[i].model != 0) && (CFA_ModelList[i].model != tmp)) {
|
||||
i++;
|
||||
}
|
||||
if (CFA_ModelList[i].model == 0) {
|
||||
report(RPT_ERR, "%s: Invalid model configured", drvthis->name);
|
||||
return -1;
|
||||
}
|
||||
p->model = tmp;
|
||||
|
||||
/* Determine size & speed depending on model */
|
||||
if (p->model == 631) {
|
||||
default_size = DEFAULT_SIZE_CF631;
|
||||
default_speed = DEFAULT_SPEED_CF631;
|
||||
} else if (p->model == 633) {
|
||||
default_size = DEFAULT_SIZE_CF633;
|
||||
default_speed = DEFAULT_SPEED_CF633;
|
||||
} else if (p->model == 635) {
|
||||
default_size = DEFAULT_SIZE_CF635;
|
||||
default_speed = DEFAULT_SPEED_CF635;
|
||||
}
|
||||
p->model_desc = &(CFA_ModelList[i]);
|
||||
report(RPT_INFO, "%s: Found configuration for %d", __FUNCTION__, p->model_desc->model);
|
||||
debug(RPT_INFO, "%s: Flags are 0x%04X", __FUNCTION__, p->model_desc->flags);
|
||||
|
||||
/* Which device should be used */
|
||||
strncpy(p->device, drvthis->config_get_string(drvthis->name, "Device", 0, DEFAULT_DEVICE), sizeof(p->device));
|
||||
p->device[sizeof(p->device)-1] = '\0';
|
||||
report(RPT_INFO, "%s: using Device %s", drvthis->name, p->device);
|
||||
|
||||
strncpy(size, drvthis->config_get_string(drvthis->name, "Size", 0, default_size), sizeof(size));
|
||||
/* Size setting */
|
||||
strncpy(size, drvthis->config_get_string(drvthis->name, "Size", 0, p->model_desc->size), sizeof(size));
|
||||
size[sizeof(size)-1] = '\0';
|
||||
debug(RPT_INFO, "%s: Size (in config) is '%s'", __FUNCTION__, size);
|
||||
if ((sscanf(size, "%dx%d", &w, &h) != 2)
|
||||
|| (w <= 0) || (w > LCD_MAX_WIDTH)
|
||||
|| (h <= 0) || (h > LCD_MAX_HEIGHT)) {
|
||||
report(RPT_WARNING, "%s: cannot parse Size: %s; using default %s",
|
||||
drvthis->name, size, default_size);
|
||||
sscanf(default_size, "%dx%d", &w, &h);
|
||||
drvthis->name, size, p->model_desc->size);
|
||||
sscanf(p->model_desc->size, "%dx%d", &w, &h);
|
||||
}
|
||||
p->width = w;
|
||||
p->height = h;
|
||||
@@ -275,21 +276,18 @@ CFontzPacket_init (Driver *drvthis)
|
||||
}
|
||||
p->offbrightness = tmp;
|
||||
|
||||
/* Which speed ? CF633 support 19200 only, CF631 & CF635 USB use 115200. */
|
||||
tmp = drvthis->config_get_int(drvthis->name, "Speed", 0, default_speed);
|
||||
/* Get speed setting. */
|
||||
tmp = drvthis->config_get_int(drvthis->name, "Speed", 0, p->model_desc->speed);
|
||||
debug(RPT_INFO, "%s: Speed (in config) is '%d'", __FUNCTION__, tmp);
|
||||
if ((tmp != 19200) && (tmp != 115200)) {
|
||||
report(RPT_WARNING, "%s: Speed must be 19200 or 11500; using default %d",
|
||||
drvthis->name, default_speed);
|
||||
tmp = default_speed;
|
||||
drvthis->name, p->model_desc->speed);
|
||||
tmp = p->model_desc->speed;
|
||||
}
|
||||
p->speed = (tmp == 19200) ? B19200 : B115200;
|
||||
|
||||
/* New firmware version?
|
||||
* I will try to behave differently for firmware 0.6 or above.
|
||||
* Currently this is not in use.
|
||||
*/
|
||||
p->newfirmware = drvthis->config_get_bool(drvthis->name, "NewFirmware", 0, 0);
|
||||
/* Does the display has an old firmware (<= 0.6)? */
|
||||
p->oldfirmware = drvthis->config_get_bool(drvthis->name, "OldFirmware", 0, 0);
|
||||
|
||||
/* Reboot display? */
|
||||
cf_reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);
|
||||
@@ -467,11 +465,10 @@ CFontzPacket_flush (Driver *drvthis)
|
||||
int modified = 0;
|
||||
int i, j;
|
||||
|
||||
if (p->model == 633) {
|
||||
if ((p->model == 633) && p->oldfirmware) {
|
||||
/*
|
||||
* For CF633 we don't use delta update yet. Older HW/FW types
|
||||
* only support updates of full or partial line starting from
|
||||
* pos 0.
|
||||
* Older CFA-633 HW/FW types only support updates of full or
|
||||
* partial line starting from pos 0.
|
||||
*/
|
||||
unsigned char *xp = p->framebuf;
|
||||
unsigned char *xq = p->backingstore;
|
||||
@@ -499,7 +496,7 @@ CFontzPacket_flush (Driver *drvthis)
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* CF631 / CF635 protocol is more flexible and we can do real
|
||||
* The current protocol is more flexible and we can do real
|
||||
* delta update.
|
||||
*/
|
||||
|
||||
@@ -554,7 +551,7 @@ CFontzPacket_flush (Driver *drvthis)
|
||||
|
||||
/* send something to the LCD to allow keys to be received */
|
||||
if (!modified)
|
||||
send_bytes_message(p->fd, CF633_Ping_Command, 0, NULL);
|
||||
send_zerobyte_message(p->fd, CF633_Ping_Command);
|
||||
}
|
||||
|
||||
|
||||
@@ -567,7 +564,6 @@ CFontzPacket_flush (Driver *drvthis)
|
||||
MODULE_EXPORT const char *
|
||||
CFontzPacket_get_key (Driver *drvthis)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
unsigned char key = GetKeyFromKeyRing(&keyring);
|
||||
|
||||
switch (key) {
|
||||
@@ -642,9 +638,7 @@ CFontzPacket_chr (Driver *drvthis, int x, int y, char c)
|
||||
x--;
|
||||
|
||||
if ((x >= 0) && (y >= 0) && (x < p->width) && (y < p->height))
|
||||
p->framebuf[(y * p->width) + x] = (p->model == 633)
|
||||
? c
|
||||
: CFontz_charmap[(unsigned) c];
|
||||
p->framebuf[(y * p->width) + x] = p->model_desc->charmap[(unsigned char) c];
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +699,7 @@ CFontzPacket_set_contrast (Driver *drvthis, int promille)
|
||||
|
||||
/* map range [0, 1000] to a range that the hardware understands */
|
||||
/* on CF633: [0, 50], on CF631 & CF635: [0, 255] */
|
||||
hardware_contrast = (p->model == 633)
|
||||
hardware_contrast = ((p->model == 633) || (p->model == 533))
|
||||
? (p->contrast / 20)
|
||||
: ((p->contrast * 255) / 1000);
|
||||
|
||||
@@ -795,9 +789,13 @@ CFontzPacket_no_live_report (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
unsigned char out[2] = { 0, 0 };
|
||||
int slots = 8;
|
||||
|
||||
if (p->model == 633) {
|
||||
for (out[0] = 0; out[0] < 8; out[0]++)
|
||||
if ((p->model_desc->flags & CFA_HAS_FAN) || (p->model_desc->flags & CFA_HAS_TEMP)) {
|
||||
if (p->model_desc->flags & CFA_HAS_4_TEMP_SLOTS)
|
||||
slots = 4;
|
||||
|
||||
for (out[0] = 0; out[0] < slots; out[0]++)
|
||||
send_bytes_message(p->fd, CF633_Set_Up_Live_Fan_or_Temperature_Display, 2, out);
|
||||
}
|
||||
}
|
||||
@@ -812,7 +810,7 @@ CFontzPacket_no_fan_report (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
if (p->model == 633)
|
||||
if (p->model_desc->flags & CFA_HAS_FAN)
|
||||
send_onebyte_message(p->fd, CF633_Set_Up_Fan_Reporting, 0);
|
||||
}
|
||||
|
||||
@@ -827,7 +825,7 @@ CFontzPacket_no_temp_report (Driver *drvthis)
|
||||
PrivateData *p = drvthis->private_data;
|
||||
unsigned char out[4] = { 0, 0, 0, 0 };
|
||||
|
||||
if (p->model == 633)
|
||||
if (p->model_desc->flags & CFA_HAS_TEMP)
|
||||
send_bytes_message(p->fd, CF633_Set_Up_Temperature_Reporting, 4, out);
|
||||
}
|
||||
|
||||
@@ -876,8 +874,11 @@ CFontzPacket_vbar (Driver *drvthis, int x, int y, int len, int promille, int opt
|
||||
memset(vBar, 0x00, sizeof(vBar));
|
||||
|
||||
for (i = 1; i < p->cellheight; i++) {
|
||||
// add pixel line per pixel line ...
|
||||
// NOTE: cellwidth != bar width: 0x1F = 0xFF & ((1 << (p->cellwidth - 1)) - 1)
|
||||
/*
|
||||
* add pixel line per pixel line ...
|
||||
* NOTE: cellwidth != bar width:
|
||||
* 0x1F = 0xFF & ((1 << (p->cellwidth - 1)) - 1)
|
||||
*/
|
||||
vBar[p->cellheight - i] = 0x1F;
|
||||
CFontzPacket_set_char(drvthis, i, vBar);
|
||||
}
|
||||
@@ -916,7 +917,7 @@ CFontzPacket_hbar (Driver *drvthis, int x, int y, int len, int promille, int opt
|
||||
memset(hBar, 0x00, sizeof(hBar));
|
||||
|
||||
for (i = 1; i <= p->cellwidth; i++) {
|
||||
// fill pixel columns from left to right.
|
||||
/* fill pixel columns from left to right. */
|
||||
memset(hBar, 0xFF & ~((1 << (p->cellwidth - i)) - 1), sizeof(hBar)-1);
|
||||
CFontzPacket_set_char(drvthis, i, hBar);
|
||||
}
|
||||
@@ -935,8 +936,8 @@ CFontzPacket_hbar (Driver *drvthis, int x, int y, int len, int promille, int opt
|
||||
MODULE_EXPORT void
|
||||
CFontzPacket_num(Driver *drvthis, int x, int num)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int do_init = 0;
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int do_init = 0;
|
||||
|
||||
if ((num < 0) || (num > 10))
|
||||
return;
|
||||
@@ -954,7 +955,7 @@ int do_init = 0;
|
||||
do_init = 1;
|
||||
}
|
||||
|
||||
// Lib_adv_bignum does everything needed to show the bignumbers.
|
||||
/* Lib_adv_bignum does everything needed to show the bignumbers. */
|
||||
lib_adv_bignum(drvthis, x, num, 0, do_init);
|
||||
}
|
||||
|
||||
@@ -967,8 +968,6 @@ int do_init = 0;
|
||||
MODULE_EXPORT int
|
||||
CFontzPacket_get_free_chars (Driver *drvthis)
|
||||
{
|
||||
//PrivateData *p = drvthis->private_data;
|
||||
|
||||
return NUM_CCs;
|
||||
}
|
||||
|
||||
@@ -996,6 +995,8 @@ CFontzPacket_set_char (Driver *drvthis, int n, unsigned char *dat)
|
||||
return;
|
||||
|
||||
out[0] = n; /* Custom char to define. xxx */
|
||||
if (p->model_desc->flags & CFA_HAS_KS0073)
|
||||
dat[p->cellheight-1] = 0;
|
||||
|
||||
for (row = 0; row < p->cellheight; row++) {
|
||||
out[row+1] = dat[row] & mask;
|
||||
@@ -1129,6 +1130,7 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
|
||||
b_______,
|
||||
b__X_X_X,
|
||||
b_______ };
|
||||
*/
|
||||
static unsigned char block_filled[] =
|
||||
{ b__XXXXX,
|
||||
b__XXXXX,
|
||||
@@ -1138,15 +1140,16 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
|
||||
b__XXXXX,
|
||||
b__XXXXX,
|
||||
b__XXXXX };
|
||||
*/
|
||||
|
||||
/* Yes we know, this is a VERY BAD implementation :-) */
|
||||
switch (icon) {
|
||||
case ICON_BLOCK_FILLED:
|
||||
if (p->model == 633)
|
||||
CFontzPacket_chr(drvthis, x, y, 255);
|
||||
if (p->model_desc->flags & CFA_HAS_KS0073) {
|
||||
CFontzPacket_set_char(drvthis, 7, block_filled);
|
||||
CFontzPacket_chr(drvthis, x, y, 7);
|
||||
}
|
||||
else
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 31);
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 255);
|
||||
break;
|
||||
case ICON_HEART_FILLED:
|
||||
CFontzPacket_set_char(drvthis, 0, heart_filled);
|
||||
@@ -1157,32 +1160,32 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
|
||||
CFontzPacket_chr(drvthis, x, y, 0);
|
||||
break;
|
||||
case ICON_ARROW_UP:
|
||||
if (p->model == 633) {
|
||||
if (p->model_desc->flags & CFA_HAS_KS0073)
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0xDE);
|
||||
else {
|
||||
CFontzPacket_set_char(drvthis, 1, arrow_up);
|
||||
CFontzPacket_chr(drvthis, x, y, 1);
|
||||
}
|
||||
else
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0xDE);
|
||||
break;
|
||||
case ICON_ARROW_DOWN:
|
||||
if (p->model == 633) {
|
||||
if (p->model_desc->flags & CFA_HAS_KS0073)
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0xE0);
|
||||
else {
|
||||
CFontzPacket_set_char(drvthis, 2, arrow_down);
|
||||
CFontzPacket_chr(drvthis, x, y, 2);
|
||||
}
|
||||
else
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0xE0);
|
||||
break;
|
||||
case ICON_ARROW_LEFT:
|
||||
if (p->model == 633)
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0x7F);
|
||||
else
|
||||
if (p->model_desc->flags & CFA_HAS_KS0073)
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0xE1);
|
||||
else
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0x7F);
|
||||
break;
|
||||
case ICON_ARROW_RIGHT:
|
||||
if (p->model == 633)
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0x7E);
|
||||
else
|
||||
if (p->model_desc->flags & CFA_HAS_KS0073)
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0xDF);
|
||||
else
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0x7E);
|
||||
break;
|
||||
case ICON_CHECKBOX_OFF:
|
||||
CFontzPacket_set_char(drvthis, 3, checkbox_off);
|
||||
@@ -1197,12 +1200,12 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
|
||||
CFontzPacket_chr(drvthis, x, y, 5);
|
||||
break;
|
||||
case ICON_SELECTOR_AT_LEFT:
|
||||
if (p->model == 633)
|
||||
if (!(p->model_desc->flags & CFA_HAS_KS0073))
|
||||
return -1;
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0x10);
|
||||
break;
|
||||
case ICON_SELECTOR_AT_RIGHT:
|
||||
if (p->model == 633)
|
||||
if (!(p->model_desc->flags & CFA_HAS_KS0073))
|
||||
return -1;
|
||||
CFontzPacket_raw_chr(drvthis, x, y, 0x11);
|
||||
break;
|
||||
@@ -1225,21 +1228,23 @@ CFontzPacket_cursor (Driver *drvthis, int x, int y, int state)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
|
||||
if (p->model != 633) {
|
||||
if (!p->oldfirmware) {
|
||||
unsigned char cpos[2] = { 0, 0 };
|
||||
|
||||
/* set cursor state */
|
||||
switch (state) {
|
||||
case CURSOR_OFF: // no cursor
|
||||
case CURSOR_OFF: /* no cursor */
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 0);
|
||||
break;
|
||||
case CURSOR_UNDER: // underline cursor
|
||||
case CURSOR_UNDER: /* underline cursor */
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 2);
|
||||
break;
|
||||
case CURSOR_BLOCK: // inverting blinking block
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 4);
|
||||
case CURSOR_BLOCK: /* inverting blinking block */
|
||||
if (p->model == 631 || p->model == 635)
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 4);
|
||||
break;
|
||||
case CURSOR_DEFAULT_ON: // blinking block
|
||||
case CURSOR_DEFAULT_ON: /* blinking block */
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
send_onebyte_message(p->fd, CF633_Set_LCD_Cursor_Style, 1);
|
||||
break;
|
||||
@@ -1305,11 +1310,10 @@ CFontzPacket_string (Driver *drvthis, int x, int y, const char string[])
|
||||
|
||||
for (i = 0; (string[i] != '\0') && (x < p->width); i++, x++) {
|
||||
/* Check for buffer overflows... */
|
||||
if (x >= 0)
|
||||
if (x >= 0) {
|
||||
p->framebuf[(y * p->width) + x] =
|
||||
(p->model == 633)
|
||||
? string[i]
|
||||
: CFontz_charmap[(unsigned) string[i]];
|
||||
p->model_desc->charmap[(unsigned char) string[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1323,8 +1327,8 @@ MODULE_EXPORT void
|
||||
CFontzPacket_output(Driver *drvthis, int state)
|
||||
{
|
||||
static const unsigned char CFontz635_LEDs[CF635_NUM_LEDs] = {
|
||||
11, 9, 7, 5, // Green LEDs first, Top first
|
||||
12,10, 8, 6, // Red LEDs next, Top first
|
||||
11, 9, 7, 5, /* Green LEDs first, Top first */
|
||||
12,10, 8, 6, /* Red LEDs next, Top first */
|
||||
};
|
||||
PrivateData *p = drvthis->private_data;
|
||||
unsigned char out[2];
|
||||
|
||||
@@ -8,16 +8,22 @@
|
||||
#define DEFAULT_CONTRAST 560
|
||||
#define DEFAULT_DEVICE "/dev/lcd"
|
||||
#define DEFAULT_SPEED 19200
|
||||
#define DEFAULT_SPEED_CF631 115200
|
||||
#define DEFAULT_SPEED_CF633 19200
|
||||
#define DEFAULT_SPEED_CF635 115200
|
||||
#define DEFAULT_BRIGHTNESS 1000
|
||||
#define DEFAULT_OFFBRIGHTNESS 0
|
||||
#define DEFAULT_SIZE "16x2"
|
||||
#define DEFAULT_SIZE_CF631 "20x2"
|
||||
#define DEFAULT_SIZE_CF633 "16x2"
|
||||
#define DEFAULT_SIZE_CF635 "20x4"
|
||||
|
||||
#define CFA_HAS_FAN 0x0001
|
||||
#define CFA_HAS_TEMP 0x0002
|
||||
#define CFA_HAS_4_TEMP_SLOTS 0x0004
|
||||
#define CFA_HAS_KS0073 0x0008
|
||||
|
||||
typedef struct CFA_Model {
|
||||
int model;
|
||||
char *size;
|
||||
int speed;
|
||||
const unsigned char *charmap;
|
||||
int flags;
|
||||
} CFA_Model;
|
||||
|
||||
MODULE_EXPORT int CFontzPacket_init (Driver *drvthis);
|
||||
MODULE_EXPORT void CFontzPacket_close (Driver *drvthis);
|
||||
|
||||
+19
-18
@@ -1,5 +1,22 @@
|
||||
/*
|
||||
* lcd.h
|
||||
/** \file server/drivers/lcd.h
|
||||
* This file defines the LCDd-driver API
|
||||
*
|
||||
* It is written to facilitate loadable driver modules.
|
||||
* There should be no further interaction between driver and server core
|
||||
* other that via this API.
|
||||
*
|
||||
* Driver writer notes
|
||||
* ~~~~~~~~~~~~~~~~~~~
|
||||
* See documentation in the docs/lcdproc-dev/ directory.
|
||||
*
|
||||
* DO NOT MIX DRIVER ALLOCATED AND CORE ALLOCATED MEMORY.
|
||||
* With this I mean that the server core should NEVER WRITE in memory
|
||||
* allocated by the driver, and vice versa. Also the driver resp. core
|
||||
* should free or realloc the memory that it has allocated. You can always
|
||||
* simply copy a string if its data space is not 'yours'.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* This file is part of LCDd, the lcdproc server.
|
||||
*
|
||||
* This file is released under the GNU General Public License. Refer to the
|
||||
@@ -7,22 +24,6 @@
|
||||
*
|
||||
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
||||
* 2001, Joris Robijn
|
||||
*
|
||||
*
|
||||
* This file defines the LCDd-driver API
|
||||
* It is written to facilitate loadable driver modules.
|
||||
* There should be no further interaction between driver and server core
|
||||
* other that via this API.
|
||||
*
|
||||
* Driver writer notes
|
||||
* ~~~~~~~~~~~~~~~~~~~
|
||||
* See documentation in the docs/lcdproc-devel directory.
|
||||
*
|
||||
* DO NOT MIX DRIVER ALLOCATED AND CORE ALLOCATED MEMORY.
|
||||
* With this I mean that the server core should NEVER WRITE in memory
|
||||
* allocated by the driver, and vice versa. Also the driver resp. core
|
||||
* should free or realloc the memory that it has allocated. You can always
|
||||
* simply copy a string if its data space is not 'yours'.
|
||||
*/
|
||||
|
||||
#ifndef LCD_H
|
||||
|
||||
Reference in New Issue
Block a user