From 2a3f55854536912104b788482a70b132b33a5e73 Mon Sep 17 00:00:00 2001 From: mmdolze Date: Sun, 31 Oct 2010 14:09:05 +0000 Subject: [PATCH] Add some more comments to CFontzPacket driver. --- server/drivers/CFontzPacket.c | 42 ++++++++++++++--------------------- server/drivers/CFontzPacket.h | 15 ++++++------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/server/drivers/CFontzPacket.c b/server/drivers/CFontzPacket.c index 421a89c..716ee6f 100644 --- a/server/drivers/CFontzPacket.c +++ b/server/drivers/CFontzPacket.c @@ -1,17 +1,18 @@ /** \file server/drivers/CFontzPacket.c - * LCDd \c CFontzPacket driver for the CFA631, CFA633 & CFA635 display series - * by CrystalFontz, Inc. + * LCDd \c CFontzPacket driver for the CFA533, CFA631, CFA633 & CFA635 display + * series by CrystalFontz, Inc. */ /* * 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) * * Applicable Data Sheets: - * - http://www.crystalfontz.com/products/631/CFA-631_v1.0.pdf - * - http://www.crystalfontz.com/products/633/CFA_633_0_6.PDF - * - http://www.crystalfontz.com/products/635/CFA_635_1_0.pdf + * - http://www.crystalfontz.com/products/533/data_sheet/data_sheet.html + * - http://www.crystalfontz.com/products/631/data_sheet/data_sheet.html + * - 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 * Portions Copyright (C) 2005 Peter Marschall @@ -33,7 +34,7 @@ */ /* - * Driver status + * Driver history * 04/04/2002: Working driver * 05/06/2002: Reading of return value * 02/09/2002: KeyPad handling and return string @@ -42,15 +43,6 @@ * 16/05/2005: Adapted for CFontz 635 * 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: * + Make the caching at least for heartbeat icon * @@ -149,7 +141,7 @@ typedef struct CFontzPacket_private_data { char info[255]; } PrivateData; - +/** List of known models and their default settings and features */ static CFA_Model CFA_ModelList[] = { {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 | @@ -168,9 +160,11 @@ MODULE_EXPORT char *symbol_prefix = "CFontzPacket_"; /* Internal functions */ static void CFontzPacket_hidecursor (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_temp_report (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. @@ -184,7 +178,7 @@ CFontzPacket_init (Driver *drvthis) struct termios portset; int tmp, w, h, i; int cf_reboot = 0; - char size[200] = DEFAULT_SIZE; + char size[200] = ""; PrivateData *p; @@ -242,11 +236,11 @@ CFontzPacket_init (Driver *drvthis) } p->width = w; p->height = h; - p->cellwidth = p->model_desc->cell_width; - - 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 */ tmp = drvthis->config_get_int(drvthis->name, "Contrast", 0, DEFAULT_CONTRAST); debug(RPT_INFO, "%s: Contrast (in config) is '%d'", __FUNCTION__, tmp); @@ -358,7 +352,6 @@ CFontzPacket_init (Driver *drvthis) } CFontzPacket_hidecursor(drvthis); - CFontzPacket_set_contrast(drvthis, p->contrast); CFontzPacket_no_live_report(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. */ static void @@ -1155,7 +1148,6 @@ CFontzPacket_icon (Driver *drvthis, int x, int y, int icon) b__XXXXX }; */ - /* Yes we know, this is a VERY BAD implementation :-) */ switch (icon) { case ICON_BLOCK_FILLED: if (p->model_desc->flags & CFA_HAS_KS0073) { diff --git a/server/drivers/CFontzPacket.h b/server/drivers/CFontzPacket.h index 656c4ca..23c7efb 100644 --- a/server/drivers/CFontzPacket.h +++ b/server/drivers/CFontzPacket.h @@ -6,23 +6,22 @@ #define DEFAULT_CELL_HEIGHT 8 #define DEFAULT_CONTRAST 560 #define DEFAULT_DEVICE "/dev/lcd" -#define DEFAULT_SPEED 19200 #define DEFAULT_BRIGHTNESS 1000 #define DEFAULT_OFFBRIGHTNESS 0 -#define DEFAULT_SIZE "16x2" #define CFA_HAS_FAN 0x0001 #define CFA_HAS_TEMP 0x0002 #define CFA_HAS_4_TEMP_SLOTS 0x0004 #define CFA_HAS_KS0073 0x0008 +/** Structure describing features of a known display model */ typedef struct CFA_Model { - int model; - char *size; - int cell_width; - int speed; - const unsigned char *charmap; - int flags; + int model; /**< Model number */ + char *size; /**< Display size, format like '16x2' */ + int cell_width; /**< Width of a character cell in pixel */ + int speed; /**< Default speed of serial interface */ + const unsigned char *charmap; /**< Default HD44780 charmap used by display */ + int flags; /**< Bitmap of display features, see CFA_HAS_* above */ } CFA_Model; MODULE_EXPORT int CFontzPacket_init (Driver *drvthis);