add new driver CFontzPacket for CrystalFontz CFA631, CFA633 & CFA635;
add new connection type 'i2c' for for the hd44780 contributed by Matthias Goebl <matthias.goebl@goebl.net>; harmonize spelling of driver names in configure script and LCDd.conf
This commit is contained in:
@@ -165,6 +165,8 @@ Peter Marschall:
|
|||||||
Markus Dolze:
|
Markus Dolze:
|
||||||
- various fixes (especially for *BSD)
|
- various fixes (especially for *BSD)
|
||||||
|
|
||||||
|
Matthias Goebl <matthias.goebl@goebl.net>:
|
||||||
|
- HD44780 I2C driver
|
||||||
|
|
||||||
Further developers in the sourceforge lcdproc team:
|
Further developers in the sourceforge lcdproc team:
|
||||||
Mindaugas Idzelis aim4min
|
Mindaugas Idzelis aim4min
|
||||||
|
|||||||
@@ -182,6 +182,35 @@ Speed=19200
|
|||||||
Reboot=yes
|
Reboot=yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## CrystalFontz packet driver (for CF631, CF633 & CF635) ##
|
||||||
|
[CFontzPacket]
|
||||||
|
|
||||||
|
# Select the LCD model [default: 633; legal: 631, 633, 635]
|
||||||
|
Model=633
|
||||||
|
# Select the output device to use [default: /dev/lcd]
|
||||||
|
Device=/dev/ttyS0
|
||||||
|
# Select the LCD size [default: depending on model: 635: 20x4, 631 & 633: 16x2]
|
||||||
|
Size=16x2
|
||||||
|
# Set the initial contrast [default: 140; legal: 0 - 1000]
|
||||||
|
Contrast=140
|
||||||
|
# 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=19200
|
||||||
|
# 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
|
||||||
|
Reboot=yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Curses driver ##
|
## Curses driver ##
|
||||||
[curses]
|
[curses]
|
||||||
|
|
||||||
|
|||||||
+33
-20
@@ -5,17 +5,17 @@ AC_ARG_ENABLE(drivers,
|
|||||||
[ --enable-drivers=<list> compile driver for LCDs in <list>.]
|
[ --enable-drivers=<list> compile driver for LCDs in <list>.]
|
||||||
[ drivers may be separated with commas.]
|
[ drivers may be separated with commas.]
|
||||||
[ Possible choices are:]
|
[ Possible choices are:]
|
||||||
[ bayrad,cfontz,cfontz633,curses,cwlnx,glcdlib,glk,]
|
[ bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,]
|
||||||
[ hd44780,icp_a106,imon,iowarrior,irman,joy,lb216,]
|
[ glcdlib,glk,hd44780,icp_a106,imon,IOWarrior,irman,]
|
||||||
[ lcdm001,lcterm,lirc,ms6931,mtc_s16209x,mtxorb,]
|
[ joy,lb216,lcdm001,lcterm,lirc,ms6931,mtc_s16209x,]
|
||||||
[ noritakevfd,pylcd,sed1330,sed1520,sli,stv5730,svga,]
|
[ MtxOrb,noritakevfd,pylcd,sed1330,sed1520,sli,stv5730,]
|
||||||
[ t6963,text,tyan,xosd]
|
[ isvga,t6963,text,tyan,xosd]
|
||||||
[ \"all\" compiles all drivers],
|
[ \"all\" compiles all drivers],
|
||||||
drivers="$enableval",
|
drivers="$enableval",
|
||||||
drivers=[bayrad,cfontz,cfontz633,curses,cwlnx,glk,lb216,lcdm001,mtxorb,pylcd,text])
|
drivers=[bayrad,CFontz,CFontz633,curses,CwLnx,glk,lb216,lcdm001,MtxOrb,pylcd,text])
|
||||||
|
|
||||||
if test "$drivers" = "all"; then
|
if test "$drivers" = "all"; then
|
||||||
drivers=[bayrad,cfontz,cfontz633,curses,cwlnx,glcdlib,glk,hd44780,icp_a106,imon,iowarrior,irman,joy,lb216,lcdm001,lcterm,lirc,ms6931,mtc_s16209x,mtxorb,noritakevfd,pylcd,sed1330,sed1520,sli,stv5730,svga,t6963,text,tyan,xosd]
|
drivers=[bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,glcdlib,glk,hd44780,icp_a106,imon,IOWarrior,irman,joy,lb216,lcdm001,lcterm,lirc,ms6931,mtc_s16209x,MtxOrb,NoritakeVFD,pylcd,sed1330,sed1520,sli,stv5730,svga,t6963,text,tyan,xosd]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
drivers=`echo $drivers | sed 's/,/ /g'`
|
drivers=`echo $drivers | sed 's/,/ /g'`
|
||||||
@@ -27,19 +27,28 @@ AC_ARG_ENABLE(drivers,
|
|||||||
DRIVERS="$DRIVERS bayrad${SO}"
|
DRIVERS="$DRIVERS bayrad${SO}"
|
||||||
actdrivers=["$actdrivers bayrad"]
|
actdrivers=["$actdrivers bayrad"]
|
||||||
;;
|
;;
|
||||||
cfontz)
|
CFontz)
|
||||||
DRIVERS="$DRIVERS CFontz${SO}"
|
DRIVERS="$DRIVERS CFontz${SO}"
|
||||||
actdrivers=["$actdrivers cfontz"]
|
actdrivers=["$actdrivers CFontz"]
|
||||||
;;
|
;;
|
||||||
cfontz633)
|
CFontz633)
|
||||||
DRIVERS="$DRIVERS CFontz633${SO}"
|
DRIVERS="$DRIVERS CFontz633${SO}"
|
||||||
actdrivers=["$actdrivers cfontz633"]
|
actdrivers=["$actdrivers CFontz633"]
|
||||||
AC_CHECK_FUNCS(select, [
|
AC_CHECK_FUNCS(select, [
|
||||||
AC_CHECK_HEADERS(sys/select.h)
|
AC_CHECK_HEADERS(sys/select.h)
|
||||||
],[
|
],[
|
||||||
AC_MSG_WARN([The CFontz633 driver needs the select() function])
|
AC_MSG_WARN([The CFontz633 driver needs the select() function])
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
|
CFontzPacket)
|
||||||
|
DRIVERS="$DRIVERS CFontzPacket${SO}"
|
||||||
|
actdrivers=["$actdrivers CFontzPacket"]
|
||||||
|
AC_CHECK_FUNCS(select, [
|
||||||
|
AC_CHECK_HEADERS(sys/select.h)
|
||||||
|
],[
|
||||||
|
AC_MSG_WARN([The CFontzPacket driver needs the select() function])
|
||||||
|
])
|
||||||
|
;;
|
||||||
curses)
|
curses)
|
||||||
AC_CHECK_HEADERS(ncurses.h curses.h)
|
AC_CHECK_HEADERS(ncurses.h curses.h)
|
||||||
AC_CHECK_LIB(ncurses, main, [
|
AC_CHECK_LIB(ncurses, main, [
|
||||||
@@ -92,9 +101,9 @@ dnl else
|
|||||||
AC_DEFINE(CURSES_HAS_WCOLOR_SET,[1],[Define to 1 if you have the wcolor_set function in the curses library])
|
AC_DEFINE(CURSES_HAS_WCOLOR_SET,[1],[Define to 1 if you have the wcolor_set function in the curses library])
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
cwlnx)
|
CwLnx)
|
||||||
DRIVERS="$DRIVERS CwLnx${SO}"
|
DRIVERS="$DRIVERS CwLnx${SO}"
|
||||||
actdrivers=["$actdrivers cwlnx"]
|
actdrivers=["$actdrivers CwLnx"]
|
||||||
;;
|
;;
|
||||||
glcdlib)
|
glcdlib)
|
||||||
AC_CHECK_HEADERS([glcdproclib/glcdprocdriver.h],[
|
AC_CHECK_HEADERS([glcdproclib/glcdprocdriver.h],[
|
||||||
@@ -125,6 +134,10 @@ dnl else
|
|||||||
if test "$enable_libusb" = yes ; then
|
if test "$enable_libusb" = yes ; then
|
||||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o"
|
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o"
|
||||||
fi
|
fi
|
||||||
|
AC_CHECK_HEADER(linux/i2c-dev.h,
|
||||||
|
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-i2c.o"
|
||||||
|
AC_DEFINE(HAVE_I2C,[1],[Define to 1 if you have the i2c headers])
|
||||||
|
)
|
||||||
DRIVERS="$DRIVERS hd44780${SO}"
|
DRIVERS="$DRIVERS hd44780${SO}"
|
||||||
actdrivers=["$actdrivers hd44780"]
|
actdrivers=["$actdrivers hd44780"]
|
||||||
;;
|
;;
|
||||||
@@ -136,12 +149,12 @@ dnl else
|
|||||||
DRIVERS="$DRIVERS imon${SO}"
|
DRIVERS="$DRIVERS imon${SO}"
|
||||||
actdrivers=["$actdrivers imon"]
|
actdrivers=["$actdrivers imon"]
|
||||||
;;
|
;;
|
||||||
iowarrior)
|
IOWarrior)
|
||||||
if test "$enable_libusb" = yes ; then
|
if test "$enable_libusb" = yes ; then
|
||||||
DRIVERS="$DRIVERS IOWarrior${SO}"
|
DRIVERS="$DRIVERS IOWarrior${SO}"
|
||||||
actdrivers=["$actdrivers iowarrior"]
|
actdrivers=["$actdrivers IOWarrior"]
|
||||||
else
|
else
|
||||||
AC_MSG_WARN([The iowarrior driver needs the libusb library.])
|
AC_MSG_WARN([The IOWarrior driver needs the libusb library.])
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
irman)
|
irman)
|
||||||
@@ -193,13 +206,13 @@ dnl else
|
|||||||
DRIVERS="$DRIVERS mtc_s16209x${SO}"
|
DRIVERS="$DRIVERS mtc_s16209x${SO}"
|
||||||
actdrivers=["$actdrivers mtc_s16209x"]
|
actdrivers=["$actdrivers mtc_s16209x"]
|
||||||
;;
|
;;
|
||||||
mtxorb)
|
MtxOrb)
|
||||||
DRIVERS="$DRIVERS MtxOrb${SO}"
|
DRIVERS="$DRIVERS MtxOrb${SO}"
|
||||||
actdrivers=["$actdrivers mtxorb"]
|
actdrivers=["$actdrivers MtxOrb"]
|
||||||
;;
|
;;
|
||||||
noritakevfd)
|
NoritakeVFD)
|
||||||
DRIVERS="$DRIVERS NoritakeVFD${SO}"
|
DRIVERS="$DRIVERS NoritakeVFD${SO}"
|
||||||
actdrivers=["$actdrivers noritakevfd"]
|
actdrivers=["$actdrivers NoritakeVFD"]
|
||||||
;;
|
;;
|
||||||
pylcd)
|
pylcd)
|
||||||
DRIVERS="$DRIVERS pylcd${SO}"
|
DRIVERS="$DRIVERS pylcd${SO}"
|
||||||
|
|||||||
+138
-146
@@ -1,11 +1,3 @@
|
|||||||
/*
|
|
||||||
* This file driver is going to replace CFontz633.c in order to support
|
|
||||||
* CF631, CF633 and CF635 simultaniously under a new driver name...
|
|
||||||
* Currently, to use this version do: "cp CFontzPacket.c CFontz633.c"
|
|
||||||
* Be carefull when using CVS, do not overwrite CFontz633.c !!!
|
|
||||||
*
|
|
||||||
* -- David GLAUDE
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* 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 633 USB/Serial, the 631 USB and the 635 USB
|
||||||
@@ -79,32 +71,32 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "CFontz633.h"
|
#include "CFontzPacket.h"
|
||||||
#include "CFontz633io.h"
|
#include "CFontz633io.h"
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "lcd_lib.h"
|
#include "lcd_lib.h"
|
||||||
#include "CFontz-charmap.h"
|
#include "CFontz-charmap.h"
|
||||||
|
|
||||||
#define CF633_KEY_UP 1
|
#define CFP_KEY_UP 1
|
||||||
#define CF633_KEY_DOWN 2
|
#define CFP_KEY_DOWN 2
|
||||||
#define CF633_KEY_LEFT 3
|
#define CFP_KEY_LEFT 3
|
||||||
#define CF633_KEY_RIGHT 4
|
#define CFP_KEY_RIGHT 4
|
||||||
#define CF633_KEY_ENTER 5
|
#define CFP_KEY_ENTER 5
|
||||||
#define CF633_KEY_ESCAPE 6
|
#define CFP_KEY_ESCAPE 6
|
||||||
#define CF633_KEY_UP_RELEASE 7
|
#define CFP_KEY_UP_RELEASE 7
|
||||||
#define CF633_KEY_DOWN_RELEASE 8
|
#define CFP_KEY_DOWN_RELEASE 8
|
||||||
#define CF633_KEY_LEFT_RELEASE 9
|
#define CFP_KEY_LEFT_RELEASE 9
|
||||||
#define CF633_KEY_RIGHT_RELEASE 10
|
#define CFP_KEY_RIGHT_RELEASE 10
|
||||||
#define CF633_KEY_ENTER_RELEASE 11
|
#define CFP_KEY_ENTER_RELEASE 11
|
||||||
#define CF633_KEY_ESCAPE_RELEASE 12
|
#define CFP_KEY_ESCAPE_RELEASE 12
|
||||||
#define CF631_KEY_UL_PRESS 13
|
#define CFP_KEY_UL_PRESS 13
|
||||||
#define CF631_KEY_UR_PRESS 14
|
#define CFP_KEY_UR_PRESS 14
|
||||||
#define CF631_KEY_LL_PRESS 15
|
#define CFP_KEY_LL_PRESS 15
|
||||||
#define CF631_KEY_LR_PRESS 16
|
#define CFP_KEY_LR_PRESS 16
|
||||||
#define CF631_KEY_UL_RELEASE 17
|
#define CFP_KEY_UL_RELEASE 17
|
||||||
#define CF631_KEY_UR_RELEASE 18
|
#define CFP_KEY_UR_RELEASE 18
|
||||||
#define CF631_KEY_LL_RELEASE 19
|
#define CFP_KEY_LL_RELEASE 19
|
||||||
#define CF631_KEY_LR_RELEASE 20
|
#define CFP_KEY_LR_RELEASE 20
|
||||||
|
|
||||||
#define CELLWIDTH DEFAULT_CELL_WIDTH
|
#define CELLWIDTH DEFAULT_CELL_WIDTH
|
||||||
#define CELLHEIGHT DEFAULT_CELL_HEIGHT
|
#define CELLHEIGHT DEFAULT_CELL_HEIGHT
|
||||||
@@ -164,24 +156,24 @@ typedef struct driver_private_data {
|
|||||||
MODULE_EXPORT char *api_version = API_VERSION;
|
MODULE_EXPORT char *api_version = API_VERSION;
|
||||||
MODULE_EXPORT int stay_in_foreground = 0;
|
MODULE_EXPORT int stay_in_foreground = 0;
|
||||||
MODULE_EXPORT int supports_multiple = 0;
|
MODULE_EXPORT int supports_multiple = 0;
|
||||||
MODULE_EXPORT char *symbol_prefix = "CFontz633_";
|
MODULE_EXPORT char *symbol_prefix = "CFontzPacket_";
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
/* static void CFontz633_linewrap (int on); */
|
/* static void CFontzPacket_linewrap (int on); */
|
||||||
/* static void CFontz633_autoscroll (int on); */
|
/* static void CFontzPacket_autoscroll (int on); */
|
||||||
static void CFontz633_hidecursor (Driver *drvthis);
|
static void CFontzPacket_hidecursor (Driver *drvthis);
|
||||||
static void CFontz633_reboot (Driver *drvthis);
|
static void CFontzPacket_reboot (Driver *drvthis);
|
||||||
static void CFontz633_init_vbar (Driver *drvthis);
|
static void CFontzPacket_init_vbar (Driver *drvthis);
|
||||||
static void CFontz633_init_hbar (Driver *drvthis);
|
static void CFontzPacket_init_hbar (Driver *drvthis);
|
||||||
static void CFontz633_no_live_report (Driver *drvthis);
|
static void CFontzPacket_no_live_report (Driver *drvthis);
|
||||||
static void CFontz633_hardware_clear (Driver *drvthis);
|
static void CFontzPacket_hardware_clear (Driver *drvthis);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Opens com port and sets baud correctly...
|
* Opens com port and sets baud correctly...
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_init (Driver *drvthis)
|
CFontzPacket_init (Driver *drvthis)
|
||||||
{
|
{
|
||||||
struct termios portset;
|
struct termios portset;
|
||||||
int tmp, w, h;
|
int tmp, w, h;
|
||||||
@@ -369,19 +361,19 @@ CFontz633_init (Driver *drvthis)
|
|||||||
/* Set display-specific stuff.. */
|
/* Set display-specific stuff.. */
|
||||||
if (reboot) {
|
if (reboot) {
|
||||||
debug(RPT_INFO, "CFontzPacket: reboot requested\n" );
|
debug(RPT_INFO, "CFontzPacket: reboot requested\n" );
|
||||||
CFontz633_reboot (drvthis);
|
CFontzPacket_reboot (drvthis);
|
||||||
reboot = 0;
|
reboot = 0;
|
||||||
debug(RPT_INFO, "CFontzPacket: reboot done" );
|
debug(RPT_INFO, "CFontzPacket: reboot done" );
|
||||||
}
|
}
|
||||||
|
|
||||||
CFontz633_hidecursor (drvthis);
|
CFontzPacket_hidecursor (drvthis);
|
||||||
|
|
||||||
CFontz633_set_contrast (drvthis, p->contrast);
|
CFontzPacket_set_contrast (drvthis, p->contrast);
|
||||||
CFontz633_no_live_report (drvthis);
|
CFontzPacket_no_live_report (drvthis);
|
||||||
CFontz633_hardware_clear (drvthis);
|
CFontzPacket_hardware_clear (drvthis);
|
||||||
|
|
||||||
/* turn LEDs off on a CF635 */
|
/* turn LEDs off on a CF635 */
|
||||||
CFontz633_output(drvthis, 0);
|
CFontzPacket_output(drvthis, 0);
|
||||||
|
|
||||||
report (RPT_DEBUG, "%s: done\n", __FUNCTION__);
|
report (RPT_DEBUG, "%s: done\n", __FUNCTION__);
|
||||||
|
|
||||||
@@ -393,7 +385,7 @@ CFontz633_init (Driver *drvthis)
|
|||||||
* Clean-up
|
* Clean-up
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_close (Driver *drvthis)
|
CFontzPacket_close (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -418,7 +410,7 @@ CFontz633_close (Driver *drvthis)
|
|||||||
* Returns the display width in characters
|
* Returns the display width in characters
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_width (Driver *drvthis)
|
CFontzPacket_width (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -430,7 +422,7 @@ CFontz633_width (Driver *drvthis)
|
|||||||
* Returns the display height in characters
|
* Returns the display height in characters
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_height (Driver *drvthis)
|
CFontzPacket_height (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -442,7 +434,7 @@ CFontz633_height (Driver *drvthis)
|
|||||||
* Returns the width of a character in pixels
|
* Returns the width of a character in pixels
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_cellwidth (Driver *drvthis)
|
CFontzPacket_cellwidth (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -454,7 +446,7 @@ CFontz633_cellwidth (Driver *drvthis)
|
|||||||
* Returns the height of a character in pixels
|
* Returns the height of a character in pixels
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_cellheight (Driver *drvthis)
|
CFontzPacket_cellheight (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -466,7 +458,7 @@ CFontz633_cellheight (Driver *drvthis)
|
|||||||
* Flushes all output to the lcd...
|
* Flushes all output to the lcd...
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_flush (Driver *drvthis)
|
CFontzPacket_flush (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
int i,j;
|
int i,j;
|
||||||
@@ -588,7 +580,7 @@ CFontz633_flush (Driver *drvthis)
|
|||||||
* Return one char from the KeyRing
|
* Return one char from the KeyRing
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT char *
|
MODULE_EXPORT char *
|
||||||
CFontz633_get_key (Driver *drvthis)
|
CFontzPacket_get_key (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
unsigned char key;
|
unsigned char key;
|
||||||
@@ -596,52 +588,52 @@ CFontz633_get_key (Driver *drvthis)
|
|||||||
key = GetKeyFromKeyRing(&keyring);
|
key = GetKeyFromKeyRing(&keyring);
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case CF633_KEY_LEFT:
|
case CFP_KEY_LEFT:
|
||||||
return "Left";
|
return "Left";
|
||||||
break;
|
break;
|
||||||
case CF633_KEY_UP:
|
case CFP_KEY_UP:
|
||||||
return "Up";
|
return "Up";
|
||||||
break;
|
break;
|
||||||
case CF633_KEY_DOWN:
|
case CFP_KEY_DOWN:
|
||||||
return "Down";
|
return "Down";
|
||||||
break;
|
break;
|
||||||
case CF633_KEY_RIGHT:
|
case CFP_KEY_RIGHT:
|
||||||
return "Right";
|
return "Right";
|
||||||
break;
|
break;
|
||||||
case CF633_KEY_ENTER:
|
case CFP_KEY_ENTER:
|
||||||
return "Enter";
|
return "Enter";
|
||||||
break;
|
break;
|
||||||
case CF633_KEY_ESCAPE:
|
case CFP_KEY_ESCAPE:
|
||||||
return "Escape";
|
return "Escape";
|
||||||
break;
|
break;
|
||||||
case CF631_KEY_UL_PRESS:
|
case CFP_KEY_UL_PRESS:
|
||||||
return "Up";
|
return "Up";
|
||||||
break;
|
break;
|
||||||
case CF631_KEY_UR_PRESS:
|
case CFP_KEY_UR_PRESS:
|
||||||
return "Enter";
|
return "Enter";
|
||||||
break;
|
break;
|
||||||
case CF631_KEY_LL_PRESS:
|
case CFP_KEY_LL_PRESS:
|
||||||
return "Down";
|
return "Down";
|
||||||
break;
|
break;
|
||||||
case CF631_KEY_LR_PRESS:
|
case CFP_KEY_LR_PRESS:
|
||||||
return "Escape";
|
return "Escape";
|
||||||
break;
|
break;
|
||||||
case CF633_KEY_UP_RELEASE:
|
case CFP_KEY_UP_RELEASE:
|
||||||
case CF633_KEY_DOWN_RELEASE:
|
case CFP_KEY_DOWN_RELEASE:
|
||||||
case CF633_KEY_LEFT_RELEASE:
|
case CFP_KEY_LEFT_RELEASE:
|
||||||
case CF633_KEY_RIGHT_RELEASE:
|
case CFP_KEY_RIGHT_RELEASE:
|
||||||
case CF633_KEY_ENTER_RELEASE:
|
case CFP_KEY_ENTER_RELEASE:
|
||||||
case CF633_KEY_ESCAPE_RELEASE:
|
case CFP_KEY_ESCAPE_RELEASE:
|
||||||
case CF631_KEY_UL_RELEASE:
|
case CFP_KEY_UL_RELEASE:
|
||||||
case CF631_KEY_UR_RELEASE:
|
case CFP_KEY_UR_RELEASE:
|
||||||
case CF631_KEY_LL_RELEASE:
|
case CFP_KEY_LL_RELEASE:
|
||||||
case CF631_KEY_LR_RELEASE:
|
case CFP_KEY_LR_RELEASE:
|
||||||
// report( RPT_INFO, "cfontz633: Returning key release 0x%2x", key);
|
// report( RPT_INFO, "CFontzPacket: Returning key release 0x%2x", key);
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (key != '\0')
|
if (key != '\0')
|
||||||
report( RPT_INFO, "cfontz633: Untreated unknown key 0x%2x", key);
|
report( RPT_INFO, "CFontzPacket: Untreated unknown key 0x%2x", key);
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -654,7 +646,7 @@ CFontz633_get_key (Driver *drvthis)
|
|||||||
* The upper-left is (1,1), and the lower right should be (16,2).
|
* The upper-left is (1,1), and the lower right should be (16,2).
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_chr (Driver *drvthis, int x, int y, char c)
|
CFontzPacket_chr (Driver *drvthis, int x, int y, char c)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -672,7 +664,7 @@ CFontz633_chr (Driver *drvthis, int x, int y, char c)
|
|||||||
* The upper-left is (1,1), and the lower right should be (16,2).
|
* The upper-left is (1,1), and the lower right should be (16,2).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_raw_chr (Driver *drvthis, int x, int y, unsigned char c)
|
CFontzPacket_raw_chr (Driver *drvthis, int x, int y, unsigned char c)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -689,7 +681,7 @@ CFontz633_raw_chr (Driver *drvthis, int x, int y, unsigned char c)
|
|||||||
* cannot be retrieved from the LCD.
|
* cannot be retrieved from the LCD.
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_get_contrast (Driver *drvthis)
|
CFontzPacket_get_contrast (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -701,7 +693,7 @@ CFontz633_get_contrast (Driver *drvthis)
|
|||||||
* Changes screen contrast (in promille)
|
* Changes screen contrast (in promille)
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_set_contrast (Driver *drvthis, int promille)
|
CFontzPacket_set_contrast (Driver *drvthis, int promille)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
int hardware_contrast;
|
int hardware_contrast;
|
||||||
@@ -727,7 +719,7 @@ CFontz633_set_contrast (Driver *drvthis, int promille)
|
|||||||
* Retrieves brightness (in promille)
|
* Retrieves brightness (in promille)
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_get_brightness(Driver *drvthis, int state)
|
CFontzPacket_get_brightness(Driver *drvthis, int state)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -739,7 +731,7 @@ CFontz633_get_brightness(Driver *drvthis, int state)
|
|||||||
* Sets on/off brightness (in promille)
|
* Sets on/off brightness (in promille)
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_set_brightness(Driver *drvthis, int state, int promille)
|
CFontzPacket_set_brightness(Driver *drvthis, int state, int promille)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -750,11 +742,11 @@ CFontz633_set_brightness(Driver *drvthis, int state, int promille)
|
|||||||
/* store the software value since there is not get */
|
/* store the software value since there is not get */
|
||||||
if (state == BACKLIGHT_ON) {
|
if (state == BACKLIGHT_ON) {
|
||||||
p->brightness = promille;
|
p->brightness = promille;
|
||||||
//CFontz633_backlight(drvthis, BACKLIGHT_ON);
|
//CFontzPacket_backlight(drvthis, BACKLIGHT_ON);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p->offbrightness = promille;
|
p->offbrightness = promille;
|
||||||
//CFontz633_backlight(drvthis, BACKLIGHT_OFF);
|
//CFontzPacket_backlight(drvthis, BACKLIGHT_OFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,7 +756,7 @@ CFontz633_set_brightness(Driver *drvthis, int state, int promille)
|
|||||||
* The hardware support any value between 0 and 100.
|
* The hardware support any value between 0 and 100.
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_backlight (Driver *drvthis, int on)
|
CFontzPacket_backlight (Driver *drvthis, int on)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
int hardware_value = (on == BACKLIGHT_ON)
|
int hardware_value = (on == BACKLIGHT_ON)
|
||||||
@@ -781,7 +773,7 @@ CFontz633_backlight (Driver *drvthis, int on)
|
|||||||
* Get rid of the blinking cursor
|
* Get rid of the blinking cursor
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_hidecursor (Driver *drvthis)
|
CFontzPacket_hidecursor (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -793,7 +785,7 @@ CFontz633_hidecursor (Driver *drvthis)
|
|||||||
* Stop live reporting of temperature.
|
* Stop live reporting of temperature.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_no_live_report (Driver *drvthis)
|
CFontzPacket_no_live_report (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
unsigned char out[2] = { 0, 0 };
|
unsigned char out[2] = { 0, 0 };
|
||||||
@@ -809,7 +801,7 @@ CFontz633_no_live_report (Driver *drvthis)
|
|||||||
* Stop the reporting of any fan.
|
* Stop the reporting of any fan.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_no_fan_report (Driver *drvthis)
|
CFontzPacket_no_fan_report (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -822,7 +814,7 @@ CFontz633_no_fan_report (Driver *drvthis)
|
|||||||
* Stop the reporting of any temperature.
|
* Stop the reporting of any temperature.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_no_temp_report (Driver *drvthis)
|
CFontzPacket_no_temp_report (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
unsigned char out[4] = { 0, 0, 0, 0 };
|
unsigned char out[4] = { 0, 0, 0, 0 };
|
||||||
@@ -836,7 +828,7 @@ CFontz633_no_temp_report (Driver *drvthis)
|
|||||||
* Reset the display bios
|
* Reset the display bios
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_reboot (Driver *drvthis)
|
CFontzPacket_reboot (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
unsigned char out[3] = { 8, 18, 99 };
|
unsigned char out[3] = { 8, 18, 99 };
|
||||||
@@ -850,7 +842,7 @@ CFontz633_reboot (Driver *drvthis)
|
|||||||
* Sets up for vertical bars.
|
* Sets up for vertical bars.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_init_vbar (Driver *drvthis)
|
CFontzPacket_init_vbar (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
char a[] = {
|
char a[] = {
|
||||||
@@ -927,18 +919,18 @@ CFontz633_init_vbar (Driver *drvthis)
|
|||||||
if (p->ccmode != vbar) {
|
if (p->ccmode != vbar) {
|
||||||
if (p->ccmode != standard) {
|
if (p->ccmode != standard) {
|
||||||
/* Not supported(yet) */
|
/* Not supported(yet) */
|
||||||
report(RPT_WARNING, "CFontz633_init_vbar: Cannot combine two modes using user defined characters");
|
report(RPT_WARNING, "CFontzPacket_init_vbar: Cannot combine two modes using user defined characters");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p->ccmode = vbar;
|
p->ccmode = vbar;
|
||||||
|
|
||||||
CFontz633_set_char (drvthis, 1, a);
|
CFontzPacket_set_char (drvthis, 1, a);
|
||||||
CFontz633_set_char (drvthis, 2, b);
|
CFontzPacket_set_char (drvthis, 2, b);
|
||||||
CFontz633_set_char (drvthis, 3, c);
|
CFontzPacket_set_char (drvthis, 3, c);
|
||||||
CFontz633_set_char (drvthis, 4, d);
|
CFontzPacket_set_char (drvthis, 4, d);
|
||||||
CFontz633_set_char (drvthis, 5, e);
|
CFontzPacket_set_char (drvthis, 5, e);
|
||||||
CFontz633_set_char (drvthis, 6, f);
|
CFontzPacket_set_char (drvthis, 6, f);
|
||||||
CFontz633_set_char (drvthis, 7, g);
|
CFontzPacket_set_char (drvthis, 7, g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,7 +939,7 @@ CFontz633_init_vbar (Driver *drvthis)
|
|||||||
* Inits horizontal bars...
|
* Inits horizontal bars...
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_init_hbar (Driver *drvthis)
|
CFontzPacket_init_hbar (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
char a[] = {
|
char a[] = {
|
||||||
@@ -1014,17 +1006,17 @@ CFontz633_init_hbar (Driver *drvthis)
|
|||||||
if (p->ccmode != hbar) {
|
if (p->ccmode != hbar) {
|
||||||
if (p->ccmode != standard) {
|
if (p->ccmode != standard) {
|
||||||
/* Not supported(yet) */
|
/* Not supported(yet) */
|
||||||
report(RPT_WARNING, "CFontz633_init_hbar: Cannot combine two modes using user defined characters");
|
report(RPT_WARNING, "CFontzPacket_init_hbar: Cannot combine two modes using user defined characters");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p->ccmode = hbar;
|
p->ccmode = hbar;
|
||||||
|
|
||||||
CFontz633_set_char (drvthis, 1, a);
|
CFontzPacket_set_char (drvthis, 1, a);
|
||||||
CFontz633_set_char (drvthis, 2, b);
|
CFontzPacket_set_char (drvthis, 2, b);
|
||||||
CFontz633_set_char (drvthis, 3, c);
|
CFontzPacket_set_char (drvthis, 3, c);
|
||||||
CFontz633_set_char (drvthis, 4, d);
|
CFontzPacket_set_char (drvthis, 4, d);
|
||||||
CFontz633_set_char (drvthis, 5, e);
|
CFontzPacket_set_char (drvthis, 5, e);
|
||||||
CFontz633_set_char (drvthis, 6, f);
|
CFontzPacket_set_char (drvthis, 6, f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,7 +1025,7 @@ CFontz633_init_hbar (Driver *drvthis)
|
|||||||
* Draws a vertical bar...
|
* Draws a vertical bar...
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
CFontzPacket_vbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
/* x and y are the start position of the bar.
|
/* x and y are the start position of the bar.
|
||||||
* The bar by default grows in the 'up' direction
|
* The bar by default grows in the 'up' direction
|
||||||
@@ -1043,7 +1035,7 @@ CFontz633_vbar (Driver *drvthis, int x, int y, int len, int promille, int option
|
|||||||
*/
|
*/
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
CFontz633_init_vbar(drvthis);
|
CFontzPacket_init_vbar(drvthis);
|
||||||
lib_vbar_static(drvthis, x, y, len, promille, options, p->cellheight, 0);
|
lib_vbar_static(drvthis, x, y, len, promille, options, p->cellheight, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1052,7 +1044,7 @@ CFontz633_vbar (Driver *drvthis, int x, int y, int len, int promille, int option
|
|||||||
* Draws a horizontal bar to the right.
|
* Draws a horizontal bar to the right.
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
CFontzPacket_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||||
{
|
{
|
||||||
/* x and y are the start position of the bar.
|
/* x and y are the start position of the bar.
|
||||||
* The bar by default grows in the 'right' direction
|
* The bar by default grows in the 'right' direction
|
||||||
@@ -1062,7 +1054,7 @@ CFontz633_hbar (Driver *drvthis, int x, int y, int len, int promille, int option
|
|||||||
*/
|
*/
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
CFontz633_init_hbar(drvthis);
|
CFontzPacket_init_hbar(drvthis);
|
||||||
lib_hbar_static(drvthis, x, y, len, promille, options, p->cellwidth, 0);
|
lib_hbar_static(drvthis, x, y, len, promille, options, p->cellwidth, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1071,7 +1063,7 @@ CFontz633_hbar (Driver *drvthis, int x, int y, int len, int promille, int option
|
|||||||
* Inits big numbers
|
* Inits big numbers
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
CFontz633_init_num(Driver *drvthis)
|
CFontzPacket_init_num(Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -1154,14 +1146,14 @@ char bignum_ccs[8][CELLWIDTH*CELLHEIGHT] = {
|
|||||||
|
|
||||||
if (p->ccmode != standard) {
|
if (p->ccmode != standard) {
|
||||||
/* Not supported (yet) */
|
/* Not supported (yet) */
|
||||||
report(RPT_WARNING, "CFontz633_init_num: Cannot combine two modes using user defined characters");
|
report(RPT_WARNING, "CFontzPacket_init_num: Cannot combine two modes using user defined characters");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->ccmode = bignum;
|
p->ccmode = bignum;
|
||||||
|
|
||||||
for (i = 0; i < NUM_CCs; i++)
|
for (i = 0; i < NUM_CCs; i++)
|
||||||
CFontz633_set_char(drvthis, i, bignum_ccs[i]);
|
CFontzPacket_set_char(drvthis, i, bignum_ccs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,7 +1163,7 @@ char bignum_ccs[8][CELLWIDTH*CELLHEIGHT] = {
|
|||||||
* Only works on 4-line displays
|
* Only works on 4-line displays
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_num(Driver *drvthis, int x, int num)
|
CFontzPacket_num(Driver *drvthis, int x, int num)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -1246,18 +1238,18 @@ char bignum_map[11][4][3] = {
|
|||||||
int y = (p->height - 2) / 2; /* center vertically */
|
int y = (p->height - 2) / 2; /* center vertically */
|
||||||
int x2, y2;
|
int x2, y2;
|
||||||
|
|
||||||
CFontz633_init_num(drvthis);
|
CFontzPacket_init_num(drvthis);
|
||||||
|
|
||||||
for (x2 = 0; x2 < 3; x2++) {
|
for (x2 = 0; x2 < 3; x2++) {
|
||||||
for (y2 = 0; y2 < 4; y2++) {
|
for (y2 = 0; y2 < 4; y2++) {
|
||||||
CFontz633_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
|
CFontzPacket_chr(drvthis, x+x2, y+y2, bignum_map[num][y2][x2]);
|
||||||
}
|
}
|
||||||
if (num == 10)
|
if (num == 10)
|
||||||
x2 = 2; /* = break, for colon only */
|
x2 = 2; /* = break, for colon only */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CFontz633_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
CFontzPacket_chr(drvthis, x, 1 + (p->height - 1) / 2,
|
||||||
(num == 10) ? ':' : (num + '0'));
|
(num == 10) ? ':' : (num + '0'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1271,7 +1263,7 @@ char bignum_map[11][4][3] = {
|
|||||||
* The input is just an array of characters...
|
* The input is just an array of characters...
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_set_char (Driver *drvthis, int n, char *dat)
|
CFontzPacket_set_char (Driver *drvthis, int n, char *dat)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
unsigned char out[9];
|
unsigned char out[9];
|
||||||
@@ -1301,7 +1293,7 @@ CFontz633_set_char (Driver *drvthis, int n, char *dat)
|
|||||||
* Places an icon on screen
|
* Places an icon on screen
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT int
|
MODULE_EXPORT int
|
||||||
CFontz633_icon (Driver *drvthis, int x, int y, int icon)
|
CFontzPacket_icon (Driver *drvthis, int x, int y, int icon)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
char icons[8][6 * 8] = {
|
char icons[8][6 * 8] = {
|
||||||
@@ -1399,67 +1391,67 @@ CFontz633_icon (Driver *drvthis, int x, int y, int icon)
|
|||||||
switch (icon) {
|
switch (icon) {
|
||||||
case ICON_BLOCK_FILLED:
|
case ICON_BLOCK_FILLED:
|
||||||
if (p->model == 633)
|
if (p->model == 633)
|
||||||
CFontz633_chr(drvthis, x, y, 255);
|
CFontzPacket_chr(drvthis, x, y, 255);
|
||||||
else
|
else
|
||||||
CFontz633_raw_chr(drvthis, x, y, 31);
|
CFontzPacket_raw_chr(drvthis, x, y, 31);
|
||||||
break;
|
break;
|
||||||
case ICON_HEART_FILLED:
|
case ICON_HEART_FILLED:
|
||||||
CFontz633_set_char(drvthis, 0, icons[1]);
|
CFontzPacket_set_char(drvthis, 0, icons[1]);
|
||||||
CFontz633_chr(drvthis, x, y, 0);
|
CFontzPacket_chr(drvthis, x, y, 0);
|
||||||
break;
|
break;
|
||||||
case ICON_HEART_OPEN:
|
case ICON_HEART_OPEN:
|
||||||
CFontz633_set_char(drvthis, 0, icons[0]);
|
CFontzPacket_set_char(drvthis, 0, icons[0]);
|
||||||
CFontz633_chr(drvthis, x, y, 0);
|
CFontzPacket_chr(drvthis, x, y, 0);
|
||||||
break;
|
break;
|
||||||
case ICON_ARROW_UP:
|
case ICON_ARROW_UP:
|
||||||
if (p->model == 633) {
|
if (p->model == 633) {
|
||||||
CFontz633_set_char(drvthis, 1, icons[2]);
|
CFontzPacket_set_char(drvthis, 1, icons[2]);
|
||||||
CFontz633_chr(drvthis, x, y, 1);
|
CFontzPacket_chr(drvthis, x, y, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0xDE);
|
CFontzPacket_raw_chr(drvthis, x, y, 0xDE);
|
||||||
break;
|
break;
|
||||||
case ICON_ARROW_DOWN:
|
case ICON_ARROW_DOWN:
|
||||||
if (p->model == 633) {
|
if (p->model == 633) {
|
||||||
CFontz633_set_char(drvthis, 2, icons[3]);
|
CFontzPacket_set_char(drvthis, 2, icons[3]);
|
||||||
CFontz633_chr(drvthis, x, y, 2);
|
CFontzPacket_chr(drvthis, x, y, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0xE0);
|
CFontzPacket_raw_chr(drvthis, x, y, 0xE0);
|
||||||
break;
|
break;
|
||||||
case ICON_ARROW_LEFT:
|
case ICON_ARROW_LEFT:
|
||||||
if (p->model == 633)
|
if (p->model == 633)
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0x7F);
|
CFontzPacket_raw_chr(drvthis, x, y, 0x7F);
|
||||||
else
|
else
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0xE1);
|
CFontzPacket_raw_chr(drvthis, x, y, 0xE1);
|
||||||
break;
|
break;
|
||||||
case ICON_ARROW_RIGHT:
|
case ICON_ARROW_RIGHT:
|
||||||
if (p->model == 633)
|
if (p->model == 633)
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0x7E);
|
CFontzPacket_raw_chr(drvthis, x, y, 0x7E);
|
||||||
else
|
else
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0xDF);
|
CFontzPacket_raw_chr(drvthis, x, y, 0xDF);
|
||||||
break;
|
break;
|
||||||
case ICON_CHECKBOX_OFF:
|
case ICON_CHECKBOX_OFF:
|
||||||
CFontz633_set_char(drvthis, 3, icons[4]);
|
CFontzPacket_set_char(drvthis, 3, icons[4]);
|
||||||
CFontz633_chr(drvthis, x, y, 3);
|
CFontzPacket_chr(drvthis, x, y, 3);
|
||||||
break;
|
break;
|
||||||
case ICON_CHECKBOX_ON:
|
case ICON_CHECKBOX_ON:
|
||||||
CFontz633_set_char(drvthis, 4, icons[5]);
|
CFontzPacket_set_char(drvthis, 4, icons[5]);
|
||||||
CFontz633_chr(drvthis, x, y, 4);
|
CFontzPacket_chr(drvthis, x, y, 4);
|
||||||
break;
|
break;
|
||||||
case ICON_CHECKBOX_GRAY:
|
case ICON_CHECKBOX_GRAY:
|
||||||
CFontz633_set_char(drvthis, 5, icons[6]);
|
CFontzPacket_set_char(drvthis, 5, icons[6]);
|
||||||
CFontz633_chr(drvthis, x, y, 5);
|
CFontzPacket_chr(drvthis, x, y, 5);
|
||||||
break;
|
break;
|
||||||
case ICON_SELECTOR_AT_LEFT:
|
case ICON_SELECTOR_AT_LEFT:
|
||||||
if (p->model == 633)
|
if (p->model == 633)
|
||||||
return -1;
|
return -1;
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0x10);
|
CFontzPacket_raw_chr(drvthis, x, y, 0x10);
|
||||||
break;
|
break;
|
||||||
case ICON_SELECTOR_AT_RIGHT:
|
case ICON_SELECTOR_AT_RIGHT:
|
||||||
if (p->model == 633)
|
if (p->model == 633)
|
||||||
return -1;
|
return -1;
|
||||||
CFontz633_raw_chr(drvthis, x, y, 0x11);
|
CFontzPacket_raw_chr(drvthis, x, y, 0x11);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -1; /* Let the core do other icons */
|
return -1; /* Let the core do other icons */
|
||||||
@@ -1472,7 +1464,7 @@ CFontz633_icon (Driver *drvthis, int x, int y, int icon)
|
|||||||
* Clears the LCD screen
|
* Clears the LCD screen
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_clear (Driver *drvthis)
|
CFontzPacket_clear (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -1485,7 +1477,7 @@ CFontz633_clear (Driver *drvthis)
|
|||||||
* Hardware clears the LCD screen
|
* Hardware clears the LCD screen
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CFontz633_hardware_clear (Driver *drvthis)
|
CFontzPacket_hardware_clear (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
@@ -1498,7 +1490,7 @@ CFontz633_hardware_clear (Driver *drvthis)
|
|||||||
* upper-left is (1,1), and the lower right is (p->width, p->height).
|
* upper-left is (1,1), and the lower right is (p->width, p->height).
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_string (Driver *drvthis, int x, int y, char string[])
|
CFontzPacket_string (Driver *drvthis, int x, int y, char string[])
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
int i;
|
int i;
|
||||||
@@ -1522,7 +1514,7 @@ CFontz633_string (Driver *drvthis, int x, int y, char string[])
|
|||||||
* Output values using the LEDs of a CF635
|
* Output values using the LEDs of a CF635
|
||||||
*/
|
*/
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
CFontz633_output(Driver *drvthis, int state)
|
CFontzPacket_output(Driver *drvthis, int state)
|
||||||
{
|
{
|
||||||
static const unsigned char CFontz635_LEDs[CF635_NUM_LEDs] = {
|
static const unsigned char CFontz635_LEDs[CF635_NUM_LEDs] = {
|
||||||
11, 9, 7, 5, // Green LEDs first, Top first
|
11, 9, 7, 5, // Green LEDs first, Top first
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#ifndef CFONTZPACKET_H
|
||||||
|
#define CFONTZPACKET_H
|
||||||
|
|
||||||
|
#include "lcd.h"
|
||||||
|
|
||||||
|
#define DEFAULT_CELL_WIDTH 6
|
||||||
|
#define DEFAULT_CELL_HEIGHT 8
|
||||||
|
#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"
|
||||||
|
|
||||||
|
|
||||||
|
MODULE_EXPORT int CFontzPacket_init (Driver *drvthis);
|
||||||
|
MODULE_EXPORT void CFontzPacket_close (Driver *drvthis);
|
||||||
|
MODULE_EXPORT int CFontzPacket_width (Driver *drvthis);
|
||||||
|
MODULE_EXPORT int CFontzPacket_height (Driver *drvthis);
|
||||||
|
MODULE_EXPORT int CFontzPacket_cellwidth (Driver *drvthis);
|
||||||
|
MODULE_EXPORT int CFontzPacket_cellheight (Driver *drvthis);
|
||||||
|
MODULE_EXPORT void CFontzPacket_clear (Driver *drvthis);
|
||||||
|
MODULE_EXPORT void CFontzPacket_flush (Driver *drvthis);
|
||||||
|
MODULE_EXPORT void CFontzPacket_string (Driver *drvthis, int x, int y, char string[]);
|
||||||
|
MODULE_EXPORT void CFontzPacket_chr (Driver *drvthis, int x, int y, char c);
|
||||||
|
MODULE_EXPORT char *CFontzPacket_get_key (Driver *drvthis);
|
||||||
|
|
||||||
|
MODULE_EXPORT void CFontzPacket_vbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
|
MODULE_EXPORT void CFontzPacket_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||||
|
MODULE_EXPORT void CFontzPacket_num (Driver *drvthis, int x, int num);
|
||||||
|
MODULE_EXPORT int CFontzPacket_icon(Driver *drvthis, int x, int y, int icon);
|
||||||
|
|
||||||
|
MODULE_EXPORT void CFontzPacket_set_char (Driver *drvthis, int n, char *dat);
|
||||||
|
|
||||||
|
MODULE_EXPORT int CFontzPacket_get_contrast (Driver *drvthis);
|
||||||
|
MODULE_EXPORT void CFontzPacket_set_contrast (Driver *drvthis, int promille);
|
||||||
|
MODULE_EXPORT int CFontzPacket_get_brightness (Driver *drvthis, int state);
|
||||||
|
MODULE_EXPORT void CFontzPacket_set_brightness (Driver *drvthis, int state, int promille);
|
||||||
|
MODULE_EXPORT void CFontzPacket_backlight (Driver *drvthis, int on);
|
||||||
|
MODULE_EXPORT void CFontzPacket_output (Driver *drvthis, int state);
|
||||||
|
|
||||||
|
#endif /* CFONTZPACKET_H */
|
||||||
@@ -18,7 +18,7 @@ AM_LDFLAGS = @LDSHARED@
|
|||||||
LIBS =
|
LIBS =
|
||||||
|
|
||||||
pkglib_PROGRAMS = @DRIVERS@
|
pkglib_PROGRAMS = @DRIVERS@
|
||||||
EXTRA_PROGRAMS = bayrad CFontz CFontz633 curses CwLnx glcdlib glk hd44780 icp_a106 imon IOWarrior irman joy lb216 lcdm001 lcterm lirc ms6931 mtc_s16209x MtxOrb NoritakeVFD pylcd sed1330 sed1520 stv5730 svga t6963 text tyan wirz_sli xosd
|
EXTRA_PROGRAMS = bayrad CFontz CFontz633 CFontzPacket curses CwLnx glcdlib glk hd44780 icp_a106 imon IOWarrior irman joy lb216 lcdm001 lcterm lirc ms6931 mtc_s16209x MtxOrb NoritakeVFD pylcd sed1330 sed1520 stv5730 svga t6963 text tyan wirz_sli xosd
|
||||||
noinst_LIBRARIES = libLCD.a
|
noinst_LIBRARIES = libLCD.a
|
||||||
|
|
||||||
IOWarrior_CFLAGS = @libusb_cflags@
|
IOWarrior_CFLAGS = @libusb_cflags@
|
||||||
@@ -26,6 +26,7 @@ hd44780_CFLAGS = @libusb_cflags@
|
|||||||
|
|
||||||
CFontz_LDADD = libLCD.a
|
CFontz_LDADD = libLCD.a
|
||||||
CFontz633_LDADD = libLCD.a
|
CFontz633_LDADD = libLCD.a
|
||||||
|
CFontzPacket_LDADD = libLCD.a
|
||||||
curses_LDADD = @LIBCURSES@
|
curses_LDADD = @LIBCURSES@
|
||||||
CwLnx_LDADD = libLCD.a
|
CwLnx_LDADD = libLCD.a
|
||||||
CwLnx_SOURCES = lcd.h CwLnx.c CwLnx.h report.h
|
CwLnx_SOURCES = lcd.h CwLnx.c CwLnx.h report.h
|
||||||
@@ -48,11 +49,12 @@ libLCD_a_SOURCES = lcd_lib.h lcd_lib.c
|
|||||||
bayrad_SOURCES = lcd.h bayrad.h bayrad.c report.h
|
bayrad_SOURCES = lcd.h bayrad.h bayrad.c report.h
|
||||||
CFontz_SOURCES = lcd.h CFontz.c CFontz.h CFontz-charmap.h report.h
|
CFontz_SOURCES = lcd.h CFontz.c CFontz.h CFontz-charmap.h report.h
|
||||||
CFontz633_SOURCES = lcd.h CFontz633.c CFontz633.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h
|
CFontz633_SOURCES = lcd.h CFontz633.c CFontz633.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h
|
||||||
|
CFontzPacket_SOURCES = lcd.h CFontzPacket.c CFontzPacket.h CFontz-charmap.h CFontz633io.c CFontz633io.h report.h
|
||||||
curses_SOURCES = lcd.h curses_drv.h curses_drv.c report.h
|
curses_SOURCES = lcd.h curses_drv.h curses_drv.c report.h
|
||||||
glcdlib_SOURCES = lcd.h glcdlib.h glcdlib.c report.h
|
glcdlib_SOURCES = lcd.h glcdlib.h glcdlib.c report.h
|
||||||
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
||||||
hd44780_SOURCES = lcd.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h
|
hd44780_SOURCES = lcd.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h
|
||||||
EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-winamp.c hd44780-winamp.h hd44780-picanlcd.c hd44780-picanlcd.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcdserializer.c hd44780-lcdserializer.h hd44780-lis2.c hd44780-lis2.h port.h lpt-port.h timing.h
|
EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-winamp.c hd44780-winamp.h hd44780-picanlcd.c hd44780-picanlcd.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcdserializer.c hd44780-lcdserializer.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h port.h lpt-port.h timing.h
|
||||||
|
|
||||||
icp_a106_SOURCES = lcd.h icp_a106.c icp_a106.h report.h
|
icp_a106_SOURCES = lcd.h icp_a106.c icp_a106.h report.h
|
||||||
imon_SOURCES = lcd.h imon.h imon.c report.h
|
imon_SOURCES = lcd.h imon.h imon.c report.h
|
||||||
@@ -79,3 +81,4 @@ wirz_sli_SOURCES = lcd.h wirz-sli.h wirz-sli.c report.h
|
|||||||
xosd_SOURCES = lcd.h xosdlib_drv.c xosdlib_drv.h report.h
|
xosd_SOURCES = lcd.h xosdlib_drv.c xosdlib_drv.h report.h
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)
|
INCLUDES = -I$(top_srcdir)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
#include "hd44780-picanlcd.h"
|
#include "hd44780-picanlcd.h"
|
||||||
#include "hd44780-lcdserializer.h"
|
#include "hd44780-lcdserializer.h"
|
||||||
#include "hd44780-lis2.h"
|
#include "hd44780-lis2.h"
|
||||||
|
#ifdef HAVE_I2C
|
||||||
|
# include "hd44780-i2c.h"
|
||||||
|
#endif
|
||||||
// add new connection type header files here
|
// add new connection type header files here
|
||||||
|
|
||||||
static const ConnectionMapping connectionMapping[] = {
|
static const ConnectionMapping connectionMapping[] = {
|
||||||
@@ -41,6 +44,9 @@ static const ConnectionMapping connectionMapping[] = {
|
|||||||
{"lis2", hd_init_lis2, "\tnone\n"},
|
{"lis2", hd_init_lis2, "\tnone\n"},
|
||||||
#ifdef HAVE_LIBUSB
|
#ifdef HAVE_LIBUSB
|
||||||
{"bwctusb", hd_init_bwct_usb, "\tnone\n"},
|
{"bwctusb", hd_init_bwct_usb, "\tnone\n"},
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_I2C
|
||||||
|
{"i2c", hd_init_i2c, "\tnone\n"},
|
||||||
#endif
|
#endif
|
||||||
// add new connection types and their string specifier here
|
// add new connection types and their string specifier here
|
||||||
// default, end of structure element (do not delete)
|
// default, end of structure element (do not delete)
|
||||||
|
|||||||
@@ -0,0 +1,234 @@
|
|||||||
|
/*
|
||||||
|
* i2c driver module for Hitachi HD44780 based LCD displays.
|
||||||
|
* The LCD is operated in it's 4 bit-mode to be connected to the 8 bit-port
|
||||||
|
* of a single PCF8574(A) or PCA9554(A) that is accessed by the server via the i2c bus.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2005 Matthias Goebl <matthias.goebl@goebl.net>
|
||||||
|
* 2000, 1999, 1995 Benjamin Tse <blt@Comports.com>
|
||||||
|
* 2001 Joris Robijn <joris@robijn.net>
|
||||||
|
* 1999 Andrew McMeikan <andrewm@engineer.com>
|
||||||
|
* 1998 Richard Rognlie <rrognlie@gamerz.net>
|
||||||
|
* 1997 Matthias Prinke <m.prinke@trashcan.mcnet.de>
|
||||||
|
*
|
||||||
|
* The connections are:
|
||||||
|
* PCF8574AP LCD
|
||||||
|
* P0 (4) D4 (11)
|
||||||
|
* P1 (5) D5 (12)
|
||||||
|
* P2 (6) D6 (13)
|
||||||
|
* P3 (7) D7 (14)
|
||||||
|
* P4 (9) RS (4)
|
||||||
|
* P5 (10) RW (5)
|
||||||
|
* P6 (11) EN (6)
|
||||||
|
*
|
||||||
|
* Backlight
|
||||||
|
* P7 (12) /backlight (optional, active-low)
|
||||||
|
*
|
||||||
|
* Configuration:
|
||||||
|
* device=/dev/i2c-0 # the device file of the i2c bus
|
||||||
|
* port=0x20 # the i2c address of the i2c port expander
|
||||||
|
*
|
||||||
|
* Attention: Bit 8 of the address given in port is special:
|
||||||
|
* It tells the driver to treat the device as PCA9554 or similar,
|
||||||
|
* a device that needs a 2-byte command, and it will be stripped
|
||||||
|
* off the address.
|
||||||
|
* So we have:
|
||||||
|
* port=0x20..0x27 PCF8574 with A[012]=0..7
|
||||||
|
* port=0x38..0x3f PCF8574A with A[012]=0..7
|
||||||
|
* port=0xa0..0xa7 PCA9554 with A[012]=0..7
|
||||||
|
* port=0xa0..0xa7 PCA9554A with A[012]=0..7
|
||||||
|
*
|
||||||
|
* When using this driver, DON'T load the i2c chip module (e.g. pcf8574),
|
||||||
|
* you only need the i2c bus driver module!
|
||||||
|
|
||||||
|
*
|
||||||
|
* Based mostly on the hd44780-4bit module, see there for a complete history.
|
||||||
|
* Suggestions for PCA9554 support from Tonu Samuel <tonu@jes.ee>.
|
||||||
|
*
|
||||||
|
* This file is released under the GNU General Public License. Refer to the
|
||||||
|
* COPYING file distributed with this package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hd44780-i2c.h"
|
||||||
|
#include "hd44780-low.h"
|
||||||
|
|
||||||
|
#include "shared/str.h"
|
||||||
|
#include "shared/report.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <linux/i2c-dev.h>
|
||||||
|
/* I2C_SLAVE is missing in linux/i2c-dev.h from kernel headers of 2.4.x kernels */
|
||||||
|
#ifndef I2C_SLAVE
|
||||||
|
#define I2C_SLAVE 0x0703 /* Change slave address */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Generally, any function that accesses the LCD control lines needs to be
|
||||||
|
// implemented separately for each HW design. This is typically (but not
|
||||||
|
// restricted to):
|
||||||
|
// HD44780_senddata
|
||||||
|
// HD44780_readkeypad
|
||||||
|
|
||||||
|
void i2c_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
|
||||||
|
void i2c_HD44780_backlight (PrivateData *p, unsigned char state);
|
||||||
|
|
||||||
|
#define RS 0x10
|
||||||
|
#define RW 0x20
|
||||||
|
#define EN 0x40
|
||||||
|
#define BL 0x80
|
||||||
|
// note that the above bits are all meant for the data port of PCF8574
|
||||||
|
|
||||||
|
#define I2C_ADDR_MASK 0x7f
|
||||||
|
#define I2C_PCAX_MASK 0x80
|
||||||
|
|
||||||
|
static void
|
||||||
|
i2c_out (PrivateData *p, unsigned char val)
|
||||||
|
{
|
||||||
|
__u8 data[2];
|
||||||
|
int datalen;
|
||||||
|
data[0];
|
||||||
|
if(p->port & I2C_PCAX_MASK) { // we have a PCA9554 or similar, that needs a 2-byte command
|
||||||
|
data[0]=1; // command: read/write output port register
|
||||||
|
data[1]=val;
|
||||||
|
datalen=2;
|
||||||
|
} else { // we have a PCF8574 or similar, that needs a 1-byte command
|
||||||
|
data[0]=val;
|
||||||
|
datalen=1;
|
||||||
|
}
|
||||||
|
if (write(p->fd,data,datalen) != datalen) {
|
||||||
|
report( RPT_ERR, "HD44780: I2C: i2c write data %u to address %u failed: %s", val, p->fd, strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEFAULT_DEVICE "/dev/i2c-0"
|
||||||
|
|
||||||
|
// initialisation function
|
||||||
|
int
|
||||||
|
hd_init_i2c (Driver *drvthis)
|
||||||
|
{
|
||||||
|
PrivateData *p = (PrivateData*) drvthis->private_data;
|
||||||
|
HD44780_functions *hd44780_functions = p->hd44780_functions;
|
||||||
|
|
||||||
|
int enableLines = EN;
|
||||||
|
char device[256] = DEFAULT_DEVICE;
|
||||||
|
p->backlight_bit = BL;
|
||||||
|
|
||||||
|
/* READ CONFIG FILE */
|
||||||
|
|
||||||
|
/* Get serial device to use */
|
||||||
|
strncpy(device, drvthis->config_get_string ( drvthis->name , "device" , 0 , DEFAULT_DEVICE),sizeof(device));
|
||||||
|
device[sizeof(device)-1]=0;
|
||||||
|
report (RPT_INFO,"HD44780: I2C: Using device '%s' and address %u", device, p->port & I2C_ADDR_MASK);
|
||||||
|
|
||||||
|
// Open the I2C device
|
||||||
|
p->fd = open(device,O_RDWR);
|
||||||
|
if (p->fd<0) {
|
||||||
|
report( RPT_CRIT, "HD44780: I2C: open i2c device '%s' failed: %s", device, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set I2C address
|
||||||
|
if (ioctl(p->fd,I2C_SLAVE, p->port & I2C_ADDR_MASK) < 0) {
|
||||||
|
report( RPT_CRIT, "HD44780: I2C: set address to '%i': %s", p->port & I2C_ADDR_MASK, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(p->port & I2C_PCAX_MASK) { // we have a PCA9554 or similar, that needs special config
|
||||||
|
__u8 data[2];
|
||||||
|
data[0]=2; // command: set polarity inversion
|
||||||
|
data[1]=0; // -> no polarity inversion
|
||||||
|
if (write(p->fd,data,2) != 2) {
|
||||||
|
report( RPT_ERR, "HD44780: I2C: i2c set polarity inversion failed: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
data[0]=3; // command: set output direction
|
||||||
|
data[1]=0; // -> all pins are outputs
|
||||||
|
if (write(p->fd,data,2) != 2) {
|
||||||
|
report( RPT_ERR, "HD44780: I2C: i2c set output direction failed: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hd44780_functions->senddata = i2c_HD44780_senddata;
|
||||||
|
hd44780_functions->backlight = i2c_HD44780_backlight;
|
||||||
|
hd44780_functions->scankeypad = NULL;
|
||||||
|
|
||||||
|
// powerup the lcd now
|
||||||
|
/* We'll now send 0x03 a couple of times,
|
||||||
|
* which is in fact (FUNCSET | IF_8BIT) >> 4 */
|
||||||
|
i2c_out (p, 0x03);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
|
||||||
|
i2c_out (p, enableLines | 0x03);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, 0x03);
|
||||||
|
hd44780_functions->uPause (p, 15000);
|
||||||
|
|
||||||
|
i2c_out (p, enableLines | 0x03);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, 0x03);
|
||||||
|
hd44780_functions->uPause (p, 5000);
|
||||||
|
|
||||||
|
i2c_out (p, enableLines | 0x03);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, 0x03);
|
||||||
|
hd44780_functions->uPause (p, 100);
|
||||||
|
|
||||||
|
i2c_out (p, enableLines | 0x03);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, 0x03);
|
||||||
|
hd44780_functions->uPause (p, 100);
|
||||||
|
|
||||||
|
// now in 8-bit mode... set 4-bit mode
|
||||||
|
i2c_out (p, 0x02);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
|
||||||
|
i2c_out (p, enableLines | 0x02);
|
||||||
|
if( p->delayBus ) hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, 0x02);
|
||||||
|
hd44780_functions->uPause (p, 100);
|
||||||
|
|
||||||
|
// Set up two-line, small character (5x8) mode
|
||||||
|
hd44780_functions->senddata (p, 0, RS_INSTR, FUNCSET | IF_4BIT | TWOLINE | SMALLCHAR );
|
||||||
|
hd44780_functions->uPause (p, 40);
|
||||||
|
|
||||||
|
common_init (p, IF_4BIT);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// i2c_HD44780_senddata
|
||||||
|
void
|
||||||
|
i2c_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
|
||||||
|
{
|
||||||
|
unsigned char enableLines = 0, portControl = 0;
|
||||||
|
unsigned char h = (ch >> 4) & 0x0f; // high and low nibbles
|
||||||
|
unsigned char l = ch & 0x0f;
|
||||||
|
|
||||||
|
if (flags == RS_INSTR)
|
||||||
|
portControl = 0;
|
||||||
|
else //if (flags == RS_DATA)
|
||||||
|
portControl = RS;
|
||||||
|
|
||||||
|
portControl |= p->backlight_bit;
|
||||||
|
|
||||||
|
enableLines = EN;
|
||||||
|
|
||||||
|
i2c_out (p, portControl | h);
|
||||||
|
if( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, enableLines | portControl | h);
|
||||||
|
if( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, portControl | h);
|
||||||
|
|
||||||
|
i2c_out (p, portControl | l);
|
||||||
|
if( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, enableLines | portControl | l);
|
||||||
|
if( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||||
|
i2c_out (p, portControl | l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_HD44780_backlight (PrivateData *p, unsigned char state)
|
||||||
|
{
|
||||||
|
p->backlight_bit = ((!p->have_backlight||state)?0:BL);
|
||||||
|
|
||||||
|
i2c_out (p, p->backlight_bit);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef HD_I2C_H
|
||||||
|
#define HD_I2C_H
|
||||||
|
|
||||||
|
#include "lcd.h" /* for Driver */
|
||||||
|
|
||||||
|
// initialise this particular driver
|
||||||
|
int hd_init_i2c (Driver *drvthis);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user