Clean-up includes and move all defaults to header file.

Fix heartbeat and bignum by mapping character 0 to 8.
Fix backlight and contrast handling (by M. T. Jones).
Add more icons (by M. T. Jones).
Add OffBrightness for 20x4 (idea by S. Crane).
Add range checking for config settings.
This commit is contained in:
mmdolze
2011-01-23 13:28:16 +00:00
parent de7a132fbb
commit dbc2eb7cfc
3 changed files with 251 additions and 143 deletions
+18 -33
View File
@@ -1,40 +1,19 @@
/*
* picoLCD driver for lcdPROC
/*-
* picoLCD driver for LCDproc
*
* (c) 2007 NitroSecurity, Inc.
* Written by Gatewood Green <woody@nitrosecurity.com> or <woody@linif.org>
* (c) 2007-2008 Peter Marschall - adapted coding style and reporting to LCDproc
* (c) 2007 Mini-Box.com, Nicu Pavel <npavel@ituner.com>
* - removed libusblcd and hid dependency
* - added vbar, hbar, custom char, bignum support
* (c) 2008 Jack Cleaver - add LIRC connection
* (c) 2008 Mini-Box.com Nicu Pavel <npavel@mini-box.com>
* - Added support for 4x20 picoLCD
* (c) 2010 Martin Jones <martin.t.jones@virgin.net>
* - Use module output function to control key LEDs.
* License: GPL (same as usblcd and lcdPROC)
* Copyright (c) 2007 NitroSecurity, Inc.
* 2007-2008 Peter Marschall
* 2007-2008 Mini-Box.com, Nicu Pavel <npavel@ituner.com>
* 2008 Jack Cleaver
*
* picoLCD: http://www.mini-box.com/picoLCD-20x2-OEM
* Can be purchased separately or preinstalled in units such as the
* M300 http://www.mini-box.com/Mini-Box-M300-LCD
* picoLCD 4x20: http://www.mini-box.com/PicoLCD-4X20-Sideshow
*
* The picoLCD is usb connected and is driven (currently) via userspace
* using libusb library.
*
* libusb: http://www.libusb.org/
* This file is released under the GNU General Public License. Refer to the
* COPYING file distributed with this package.
*
*/
#ifndef PICOLCD_H
#define PCIOLCD_H
#include "lcd.h"
#include "lcd_lib.h"
#include "adv_bignum.h"
#include <usb.h>
/* 12 keys plus a 0 placeholder */
#define KEYPAD_MAX 13
#define KEYPAD_LIGHTS 8
@@ -50,6 +29,12 @@
#define DEFAULT_LIRCPORT 8765
#define DEFAULT_FLUSH_THRESHOLD_JIFFY 100 /* 6.1 millisec */
#define DEFAULT_CONTRAST 1000 /* Full */
#define DEFAULT_BRIGHTNESS 1000 /* Full */
#define DEFAULT_OFFBRIGHTNESS 0 /* Off */
#define DEFAULT_BACKLIGHT 1 /* On */
#define DEFAULT_KEYLIGHTS 1 /* On */
#define DEFAULT_TIMEOUT 500 /* Half second */
typedef struct _lcd_packet {
@@ -64,14 +49,14 @@ typedef struct _picolcd_device {
char *keymap[KEYPAD_MAX]; /* key pad button names */
unsigned int vendor_id; /* vendor id for detection */
unsigned int device_id; /* device id for detection */
int bklight_max; /* maximum backlight value */
int bklight_min; /* minimum backlight value */
int bklight_max; /* maximum value for 'backlight on' */
int bklight_min; /* maximum value for 'backlight off' */
int contrast_max; /* contrast maximum value */
int contrast_min; /* minimum contrast value */
int width; /* width of lcd screen */
int height; /* height of lcd screen */
/* Pointer to function that writes data to the LCD format */
void (*write)(usb_dev_handle *lcd, const int row, const int col, const unsigned char *data);
void (*write) (usb_dev_handle *lcd, const int row, const int col, const unsigned char *data);
/* Pointer to function that defines a custom character */
void (*cchar) (Driver *drvthis, int n, unsigned char *dat);
} picolcd_device;
@@ -96,7 +81,7 @@ MODULE_EXPORT void picoLCD_cursor(Driver *drvthis, int x, int y, int type);
MODULE_EXPORT int picoLCD_get_contrast(Driver *drvthis);
MODULE_EXPORT void picoLCD_set_contrast(Driver *drvthis, int promille);
//MODULE_EXPORT int picoLCD_get_brightness(Driver *drvthis, int state);
MODULE_EXPORT int picoLCD_get_brightness(Driver *drvthis, int state);
MODULE_EXPORT void picoLCD_set_brightness(Driver *drvthis, int state, int promille);
MODULE_EXPORT void picoLCD_backlight(Driver *drvthis, int state);
MODULE_EXPORT void picoLCD_output(Driver *drvthis, int state);