adding PICGraphic driver

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1049 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
peterbailey
2009-11-03 04:59:04 +00:00
parent 318733a9fb
commit d08bf6d19c
5 changed files with 506 additions and 138 deletions
Vendored
+61 -136
View File
@@ -1,7 +1,7 @@
# generated automatically by aclocal 1.11 -*- Autoconf -*-
# generated automatically by aclocal 1.10.2 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
[m4_warning([this file was generated for autoconf 2.64.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
[m4_warning([this file was generated for autoconf 2.63.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -5464,9 +5464,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
openbsd*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
@@ -9184,10 +9181,10 @@ m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11], [],
m4_if([$1], [1.10.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -9203,7 +9200,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11])dnl
[AM_AUTOMAKE_VERSION([1.10.2])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@@ -9263,14 +9260,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -9283,7 +9280,6 @@ AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
@@ -9297,14 +9293,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 10
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -9361,16 +9357,6 @@ AC_CACHE_CHECK([dependency style of $depcc],
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
am__universal=false
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac])
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
@@ -9388,17 +9374,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
@@ -9408,23 +9384,19 @@ AC_CACHE_CHECK([dependency style of $depcc],
break
fi
;;
msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
@@ -9602,13 +9574,13 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
# 2005, 2006, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 16
# serial 13
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
@@ -9625,7 +9597,7 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.62])dnl
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -9676,8 +9648,8 @@ AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
@@ -9685,37 +9657,24 @@ AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
@@ -9738,7 +9697,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -9749,14 +9708,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
@@ -9782,13 +9734,13 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
@@ -9797,7 +9749,7 @@ AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
@@ -9807,24 +9759,24 @@ am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
@@ -9834,14 +9786,14 @@ rm -f confinc confmf
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 6
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -9858,14 +9810,7 @@ AC_SUBST($1)])
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
@@ -9936,14 +9881,14 @@ AC_DEFUN([_AM_IF_OPTION],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# serial 4
# AM_SANITY_CHECK
# ---------------
@@ -9952,29 +9897,16 @@ AC_DEFUN([AM_SANITY_CHECK],
# Just in case
sleep 1
echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
esac
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
@@ -10027,25 +9959,18 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+13 -1
View File
@@ -35,7 +35,7 @@ AC_ARG_WITH(
[ BeckmannEgle, BWCT, CrystalFontz, Curses, Cwlinux, D4D,]
[ G15, GLCD2USB, HD44780, IRLCD, LCD2USB, LCDLinux, LCDTerm,]
[ LPH7508, LUIse, LW_ABP, M50530, MatrixOrbital, MilfordInstruments,]
[ Noritake, NULL, PNG, PPM, Pertelian, PHAnderson, picoLCD,]
[ Noritake, NULL, PNG, PPM, Pertelian, PHAnderson, PICGraphic, picoLCD,]
[ picoLCDGraphic, RouterBoard, Sample, serdisplib, ShuttleVFD,]
[ SimpleLCD, st2205, T6963, Trefon, ULA200, USBLCD, USBHUB,]
[ VNC, WincorNixdorf, X11],
@@ -85,6 +85,7 @@ for driver in $drivers; do
NULL="yes"
PERTELIAN="yes"
PHANDERSON="yes"
PICGRAPHIC="yes"
PICOLCD="yes"
PICOLCDGRAPHIC="yes"
PNG="yes"
@@ -185,6 +186,9 @@ for driver in $drivers; do
PHAnderson)
PHANDERSON=$val
;;
PICGraphic)
PICGRAPHIC=$val
;;
picoLCD)
PICOLCD=$val
;;
@@ -510,6 +514,14 @@ if test "$PHANDERSON" = "yes"; then
AC_DEFINE(WITH_PHANDERSON,1,[PHAnderson driver])
fi
if test "$PICGRAPHIC" = "yes"; then
GRAPHIC="yes"
GPIO="yes"
SERIAL="yes"
DRIVERS="$DRIVERS drv_PICGraphic.o"
AC_DEFINE(WITH_PICGRAPHIC,1,[PICGraphic driver])
fi
if test "$PICOLCD" = "yes"; then
if test "$has_usb" = "true"; then
TEXT="yes"
+4
View File
@@ -73,6 +73,7 @@ extern DRIVER drv_Noritake;
extern DRIVER drv_NULL;
extern DRIVER drv_Pertelian;
extern DRIVER drv_PHAnderson;
extern DRIVER drv_PICGraphic;
extern DRIVER drv_picoLCD;
extern DRIVER drv_picoLCDGraphic;
extern DRIVER drv_RouterBoard;
@@ -175,6 +176,9 @@ DRIVER *Driver[] = {
#ifdef WITH_PHANDERSON
&drv_PHAnderson,
#endif
#ifdef WITH_PICGRAPHIC
&drv_PICGraphic,
#endif
#ifdef WITH_PICOLCD
&drv_picoLCD,
#endif
+427
View File
@@ -0,0 +1,427 @@
/* $Id$
* $URL$
*
* PICGraphic lcd4linux driver
*
* Copyright (C) 2009 Peter Bailey <peter.eldridge.bailey@gmail.com>
* Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
* Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
*
* This file is part of LCD4Linux.
*
* LCD4Linux is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* LCD4Linux is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
*
* exported fuctions:
*
* struct DRIVER drv_PICGraphic
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include "debug.h"
#include "cfg.h"
#include "qprintf.h"
#include "udelay.h"
#include "plugin.h"
#include "widget.h"
#include "widget_text.h"
#include "widget_icon.h"
#include "widget_bar.h"
#include "drv.h"
#include "timer.h"
#include "drv_generic_graphic.h"
#include "drv_generic_gpio.h"
#include "drv_generic_serial.h"
#define min(a,b) (a < b ? a : b)
static char Name[] = "PICGraphic";
//#define partialFrame
/* example config:
Display PICGraphic {
Driver 'PICGraphic'
Port '/dev/ttyS1'
Contrast 8
# these could be automatic
Size '48x128'
Speed 115200
Font '6x8'
}
*/
/*
typedef struct {
char *name;
int columns;
int rows;
int max_contrast;
int default_contrast;
int gpo;
int protocol;
} MODEL;
*/
static char *fbPG = 0, delayDone = 0;
void drv_PICGraphic_1s(void *arg)
{
delayDone = 1;
info("delay done");
}
/****************************************/
/*** hardware-dependent functions ***/
/****************************************/
static int drv_PICGraphic_open(const char *section)
{
/* open serial port */
if (drv_generic_serial_open(section, Name, 0) < 0)
return -1;
return 0;
}
static int drv_PICGraphic_close(void)
{
/* close opened serial port */
return drv_generic_serial_close();
}
static void convert2ASCII(char input, char * output)
{
unsigned char temp = input >> 4;
if(temp < 10)
output[0] = temp + '0';
else
output[0] = temp - 10 + 'a';
input &= 0xf;
if(input < 10)
output[1] = input + '0';
else
output[1] = input - 10 + 'a';
}
static void drv_PICGraphic_send(const char *data, const unsigned int len)
{
unsigned int i;
char hexDigits[3];
hexDigits[2] = 0;
drv_generic_serial_write(data, len);
info("sending %d bytes: ", len);
for(i = 0; i < len; i++){ // min(10, len)
convert2ASCII(data[i], hexDigits);
info("0x%s (%c)", hexDigits, data[i]);
}
}
static void drv_PICGraphic_blit(const int row, const int col, const int height, const int width)
{
/* update a rectangular portion of the display */
int r, c, index;
unsigned char cmd[5];
info("blit from (%d,%d) to (%d,%d) out of (%d,%d)", row, col, row + height, col + width, DROWS, DCOLS);
if (!fbPG)
return;
for (c = min(col, DCOLS - 1); c < min(col + width, DCOLS); c++) {
for (r = min(row, DROWS - 1); r < min(row + height, DROWS); r++) {
index = DCOLS * (r / 8) + c;
if (index < 0 || index >= DCOLS * DROWS / 8) {
error("index too large: %d, r: %d, c: %d", index, r, c);
break;
}
if (drv_generic_graphic_black(r, c)) {
fbPG[index] |= (1 << (r % 8));
} else {
fbPG[index] &= ~(1 << (r % 8));
}
}
}
// send rectangular portion with height divisible by 8
#ifdef partialFrame
if (delayDone) {
delayDone = 0;
int row8, height8;
row8 = 8*(row/8);
height8 = 8*(height/8) + !!(height % 8);
info("sending blit");
cmd[0] = 'b';
cmd[1] = row8;
cmd[2] = col;
cmd[3] = height8;
cmd[4] = width;
drv_PICGraphic_send(cmd, 5);
for (r = min(row8, DROWS - 1); r < min(row8 + height8, DROWS); r+=8) {
drv_PICGraphic_send(fbPG+DCOLS * (r / 8) + col, width);
}
}
#else
// send full frame
if (delayDone) {
delayDone = 0;
info("sending frame");
cmd[0] = 'f';
drv_PICGraphic_send(cmd, 1);
drv_PICGraphic_send(fbPG, DROWS * DCOLS / 8);
}
#endif
}
static int drv_PICGraphic_GPO(const int num, const int val)
{
char cmd[3];
cmd[0] = 'g';
cmd[1] = val ? 's' : 'c';
cmd[2] = num;
// todo: fixme
// drv_PICGraphic_send(cmd, 3);
return 0;
}
static int drv_PICGraphic_GPI(const int num)
{
char cmd[3];
int ret = 0;
cmd[0] = 'g';
cmd[1] = 'r';
cmd[2] = num;
// todo: fixme
// drv_PICGraphic_send(cmd, 3);
// ret = drv_generic_serial_read(cmd, 1);
if (ret)
return -1;
else
return cmd[0];
}
/* example function used in a plugin */
static int drv_PICGraphic_contrast(int contrast)
{
char cmd[2];
/* adjust limits according to the display */
if (contrast < 0)
contrast = 0;
if (contrast > 15)
contrast = 15;
/* call a 'contrast' function */
cmd[0] = 'c';
cmd[1] = contrast;
// todo: fixme
// drv_PICGraphic_send(cmd, 2);
return contrast;
}
/* start graphic display */
static int drv_PICGraphic_start2(const char *section)
{
char *s;
char cmd[1];
int contrast;
/* read display size from config */
s = cfg_get(section, "Size", NULL);
if (s == NULL || *s == '\0') {
error("%s: no '%s.Size' entry from %s", Name, section, cfg_source());
return -1;
}
DROWS = -1;
DCOLS = -1;
if (sscanf(s, "%dx%d", &DCOLS, &DROWS) != 2 || DCOLS < 1 || DROWS < 1) {
error("%s: bad Size '%s' from %s", Name, s, cfg_source());
return -1;
}
s = cfg_get(section, "Font", "6x8");
if (s == NULL || *s == '\0') {
error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
return -1;
}
XRES = -1;
YRES = -1;
if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
error("%s: bad Font '%s' from %s", Name, s, cfg_source());
return -1;
}
if (XRES != 6 && YRES != 8) {
error("%s: bad Font '%s' from %s (only 6x8 at the moment)", Name, s, cfg_source());
return -1;
}
/* you surely want to allocate a framebuffer or something... */
fbPG = calloc(DCOLS * DROWS / 8, 1);
if (!fbPG) {
error("failed to allocate framebuffer");
return -1;
}
info("allocated framebuffer with size %d", DCOLS * DROWS / 8);
timer_add(drv_PICGraphic_1s, 0, 500, 0); // 1s
/* open communication with the display */
if (drv_PICGraphic_open(section) < 0) {
return -1;
}
/* reset & initialize display */
cmd[0] = 'i';
drv_PICGraphic_send(cmd, 1);
if (cfg_number(section, "Contrast", 8, 0, 15, &contrast) > 0) {
drv_PICGraphic_contrast(contrast);
}
return 0;
}
/****************************************/
/*** plugins ***/
/****************************************/
static void plugin_contrast(RESULT * result, RESULT * arg1)
{
double contrast;
contrast = drv_PICGraphic_contrast(R2N(arg1));
SetResult(&result, R_NUMBER, &contrast);
}
/****************************************/
/*** widget callbacks ***/
/****************************************/
/* using drv_generic_text_draw(W) */
/* using drv_generic_text_icon_draw(W) */
/* using drv_generic_text_bar_draw(W) */
/* using drv_generic_gpio_draw(W) */
/****************************************/
/*** exported functions ***/
/****************************************/
/* list models */
int drv_PICGraphic_list(void)
{
printf("PICGraphic serial-to-graphic by Peter Bailey");
return 0;
}
/* initialize driver & display */
int drv_PICGraphic_init2(const char *section, const int quiet)
{
int ret;
/* real worker functions */
drv_generic_graphic_real_blit = drv_PICGraphic_blit;
drv_generic_gpio_real_set = drv_PICGraphic_GPO;
drv_generic_gpio_real_get = drv_PICGraphic_GPI;
/* start display */
if ((ret = drv_PICGraphic_start2(section)) != 0)
return ret;
/* initialize generic graphic driver */
if ((ret = drv_generic_graphic_init(section, Name)) != 0)
return ret;
if (!quiet) {
char buffer[40];
qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
if (drv_generic_graphic_greet(buffer, NULL)) {
sleep(3);
drv_generic_graphic_clear(); // also clears main framebuffer
}
}
/* register plugins */
AddFunction("LCD::contrast", 1, plugin_contrast);
return 0;
}
/* close driver & display */
/* use this function for a graphic display */
int drv_PICGraphic_quit2(const int quiet)
{
info("%s: shutting down.", Name);
/* clear display */
drv_generic_graphic_clear();
drv_generic_gpio_quit();
/* say goodbye... */
if (!quiet) {
drv_generic_graphic_greet("goodbye!", NULL);
}
info("freeing framebuffer");
free(fbPG);
drv_generic_graphic_quit();
debug("closing connection");
drv_PICGraphic_close();
return (0);
}
/* use this one for a graphic display */
DRIVER drv_PICGraphic = {
.name = Name,
.list = drv_PICGraphic_list,
.init = drv_PICGraphic_init2,
.quit = drv_PICGraphic_quit2,
};
+1 -1
View File
@@ -34,7 +34,7 @@
* these functions must be implemented by the real driver:
*
* int (*drv_generic_gpio_real_set) (const int num, const int val);
* sets GPO num to val, returns the actal value
* sets GPO num to val, returns the actual value
*
* int (*drv_generic_gpio_real_get) (const int num);
* reads GPI num