Add some more comments to CFontzPacket driver.

This commit is contained in:
mmdolze
2010-10-31 14:09:05 +00:00
parent 55a8624b74
commit 2a3f558545
2 changed files with 24 additions and 33 deletions
+17 -25
View File
@@ -1,17 +1,18 @@
/** \file server/drivers/CFontzPacket.c /** \file server/drivers/CFontzPacket.c
* LCDd \c CFontzPacket driver for the CFA631, CFA633 & CFA635 display series * LCDd \c CFontzPacket driver for the CFA533, CFA631, CFA633 & CFA635 display
* by CrystalFontz, Inc. * series by CrystalFontz, Inc.
*/ */
/* /*
* This is the LCDproc driver for CrystalFontz LCD using Packet protocol. * This is the LCDproc driver for CrystalFontz LCD using Packet protocol.
* It support the CrystalFontz 633 USB/Serial, the 631 USB and the 635 USB * It support the CrystalFontz 533/633 USB/Serial, the 631 USB and the 635 USB
* (get yours from http://www.crystalfontz.com) * (get yours from http://www.crystalfontz.com)
* *
* Applicable Data Sheets: * Applicable Data Sheets:
* - http://www.crystalfontz.com/products/631/CFA-631_v1.0.pdf * - http://www.crystalfontz.com/products/533/data_sheet/data_sheet.html
* - http://www.crystalfontz.com/products/633/CFA_633_0_6.PDF * - http://www.crystalfontz.com/products/631/data_sheet/data_sheet.html
* - http://www.crystalfontz.com/products/635/CFA_635_1_0.pdf * - http://www.crystalfontz.com/products/633/data_sheet/data_sheet.html
* - http://www.crystalfontz.com/products/635/data_sheet/data_sheet.html
* *
* Copyright (C) 2002 David GLAUDE * Copyright (C) 2002 David GLAUDE
* Portions Copyright (C) 2005 Peter Marschall * Portions Copyright (C) 2005 Peter Marschall
@@ -33,7 +34,7 @@
*/ */
/* /*
* Driver status * Driver history
* 04/04/2002: Working driver * 04/04/2002: Working driver
* 05/06/2002: Reading of return value * 05/06/2002: Reading of return value
* 02/09/2002: KeyPad handling and return string * 02/09/2002: KeyPad handling and return string
@@ -42,15 +43,6 @@
* 16/05/2005: Adapted for CFontz 635 * 16/05/2005: Adapted for CFontz 635
* 24/01/2010: Add CFontz 533, add model description * 24/01/2010: Add CFontz 533, add model description
* *
* THINGS DONE:
* + Stopping the live reporting (of temperature)
* + Stopping the reporting of temp and fan (is it necessary after reboot)
* + Use of library for hbar and vbar (good but library could be better)
* + Support for keypad (Using a KeyRing)
* + BigNum (for CF635 only: it is a 4-line display)
* + Output support (LED control on a CF635 only)
* + Create and use the library (for custom char handling)
*
* THINGS TO DO: * THINGS TO DO:
* + Make the caching at least for heartbeat icon * + Make the caching at least for heartbeat icon
* *
@@ -149,7 +141,7 @@ typedef struct CFontzPacket_private_data {
char info[255]; char info[255];
} PrivateData; } PrivateData;
/** List of known models and their default settings and features */
static CFA_Model CFA_ModelList[] = { static CFA_Model CFA_ModelList[] = {
{533, "16x2", 5, 19200 , HD44780_charmap, CFA_HAS_TEMP | CFA_HAS_4_TEMP_SLOTS}, {533, "16x2", 5, 19200 , HD44780_charmap, CFA_HAS_TEMP | CFA_HAS_4_TEMP_SLOTS},
{631, "20x2", 6, 115200, CFontz_charmap , CFA_HAS_FAN | CFA_HAS_TEMP | {631, "20x2", 6, 115200, CFontz_charmap , CFA_HAS_FAN | CFA_HAS_TEMP |
@@ -168,9 +160,11 @@ MODULE_EXPORT char *symbol_prefix = "CFontzPacket_";
/* Internal functions */ /* Internal functions */
static void CFontzPacket_hidecursor (Driver *drvthis); static void CFontzPacket_hidecursor (Driver *drvthis);
static void CFontzPacket_reboot (Driver *drvthis); static void CFontzPacket_reboot (Driver *drvthis);
static void CFontzPacket_no_fan_report (Driver *drvthis);
static void CFontzPacket_no_live_report (Driver *drvthis); static void CFontzPacket_no_live_report (Driver *drvthis);
static void CFontzPacket_no_temp_report (Driver *drvthis);
static void CFontzPacket_hardware_clear (Driver *drvthis); static void CFontzPacket_hardware_clear (Driver *drvthis);
static void CFontzPacket_raw_chr (Driver *drvthis, int x, int y, unsigned char c);
/** /**
* Initialize the driver. * Initialize the driver.
@@ -184,7 +178,7 @@ CFontzPacket_init (Driver *drvthis)
struct termios portset; struct termios portset;
int tmp, w, h, i; int tmp, w, h, i;
int cf_reboot = 0; int cf_reboot = 0;
char size[200] = DEFAULT_SIZE; char size[200] = "";
PrivateData *p; PrivateData *p;
@@ -242,11 +236,11 @@ CFontzPacket_init (Driver *drvthis)
} }
p->width = w; p->width = w;
p->height = h; p->height = h;
p->cellwidth = p->model_desc->cell_width;
debug(RPT_INFO, "%s: Size used: %dx%d", __FUNCTION__, p->width, p->height); debug(RPT_INFO, "%s: Size used: %dx%d", __FUNCTION__, p->width, p->height);
/* Cellwidth cannot be set by user */
p->cellwidth = p->model_desc->cell_width;
/* Which contrast */ /* Which contrast */
tmp = drvthis->config_get_int(drvthis->name, "Contrast", 0, DEFAULT_CONTRAST); tmp = drvthis->config_get_int(drvthis->name, "Contrast", 0, DEFAULT_CONTRAST);
debug(RPT_INFO, "%s: Contrast (in config) is '%d'", __FUNCTION__, tmp); debug(RPT_INFO, "%s: Contrast (in config) is '%d'", __FUNCTION__, tmp);
@@ -358,7 +352,6 @@ CFontzPacket_init (Driver *drvthis)
} }
CFontzPacket_hidecursor(drvthis); CFontzPacket_hidecursor(drvthis);
CFontzPacket_set_contrast(drvthis, p->contrast); CFontzPacket_set_contrast(drvthis, p->contrast);
CFontzPacket_no_live_report(drvthis); CFontzPacket_no_live_report(drvthis);
CFontzPacket_hardware_clear(drvthis); CFontzPacket_hardware_clear(drvthis);
@@ -786,7 +779,7 @@ CFontzPacket_hidecursor (Driver *drvthis)
/** /**
* Stop live reporting of temperature. * Stop live reporting of temperature and fan RPM.
* \param drvthis Pointer to driver structure. * \param drvthis Pointer to driver structure.
*/ */
static void static void
@@ -1155,7 +1148,6 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
b__XXXXX }; b__XXXXX };
*/ */
/* Yes we know, this is a VERY BAD implementation :-) */
switch (icon) { switch (icon) {
case ICON_BLOCK_FILLED: case ICON_BLOCK_FILLED:
if (p->model_desc->flags & CFA_HAS_KS0073) { if (p->model_desc->flags & CFA_HAS_KS0073) {
+7 -8
View File
@@ -6,23 +6,22 @@
#define DEFAULT_CELL_HEIGHT 8 #define DEFAULT_CELL_HEIGHT 8
#define DEFAULT_CONTRAST 560 #define DEFAULT_CONTRAST 560
#define DEFAULT_DEVICE "/dev/lcd" #define DEFAULT_DEVICE "/dev/lcd"
#define DEFAULT_SPEED 19200
#define DEFAULT_BRIGHTNESS 1000 #define DEFAULT_BRIGHTNESS 1000
#define DEFAULT_OFFBRIGHTNESS 0 #define DEFAULT_OFFBRIGHTNESS 0
#define DEFAULT_SIZE "16x2"
#define CFA_HAS_FAN 0x0001 #define CFA_HAS_FAN 0x0001
#define CFA_HAS_TEMP 0x0002 #define CFA_HAS_TEMP 0x0002
#define CFA_HAS_4_TEMP_SLOTS 0x0004 #define CFA_HAS_4_TEMP_SLOTS 0x0004
#define CFA_HAS_KS0073 0x0008 #define CFA_HAS_KS0073 0x0008
/** Structure describing features of a known display model */
typedef struct CFA_Model { typedef struct CFA_Model {
int model; int model; /**< Model number */
char *size; char *size; /**< Display size, format like '16x2' */
int cell_width; int cell_width; /**< Width of a character cell in pixel */
int speed; int speed; /**< Default speed of serial interface */
const unsigned char *charmap; const unsigned char *charmap; /**< Default HD44780 charmap used by display */
int flags; int flags; /**< Bitmap of display features, see CFA_HAS_* above */
} CFA_Model; } CFA_Model;
MODULE_EXPORT int CFontzPacket_init (Driver *drvthis); MODULE_EXPORT int CFontzPacket_init (Driver *drvthis);