Wiki

Clone wiki

lcd / Home

Welcome

This project tries to implement a simple C library for interacting HD44780 compatible LCD's using I2C expanders.

It was written as simple and lightweight library for custom OpenWRT projects. Though it should compile on most current Linux systems.

Curently only PCF8574 expander is supported. But others can be added.

If your expander-LCD wiring is different and/or you have a hard time to get it work or you have a patch to submit feel free to contact me.

Supported devices

LCD and i2c I/O expander

lcd

Supported expanders (wirings)

  • PCF8574

API documentation

To see how to use the library please read lcd.h docs.

How to crosscompile for OpenWRT

Prerequisites

In order to compile the library for OpenWRT you need to have buildroot set up for your target platform.

Please read OpenWrt Buildroot – Installation and OpenWrt Buildroot – Usage if you are not sure.

There is also a wiki page describing the crosscompilation.

Basic steps

Get the source and change the directory.

#!bash

git clone https://bitbucket.org/loblik/lcd.git
#!bash

cd lcd

At first define where your staging dir is (the path is just illustrative).

#!bash

export STAGING_DIR="$HOME/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.6-linaro_uClibc-0.9.33.2" 

Then include OpenWRT toolchain/bin i your path.

#!bash

export PATH="$PATH:$STAGING_DIR/bin"

And finally build the library using your toolchain.

#!bash

make CC=mipsel-openwrt-linux-gcc

To build the example application run the following command. In this case you need librt installed.

#!bash

make CC=mipsel-openwrt-linux-gcc example

Example usage

out.jpg

There is example lct.h which shows how to use the library. The example includes useage.h to get various stats from the kernel.

Updated