hd44780: Added 'usbtiny' connection type (by Siarhei Herasimchuk).
This commit is contained in:
@@ -29,6 +29,7 @@ v.0.5dev (ongoing development)
|
||||
* CFontz633: Deprecate this driver. Use CFontzPacket with Model=633 instead!
|
||||
- Remove native win32 support.
|
||||
* picolcd: Use module output function to control key LEDs (Martin Jones)
|
||||
+ hd44780: Added 'usbtiny' connection type (Siarhei Herasimchuk)
|
||||
|
||||
v0.5.3
|
||||
+ lcdexec: notification when called program finishes
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@ dnl else
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
|
||||
fi
|
||||
if test "$enable_libusb" = yes ; then
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o hd44780-hd44780-lcd2usb.o hd44780-hd44780-uss720.o"
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-bwct-usb.o hd44780-hd44780-lcd2usb.o hd44780-hd44780-uss720.o hd44780-hd44780-usbtiny.o"
|
||||
fi
|
||||
if test "$enable_libftdi" = yes ; then
|
||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-ftdi.o"
|
||||
|
||||
@@ -104,6 +104,11 @@ more important. Here are the USB connection types the HD44780 driver supports:
|
||||
Till Harbaum's LCD2USB (<ulink url="http://www.harbaum.org/till/lcd2usb/"></ulink>)
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<link linkend="hd44780-usbtiny">usbtiny</link>:
|
||||
Dick Streefland's USBtiny (<ulink url="http://www.xs4all.nl/~dicks/avr/usbtiny/"></ulink>)
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<link linkend="hd44780-uss720">uss720</link>:
|
||||
Display connected to USS-720 USB-to-IEEE 1284 Bridge (Belkin F5U002)
|
||||
@@ -2365,6 +2370,33 @@ KeyDirect_3=Escape
|
||||
|
||||
</sect3>
|
||||
|
||||
<sect3 id="hd44780-usbtiny">
|
||||
<title>Dick Streefland's "USBtiny"</title>
|
||||
|
||||
<para>
|
||||
<quote><ulink url="http://www.xs4all.nl/~dicks/avr/usbtiny/">USBtiny</ulink>
|
||||
is a software implementation of the USB low-speed protocol for
|
||||
the Atmel ATtiny microcontrollers.</quote> It is also the name of a 'reference
|
||||
circuit' using the ATtiny2313.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The reference circuit features an IR receiver for remote controls and a LCD.
|
||||
Due to hardware limitations of the ATtiny2313 the LCD does not have switchable
|
||||
backlight, adjustable contrast, any keys, nor does it support displays with
|
||||
more than one controller. If you want these features and do not require the
|
||||
IR receiver we recommend to take a look at the <link linkend="hd44780-lcd2usb">LCD2USB</link>
|
||||
device.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
LCDproc does not make use of the IR receiver. 3rd party software is required
|
||||
to make it do anything, e.g. <ulink url="http://www.lirc.org/">LIRC</ulink>.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</sect3>
|
||||
|
||||
|
||||
<sect3 id="hd44780-uss720">
|
||||
@@ -2760,6 +2792,10 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
||||
<entry><literal><link linkend="hd44780-lcd2usb">lcd2usb</link></literal></entry>
|
||||
<entry>Till Harbaum's LCD2USB (<ulink url="http://www.harbaum.org/till/lcd2usb/"></ulink>)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal><link linkend="hd44780-usbtiny">usbtiny</link></literal></entry>
|
||||
<entry> Dick Streefland's USBtiny (<ulink url="http://www.xs4all.nl/~dicks/avr/usbtiny/"></ulink>)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal><link linkend="hd44780-lis2">lis2</link></literal></entry>
|
||||
<entry>LIS2 from VLSystem (<ulink url="http://www.vlsys.co.kr"></ulink>)</entry>
|
||||
|
||||
@@ -84,7 +84,7 @@ g15_SOURCES = lcd.h lcd_lib.h g15.h g15-num.c g15.c report.h
|
||||
glcdlib_SOURCES = lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
|
||||
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
||||
hd44780_SOURCES = lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.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-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h hd44780-ftdi.c hd44780-ftdi.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-uss720.c hd44780-uss720.h hd44780-usblcd.c hd44780-usblcd.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-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-usbtiny.c hd44780-usbtiny.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h hd44780-ftdi.c hd44780-ftdi.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-uss720.c hd44780-uss720.h hd44780-usblcd.c hd44780-usblcd.h port.h lpt-port.h timing.h
|
||||
i2500vfd_SOURCES = lcd.h i2500vfd.c i2500vfd.h i2500vfdfm.c i2500vfdfm.h report.h
|
||||
icp_a106_SOURCES = lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
|
||||
imon_SOURCES = lcd.h lcd_lib.h imon.h imon.c report.h
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#ifdef HAVE_LIBUSB
|
||||
# include "hd44780-bwct-usb.h"
|
||||
# include "hd44780-lcd2usb.h"
|
||||
# include "hd44780-usbtiny.h"
|
||||
# include "hd44780-uss720.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIBFTDI
|
||||
@@ -65,6 +66,7 @@ static const ConnectionMapping connectionMapping[] = {
|
||||
#ifdef HAVE_LIBUSB
|
||||
{ "bwctusb", HD44780_CT_BWCTUSB, IF_TYPE_USB, hd_init_bwct_usb },
|
||||
{ "lcd2usb", HD44780_CT_LCD2USB, IF_TYPE_USB, hd_init_lcd2usb },
|
||||
{ "usbtiny", HD44780_CT_USBTINY, IF_TYPE_USB, hd_init_usbtiny },
|
||||
{ "uss720", HD44780_CT_USS720, IF_TYPE_USB, hd_init_uss720 },
|
||||
#endif
|
||||
#ifdef HAVE_LIBFTDI
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#define HD44780_CT_ETHLCD 17
|
||||
#define HD44780_CT_USS720 18
|
||||
#define HD44780_CT_USBLCD 19
|
||||
#define HD44780_CT_USBTINY 20
|
||||
|
||||
// symbolic names for interface types
|
||||
#define IF_TYPE_UNKNOWN 0
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/** \file server/drivers/hd44780-usbtiny.c
|
||||
* \c USBtiny connection type of \c hd44780 driver for Hitachi HD44780 based LCD displays.
|
||||
*
|
||||
* http://www.xs4all.nl/~dicks/avr/usbtiny/
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2007 Peter Marschall <peter@adpm.de>
|
||||
* 2010 Siarhei Herasimchuk <sergby@tut.by>
|
||||
*
|
||||
* This file is released under the GNU General Public License.
|
||||
* Refer to the COPYING file distributed with this package.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <usb.h>
|
||||
|
||||
#include "hd44780-usbtiny.h"
|
||||
#include "report.h"
|
||||
|
||||
|
||||
/* connection type specific functions to be exposed using pointers in init() */
|
||||
void usbtiny_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
|
||||
void usbtiny_HD44780_close(PrivateData *p);
|
||||
|
||||
|
||||
/**
|
||||
* Pseudo (empty) uPause function.
|
||||
* Override the uPause function as a usbtiny device takes care of timing itself.
|
||||
* \param p Pointer to PrivateData structure (unused)
|
||||
* \param usecs Number of micro-seconds to sleep (ignored)
|
||||
*/
|
||||
void
|
||||
usbtiny_HD44780_uPause(PrivateData *p, int usecs)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the driver.
|
||||
* \param drvthis Pointer to driver structure.
|
||||
* \retval 0 Success.
|
||||
* \retval -1 Error.
|
||||
*/
|
||||
int
|
||||
hd_init_usbtiny(Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||
|
||||
struct usb_bus *bus;
|
||||
|
||||
p->hd44780_functions->senddata = usbtiny_HD44780_senddata;
|
||||
p->hd44780_functions->close = usbtiny_HD44780_close;
|
||||
|
||||
/* try to find USB device */
|
||||
usb_init();
|
||||
usb_find_busses();
|
||||
usb_find_devices();
|
||||
|
||||
p->usbHandle = NULL;
|
||||
for (bus = usb_get_busses(); bus != NULL; bus = bus->next) {
|
||||
struct usb_device *dev;
|
||||
|
||||
for (dev = bus->devices; dev != NULL; dev = dev->next) {
|
||||
|
||||
/* Check if this device is a usbtiny device */
|
||||
if ((dev->descriptor.idVendor == USBTINY_VENDORID) &&
|
||||
(dev->descriptor.idProduct == USBTINY_PRODUCTID)) {
|
||||
|
||||
/* USBtiny device found; try to open it */
|
||||
p->usbHandle = usb_open(dev);
|
||||
if (p->usbHandle == NULL) {
|
||||
report(RPT_WARNING, "hd_init_usbtiny: unable to open device");
|
||||
/*
|
||||
* Do not exit here because other
|
||||
* (possibly working) devices may be
|
||||
* connected.
|
||||
*/
|
||||
}
|
||||
else {
|
||||
report(RPT_INFO, "hd_init_usbtiny: USBtiny device found");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* No device found at all */
|
||||
if (p->usbHandle == NULL) {
|
||||
report(RPT_ERR, "hd_init_usbtiny: no (matching) USBtiny device found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
common_init(p, IF_4BIT);
|
||||
|
||||
/* replace uPause with empty one after initialization */
|
||||
p->hd44780_functions->uPause = usbtiny_HD44780_uPause;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send data or commands to the display.
|
||||
* \param p Pointer to driver's private data structure.
|
||||
* \param displayID ID of the display (or 0 for all) to send data to.
|
||||
* \param flags Defines whether to end a command or data.
|
||||
* \param ch The value to send.
|
||||
*/
|
||||
void
|
||||
usbtiny_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
|
||||
{
|
||||
int type = (flags == RS_DATA) ? USBTINY_DATA : USBTINY_INSTR;
|
||||
char buffer[1];
|
||||
buffer[0] = (char) ch;
|
||||
|
||||
usb_control_msg(p->usbHandle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, type, 0, 0, buffer, 1, 1000);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close the driver (do necessary clean-up).
|
||||
* \param p Pointer to driver's private data structure.
|
||||
*/
|
||||
void
|
||||
usbtiny_HD44780_close(PrivateData *p)
|
||||
{
|
||||
if (p->usbHandle != NULL) {
|
||||
usb_close(p->usbHandle);
|
||||
p->usbHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef HD_USBTINY_H
|
||||
#define HD_USBTINY_H
|
||||
|
||||
#include "lcd.h" /* for Driver */
|
||||
#include "hd44780-low.h"
|
||||
|
||||
/* vendor and product id */
|
||||
#define USBTINY_VENDORID 0x03EB
|
||||
#define USBTINY_PRODUCTID 0x0002
|
||||
|
||||
/* Protocole IR/LCD */
|
||||
#define USBTINY_INSTR 20
|
||||
#define USBTINY_DATA 21
|
||||
|
||||
|
||||
/* initialise this particular driver */
|
||||
int hd_init_usbtiny(Driver *drvthis);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user