This is a DiscontinuedProject. It has been finished and is in a stable state now. Currently, no effort is made for further work here.
This library provides functions for (mainly) text output on Liquid Crystal Displays using the Epson SED1530 LCD controller.
Installing
Download the current source code: libsed1530-1_2.tar.gz (/ChangeLog)
Unpack the code: tar xvfz libsed1530-*.tar.gz
Compile the library: cd libsed1530*; make
Install the library: make install
Compile the test program: make lcd
Using
To use the library in a program, you first need to include some definitions in your main source file. Please note that the two font types are declared globally there, that is, not inside any function.
#include <libsed1530.h> ... font_t *font; font_t *graphfont;
Before using the display, the fonts have to be initialized, the ppi(4) device must be opened, and the display has to be initialized:
font = tmalloc(256 * sizeof(font_t));
initfont("/usr/local/share/libsed1530/el-1.fnt");
graphfont = tmalloc(256 * sizeof(font_t));
initgraphfont("/usr/local/share/libsed1530/el-gr.fnt");
if ((lcd_fd = open("/dev/ppi0", O_RDWR)) < 0) {
fprintf(stderr, "Error opening /dev/ppi0: %s\n", strerror(errno));
exit(1);
}
initSED(lcd_fd);
PutCtrl(lcd_fd, CMD_RESET);
setupSED(lcd_fd);
clearSED(lcd_fd, 1);
When linking the program, remember to specify the libsed1530, e.g.
cc -L/usr/local/lib -o mylcdprog mylcdprog.o lcdsub.o foosub.o -lsed1530
Available functions
Global variables
u_int8_t backlight
If software backlight control is used, this controls the backlight setting. Backlight is toggled when the next write access to the LCD takes place. Default 0.
u_int8_t invert
If set to 1, the display contents are displayed white on black. Default 0.
u_int8_t contrast
Contrast setting, possible values are 1 to 29. Default 15.
Initialisation
void initSED()
Initializes the display with some basic settings.
void setupSED()
Basically, this function sets (or re-sets) the contrast setting.
void initfont(char *fname)
Loads the text character font data from the file given in fname into the font structure. The font structure has to be allocated as shown above before calling initfont().
On error, this function prints an error message to stderr, exits the program and sets the exit code to 13.
void initgraphfont(char *fname)
Loads the graphical character font data from the file given in fname into the graphfont structure. The graphfont structure has to be allocated as shown above before calling initgraphfont().
On error, this function prints an error message to stderr, exits the program and sets the exit code to 13.
void doneSED(int fd)
This function turns off the LCD and, if software controlled, the backlight. fd is the ppi device's file descriptor, which has to be open for writing.
Text and high-level operations
void textSED(int fd, int row, char *intext, int linebreak)
Writes the text pointed to by intext to row number row of the display connected to the ppi device given in fd as file descriptor open for writing. If linebreak is not 0, an automatic linebreak is performed when a display line is full, making the text continue in the next row.
void graphSED(int fd, int row, char *intext, int linebreak)
Writes the graphical characters pointed to by intext to row number row of the display connected to the ppi device given in fd as file descriptor open for writing. If linebreak is not 0, an automatic linebreak is performed when a display line is full, making the text continue in the next row.
void fonttest(int fd)
Shows all text font characters on the display connected to fd.
void graphfonttest(int fd)
Shows all graphical font characters on the display connected to fd.
void blinkSED(int fd, int cnt)
When software backlight control is enabled (which is done through the appropriate data line connection on the parallel port, as shown in the hardware notes (
missing here!), the backlight of the display connected to fd is blinked off and on cnt times.
void clearSED(int fd, int full)
Clears the display connected to fd. If full is not 0, line 0 (which I usually use as the status line) is also cleared.
THIS DATA IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DATA, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
All product and brand names mentioned on there pages and in the source code are registered names and/or trademarks of the respective owner and are mentioned for identification purposes only.
For a full copyright notice, please see this link. For imprint and contact information, please see http://www.thiemo.net/.