[FrontPage] [TitleIndex] [WordIndex

GPIO 'C' Demonstration Software



GNU Autotools configuration files etc.

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0 $ cat ./configure.ac 
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([i2c_spi_chips], [0.0], [trevor.gowen@blueyonder.co.uk])
AC_CONFIG_SRCDIR([common/rcs_scm.h])
# Platform & System ...
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([-Wall foreign]) 
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.
AC_PROG_RANLIB
AC_CHECK_LIB([wiringPi], [wiringPiI2CSetup])

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h strings.h unistd.h])

# Check for wiringPi.h ...
have_wiringpi_h=no
AC_CHECK_HEADERS([wiringPi.h], [have_wiringpi_h=yes])

if test "x${have_wiringpi_h}" = xno; then
   AC_MSG_WARN([
   **************************************
   Unable to find wiringPi header ...
   Some program features may be disabled!
   **************************************])
fi

if test "x${have_wiringpi_h}" = xyes; then
   
   AC_MSG_NOTICE([
   ************************************
   wiringPi header available ... 
   (HAVE_WIRINGPI_H defined in config.h)
   Full functionality available!
   ************************************])
fi

# Check for wiringPiI2C.h ...
have_wiringpii2c_h=no
AC_CHECK_HEADERS([wiringPiI2C.h], [have_wiringpii2c_h=yes])

if test "x${have_wiringpii2c_h}" = xno; then
   AC_MSG_WARN([
   **************************************
   Unable to find wiringPiI2C header ...
   Some program features may be disabled!
   **************************************])
fi

if test "x${have_wiringpii2c_h}" = xyes; then
   
   AC_MSG_NOTICE([
   ************************************
   wiringPiI2C header available ... 
   (HAVE_WIRINGPII2C_H defined in config.h)
   Full functionality available!
   ************************************])
fi

# Check for wiringPiSPI.h ...
have_wiringpispi_h=no
AC_CHECK_HEADERS([wiringPiSPI.h], [have_wiringpispi_h=yes])

if test "x${have_wiringpispi_h}" = xno; then
   AC_MSG_WARN([
   **************************************
   Unable to find wiringPiSPI header ...
   Some program features may be disabled!
   **************************************])
fi

if test "x${have_wiringpispi_h}" = xyes; then
   
   AC_MSG_NOTICE([
   ************************************
   wiringPiSPI header available ... 
   (HAVE_WIRINGPISPI_H defined in config.h)
   Full functionality available!
   ************************************])
fi

# Check for pigpio.h ...
have_pigpio_h=no
AC_CHECK_HEADERS([pigpio.h], [have_pigpio_h=yes])

if test "x${have_pigpio_h}" = xno; then
   AC_MSG_WARN([
   **************************************
   Unable to find pigpio header ...
   Some program features may be disabled!
   **************************************])
fi

if test "x${have_pigpio_h}" = xyes; then

   AC_SEARCH_LIBS([gpioInitialise], [pigpio], , , [-lpthread -lrt])
# Libraries needed to use pigpio etc. ...
   AC_SEARCH_LIBS([pthread_create], [pthread])
   AC_SEARCH_LIBS([clock_gettime], [rt])
   
   AC_MSG_NOTICE([
   ************************************
   pigpio header available ... 
   (HAVE_PIGPIO_H defined in config.h)
   Full functionality available!
   ************************************])
fi

# Check for pigpiod_if2.h ...
have_pigpiod_if2_h=no
AC_CHECK_HEADERS([pigpiod_if2.h], [have_pigpiod_if2_h=yes])

if test "x${have_pigpiod_if2_h}" = xno; then
   AC_MSG_WARN([
   **************************************
   Unable to find pigpiod_if2 header ...
   Some program features may be disabled!
   **************************************])
fi

if test "x${have_pigpiod_if2_h}" = xyes; then

   AC_SEARCH_LIBS([pigpio_start], [pigpiod_if2], , , [-lpthread -lrt])
# Libraries needed to use pigpiod_if2 etc. ...
   AC_SEARCH_LIBS([pthread_create], [pthread])
   AC_SEARCH_LIBS([clock_gettime], [rt])
   
   AC_MSG_NOTICE([
   ************************************
   pigpiod_if2 header available ... 
   (HAVE_PIGPIOD_IF2_H defined in config.h)
   Full functionality available!
   ************************************])
fi

## Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SSIZE_T

# Checks for library functions.
AC_CHECK_FUNCS([gethostname strcasecmp strtoul])

AC_CONFIG_FILES([Makefile
                 common/Makefile
                 src/Makefile])
AC_OUTPUT

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0 $ cat ./Makefile.am 
## Process this file with automake to produce Makefile.in
SUBDIRS = common src
EXTRA_DIST = README PCD8544_RPi_BBSPI xbm_data

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0/common $ cat ./Makefile.am 
## Process this file with automake to produce Makefile.in
noinst_LIBRARIES = libparsel.a libi2c_chips.a libi2c_wraps.a libled_disptools.a \
liblcd_disptools.a libspi_chips.a libspi_wraps.a libspi_PCD8544.a libglcd_xbmtools.a \
libpigpio_wraps.a libpigpiod_wraps.a libglcd_fonttools.a
libparsel_a_SOURCES = parsel.h parsel.c
libi2c_chips_a_SOURCES = i2c_chips.h i2c_chips.c
libi2c_wraps_a_SOURCES = i2c_wraps.h i2c_wraps.c
libled_disptools_a_SOURCES = led_disptools.h led_disptools.c
liblcd_disptools_a_SOURCES = i2c_chips.h i2c_chips.c spi_chips.h spi_chips.c \
lcd_disptools.h lcd_disptools.c
libspi_chips_a_SOURCES = spi_chips.h spi_chips.c 
libspi_wraps_a_SOURCES = spi_wraps.h spi_wraps.c 
libspi_PCD8544_a_SOURCES = i2c_wraps.h i2c_wraps.c spi_chips.h spi_chips.c \
spi_wraps.h spi_wraps.c PCD8544_font.h spi_PCD8544.h spi_PCD8544.c glcd_xbmtools.h
libglcd_xbmtools_a_SOURCES = parsel.h parsel.c glcd_xbmtools.h glcd_xbmtools.c
libpigpio_wraps_a_SOURCES = pigpio_wraps.h pigpio_wraps.c 
libpigpiod_wraps_a_SOURCES = pigpiod_wraps.h pigpiod_wraps.c 
libglcd_fonttools_a_SOURCES = parsel.h parsel.c glcd_fonttools.h glcd_fonttools.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0/src $ cat Makefile.am 
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = demo dual_lcd_i2c4-8bit_demo lcd_demo lcd_fi2c_demo lcd_hi2c_demo \
lcd_mi2c_demo lcd_ibo_i2c_demo lcd_gpio4b_demo lcd_spi4b_demo lcd_spi4bV2_demo \
lcd_spi8b_demo lcd_structures_list glcd_spi8b_demo spi_ledx_demo spi_glcd_demo \
spi_glcdV2_demo spi_glcd_cacc_demo oled_i2c_demo glcd_font_tool spi_led_4dq_demo \
spi_led_4drrg_demo i2c_rgb_led_demo glcd_serial_demo oled_spi_demo i2c_ledx_demo \
i2c_mxledx_demo i2c_clkled_demo lcd_gpio4bV2_demo spi_glcdHP3_demo spi_glcdV2N_demo \
glcd_spi8bA_demo spi_led_2x4d_demo oled_spiV2_demo spi_glcdV2A_demo spi_glcdG_demo
#bbx_spi_glcd_demo
demo_SOURCES = ../common/rcs_scm.h demo.c
demo_CPPFLAGS = -I$(top_srcdir)/common
demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/libled_disptools.a ../common/liblcd_disptools.a
dual_lcd_i2c4_8bit_demo_SOURCES = ../common/rcs_scm.h dual_lcd_i2c4-8bit_demo.c
dual_lcd_i2c4_8bit_demo_CPPFLAGS = -I$(top_srcdir)/common
dual_lcd_i2c4_8bit_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/liblcd_disptools.a
lcd_demo_SOURCES = ../common/rcs_scm.h lcd_demo.c
lcd_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/liblcd_disptools.a
lcd_fi2c_demo_SOURCES = ../common/rcs_scm.h lcd_fi2c_demo.c
lcd_fi2c_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_fi2c_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/liblcd_disptools.a
lcd_hi2c_demo_SOURCES = ../common/rcs_scm.h lcd_hi2c_demo.c
lcd_hi2c_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_hi2c_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/liblcd_disptools.a ../common/libpigpio_wraps.a
lcd_mi2c_demo_SOURCES = ../common/rcs_scm.h lcd_mi2c_demo.c
lcd_mi2c_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_mi2c_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/liblcd_disptools.a
lcd_ibo_i2c_demo_SOURCES = ../common/rcs_scm.h lcd_ibo_i2c_demo.c
lcd_ibo_i2c_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_ibo_i2c_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/liblcd_disptools.a
lcd_gpio4b_demo_SOURCES = ../common/rcs_scm.h lcd_gpio4b_demo.c
lcd_gpio4b_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_gpio4b_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libi2c_wraps.a
lcd_spi4b_demo_SOURCES = ../common/rcs_scm.h lcd_spi4b_demo.c
lcd_spi4b_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_spi4b_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libi2c_wraps.a ../common/libspi_wraps.a
lcd_spi4bV2_demo_SOURCES = ../common/rcs_scm.h lcd_spi4bV2_demo.c
lcd_spi4bV2_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_spi4bV2_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libi2c_wraps.a ../common/libspi_wraps.a
lcd_spi8b_demo_SOURCES = ../common/rcs_scm.h lcd_spi8b_demo.c
lcd_spi8b_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_spi8b_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libi2c_wraps.a ../common/libspi_wraps.a
lcd_structures_list_SOURCES = ../common/rcs_scm.h lcd_structures_list.c
lcd_structures_list_CPPFLAGS = -I$(top_srcdir)/common
lcd_structures_list_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libi2c_wraps.a ../common/libspi_wraps.a
glcd_spi8b_demo_SOURCES = ../common/rcs_scm.h glcd_spi8b_demo.c
glcd_spi8b_demo_CPPFLAGS = -I$(top_srcdir)/common
glcd_spi8b_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libglcd_xbmtools.a ../common/libi2c_wraps.a ../common/libspi_wraps.a
spi_ledx_demo_SOURCES = ../common/rcs_scm.h ../common/font.h  \
../common/PCD8544_font.h spi_ledx_demo.c
spi_ledx_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_ledx_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
../common/libspi_wraps.a
spi_glcd_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h spi_glcd_demo.c
spi_glcd_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcd_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
spi_glcdV2_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h spi_glcdV2_demo.c
spi_glcdV2_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcdV2_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
spi_glcd_cacc_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h \
spi_glcd_cacc_demo.c
spi_glcd_cacc_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcd_cacc_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
oled_i2c_demo_SOURCES = ../common/rcs_scm.h ../common/oled128.h ../common/oled256.h \
../common/jace128.h oled_i2c_demo.c
oled_i2c_demo_CPPFLAGS = -I$(top_srcdir)/common
oled_i2c_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/libpigpio_wraps.a
glcd_font_tool_SOURCES = ../common/rcs_scm.h ../common/font.h glcd_font_tool.c
glcd_font_tool_CPPFLAGS = -I$(top_srcdir)/common
glcd_font_tool_LDADD = ../common/libparsel.a ../common/libglcd_fonttools.a
spi_led_4dq_demo_SOURCES = ../common/rcs_scm.h spi_led_4dq_demo.c
spi_led_4dq_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_led_4dq_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
../common/libspi_wraps.a ../common/libled_disptools.a
spi_led_4drrg_demo_SOURCES = ../common/rcs_scm.h spi_led_4drrg_demo.c
spi_led_4drrg_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_led_4drrg_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
../common/libspi_wraps.a ../common/libled_disptools.a
i2c_rgb_led_demo_SOURCES = ../common/rcs_scm.h i2c_rgb_led_demo.c
i2c_rgb_led_demo_CPPFLAGS = -I$(top_srcdir)/common
i2c_rgb_led_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a
glcd_serial_demo_SOURCES = ../common/rcs_scm.h glcd_serial_demo.c
glcd_serial_demo_CPPFLAGS = -I$(top_srcdir)/common
glcd_serial_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libglcd_xbmtools.a ../common/libi2c_wraps.a ../common/libspi_wraps.a
oled_spi_demo_SOURCES = ../common/rcs_scm.h ../common/oled128.h ../common/oled256.h \
../common/jace128.h oled_spi_demo.c
oled_spi_demo_CPPFLAGS = -I$(top_srcdir)/common
oled_spi_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
../common/libspi_wraps.a  ../common/libi2c_wraps.a
i2c_ledx_demo_SOURCES = ../common/rcs_scm.h ../common/font.h  \
../common/jace128.h ../common/PCD8544_font.h i2c_ledx_demo.c
i2c_ledx_demo_CPPFLAGS = -I$(top_srcdir)/common
i2c_ledx_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/libpigpiod_wraps.a
i2c_mxledx_demo_SOURCES = ../common/rcs_scm.h i2c_mxledx_demo.c
i2c_mxledx_demo_CPPFLAGS = -I$(top_srcdir)/common
i2c_mxledx_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/libled_disptools.a
i2c_clkled_demo_SOURCES = ../common/rcs_scm.h i2c_clkled_demo.c
i2c_clkled_demo_CPPFLAGS = -I$(top_srcdir)/common
i2c_clkled_demo_LDADD = ../common/libparsel.a ../common/libi2c_chips.a \
../common/libi2c_wraps.a ../common/libled_disptools.a ../common/libpigpio_wraps.a \
../common/libpigpiod_wraps.a
lcd_gpio4bV2_demo_SOURCES = ../common/rcs_scm.h lcd_gpio4bV2_demo.c
lcd_gpio4bV2_demo_CPPFLAGS = -I$(top_srcdir)/common
lcd_gpio4bV2_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libi2c_wraps.a
spi_glcdHP3_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h spi_glcdHP3_demo.c
spi_glcdHP3_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcdHP3_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
spi_glcdV2N_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h spi_glcdV2N_demo.c
spi_glcdV2N_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcdV2N_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
glcd_spi8bA_demo_SOURCES = ../common/rcs_scm.h glcd_spi8bA_demo.c
glcd_spi8bA_demo_CPPFLAGS = -I$(top_srcdir)/common
glcd_spi8bA_demo_LDADD = ../common/libparsel.a ../common/liblcd_disptools.a \
../common/libglcd_xbmtools.a ../common/libi2c_wraps.a ../common/libspi_wraps.a
spi_led_2x4d_demo_SOURCES = ../common/rcs_scm.h spi_led_2x4d_demo.c
spi_led_2x4d_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_led_2x4d_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
../common/libspi_wraps.a ../common/libled_disptools.a
oled_spiV2_demo_SOURCES = ../common/rcs_scm.h ../common/oled128.h ../common/oled256.h \
../common/jace128.h oled_spiV2_demo.c
oled_spiV2_demo_CPPFLAGS = -I$(top_srcdir)/common
oled_spiV2_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
../common/libspi_wraps.a  ../common/libi2c_wraps.a
spi_glcdV2A_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h spi_glcdV2A_demo.c
spi_glcdV2A_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcdV2A_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
spi_glcdG_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h spi_glcdG_demo.c
spi_glcdG_demo_CPPFLAGS = -I$(top_srcdir)/common
spi_glcdG_demo_LDADD = ../common/libparsel.a ../common/libglcd_xbmtools.a \
../common/libspi_chips.a ../common/libspi_wraps.a ../common/libi2c_wraps.a \
../common/libspi_PCD8544.a
#bbx_spi_glcd_demo_SOURCES = ../common/rcs_scm.h ../common/PCD8544_font.h bbx_spi_glcd_demo.c
#bbx_spi_glcd_demo_CPPFLAGS = -I$(top_srcdir)/common
#bbx_spi_glcd_demo_LDADD = ../common/libparsel.a ../common/libspi_chips.a \
#../common/libspi_wraps.a ../common/libi2c_wraps.a ../common/libspi_PCD8544.a \
#/usr/local/lib/libpigpio.a

Self-generated, brief Program Help

demo.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/demo
demo.c Version 0.05 {Exp}, [18/07/2014], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage demo  [Options]
Options: -a arg_filename[.arg],
         -AP1 {Adafruit Permaproto full demo #1},
         -AP2 {Adafruit Permaproto full demo #2},
         -E   {Echo command-line arguments},
         -HP1 {Humble Pi demo #1},
         -HP2 {Humble Pi demo #2},
         -HP3 {Humble Pi demo #3},
         -I   {Inquire about i2c devices},
         -Q   {Quiet - default},
         -SE1 {Sil Edge mount lcd demo #1},
         -SE2 {Sil Edge mount lcd demo #2},
         -SE3 {Sil Edge mount lcd demo #3},
         -SE4 {Sil Edge mount lcd demo #4},
         -SP1 {Slice of Pi/o demo #1},
         -SP2 {Slice of Pi/o demo #2},
         -S   {use System call methods - default},
         -V   {Verbose},
         -APQ {Adafruit Permaproto full device Query (implies -W)},
         -HPQ {Humble Pi device Query (implies -W)},
         -SPQ {Slice of Pi/o device Query (implies -W)},
         -W   {use Wiring pi i2c methods},
         -X   {eXecute demonstration}.

dual_lcd_i2c4-8bit_demo.c

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/dual_lcd_i2c4-8bit_demo 
dual_lcd_i2c4-8bit_demo.c Version 0.02 {Exp}, [26/06/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage dual_lcd_i2c4-8bit_demo  [Options]
Options: -a arg_filename[.arg],
         -A8   {use 8-bit interface via gpio A - default},
         -B4   {use 4-bit interface via gpio B},
         -BLn  {force BackLights off (n=0) or on (n=1)},
         -E    {Echo command-line arguments},
         -I    {Inquire about i2c devices},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -1604 {LCD display type 1604},
         -2004 {LCD display type 2004},
         -IG   {Inquire about i2c devices & Gpio readall},
         -P    {Preload lcd iface's},
         -ST   {Strobe Test*},
         -F8T  {Func set init 8-bit Test* - implies -A8},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -CH   {Clear display & return Home - implies -W},
         -F4T  {Func set init 4-bit Test - implies -B4 & -W},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -W80T {Write 80 characters Test - implies -W},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi i2c methods},
         -X    {eXecute demonstration}.

glcd_spi8b_demo.c

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/glcd_spi8b_demo
glcd_spi8b_demo.c Version 0.01 {Exp}, [14/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage glcd_spi8b_demo  [Options]
Options: -a arg_filename[.arg],
         -xbm xbm_filename[.xbm] (for 128x64 graphic),
         -xpm xpm_filename[.xpm] (for 16x16 CGRAM char.),
         +XBM    {XBM dump of pixel store},
         +XPM    {XPM dump of pixel store},
         -E      {Echo command-line arguments},
         -F0816  {use half-character, 8x16 Font (default)},
         -F1616  {use 16x16 Font#},
         -FG1616 {use user-defined Graphic 16x16 Font#},
         -FI1616 {use chinese Icon 16x16 Font#},
                 {# for -WDT option only},
         +UCGn   {Use CGram address 000n (n=0,2,4 or 6) ...},
                 {... for xpm file data},
         -backlight on|off, 
         -BLT  {simple Back Light Test},
         -F8BT {Func set init 8-bit, Basic instruction set Test*},
         -IG   {Initialise used gpio's & Gpio readall},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -CH   {Clear display & return Home - implies -W},
         -F8XT {Func set init 8-bit, eXtended instr. set Test - implies -W},
         -GDST {Graphics Display Switch Test - implies -W},
         -Rn   {Reverse line n (n=1|2) - implies -W},
         -WLT  {Write Line info. Test - implies -W & -F0816},
         -WMT  {Write Message Test - implies -W & -F0816},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi spi methods},
         -X    {eXecute demonstration}.

glcd_spi8bA_demo.c

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0 $ ./src/glcd_spi8bA_demo
glcd_spi8bA_demo.c Version 0.00 {Exp}, [11/09/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage glcd_spi8bA_demo  [Options]
Options: -a arg_filename[.arg],
         -xbm xbm_filename[.xbm] (for 128x64 graphic),
         -xpm xpm_filename[.xpm] (for 16x16 CGRAM char.),
         +XBM     {XBM dump of pixel store},
         +XPM     {XPM dump of pixel store},
         -E       {Echo command-line arguments},
         -F0816   {use half-character, 8x16 Font (default)},
         -F1616   {use 16x16 Font#},
         -FG1616  {use user-defined Graphic 16x16 Font#},
         -FI1616  {use chinese Icon 16x16 Font#},
                  {# for -WDT option only},
         -glcd# n {Use GLCD model name #n (0 < n < 4)},
         +UCGn    {Use CGram address 000n (n=0,2,4 or 6) ...},
                  {... for xpm file data},
         -F8BT {Func set init 8-bit, Basic instruction set Test*},
         -IG   {Initialise used gpio's & Gpio readall},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -CH   {Clear display & return Home - implies -W},
         -F8XT {Func set init 8-bit, eXtended instr. set Test - implies -W},
         -GDST {Graphics Display Switch Test - implies -W},
         -Rn   {Reverse line n (n=1|2) - implies -W},
         -WLT  {Write Line info. Test - implies -W & -F0816},
         -WMT  {Write Message Test - implies -W & -F0816},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi spi methods},
         -X    {eXecute demonstration}.

lcd_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/lcd_demo
lcd_demo.c Version 0.05 {Exp}, [04/04/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_demo  [Options]
Options: -a arg_filename[.arg],
         -dmsg 's' {Display a MeSsaGe 'like_this_one'... - implies -W},
         +S        {... and Scroll right},
         -i2c 0x?? {set I2C device address (>0x00)},
                   {defaults: PCF8574P=0x26, PCF8574AP=0x3e},
         -AP       {use PCF8574AP default},
         -E    {Echo command-line arguments},
         -I    {Inquire about i2c devices},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -1604 {LCD display type 1604},
         -2004 {LCD display type 2004},
         -CH   {Clear display & return Home - implies -W},
         -F8T  {Func set init 8-bit Test*},
         -IG   {Inquire about i2c devices & Gpio readall},
         -P    {Preload lcd iface},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi i2c methods},
         -X    {eXecute demonstration}.

Check1: Fri Apr 13 18:52:47 2018
Check2: 18:52:49

lcd_fi2c_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/lcd_fi2c_demo
lcd_fi2c_demo.c Version 0.08 {Exp}, [13/04/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_fi2c_demo  [Options]
Options: -a arg_filename[.arg],
         -dmsg 's' {Display a MeSsaGe 'like_this_one'... - implies -W},
         +S        {... and Scroll right},
         -E     {Echo command-line arguments},
         -I     {Inquire about i2c devices},
         -0802  {LCD display type 0802},
         -1602  {LCD display type 1602 - default},
         -1604  {LCD display type 1604},
         -2004  {LCD display type 2004},
         -HVI2C {High Voltage I2C (5V - default) },
         -LVI2C {Low  Voltage I2C (4.4V)},
         -Bn    {Backlight mode (n=0->Off, n=1->On - default)},
         -CH    {Clear display & return Home - implies -W},
         -WLT   {Write Line info. Test - implies -W},
         -WMT   {Write Message Test - implies -W},
         -W80T  {Write 80 characters Test - implies -W},
         -F4T   {Func set init 4-bit Test*},
         -P     {Preload lcd fi2c},
         -ST    {Strobe Test*},
         -WDT   {Write Data Test*},
         -WRT   {Write Register Test*},
                {*NB: LED Test board req'd with -S},
         -Q     {Quiet - default},
         -S     {use System call methods - default},
         -T     {using LED Test board},
         -V     {Verbose},
         -W     {use Wiring pi i2c methods},
         -X     {eXecute demonstration}.

Check1: Fri Apr 13 18:54:04 2018
Check2: 18:54:06

lcd_gpio4b_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/lcd_gpio4b_demo
lcd_gpio4b_demo.c Version 0.03 {Exp}, [18/05/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_gpio4b_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -1604 {LCD display type 1604},
         -2004 {LCD display type 2004},
         -BLn  {BackLight mode n: n=0,1,2 or 3, default 2},
         -BLT  {BackLight Test - implies -W},
         -CH   {Clear display & return Home - implies -W},
         -F4T  {Func set init 4-bit Test - implies -W},
         -IG   {Initialise used gpio's & Gpio readall},
         -P    {Preload lcd iface},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -WRT  {Write Register Test*},
         -W80T {Write 80 characters Test - implies -W},
               {*NB: LED Test board req'd with -S},
         -Q    {Quiet - default},
         -S    {use System call method - default},
         -T    {using LED Test board},
         -V3   {using 3.3V LCD},
         -V5   {using 5.0V LCD - default},
         -V    {Verbose},
         -W    {use Wiring pi "byte write" method},
         -X    {eXecute demonstration}.


Check1: Fri May 18 14:01:26 2018
Check2: 14:01:28

lcd_hi2c_demo.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/lcd_hi2c_demo
lcd_hi2c_demo.c Version 0.01 {Exp}, [27/04/2015], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_hi2c_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -I    {Inquire about i2c devices},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -2004 {LCD display type 2004},
         -BLT  {BackLight Test},
         -WDT  {Write Data Test},
         -WLT  {Write Line info. Test},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -V    {Verbose},
         -W    {use Wiring pi i2c methods},
         -PG   {use PiGpio i2c methods**},
               {**NB: requires sudo "prefix"! },
         -X    {eXecute demonstration}.

lcd_mi2c_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/lcd_mi2c_demo
lcd_mi2c_demo.c Version 0.03 {Exp}, [13/04/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_mi2c_demo  [Options]
Options: -a arg_filename[.arg],
         -E     {Echo command-line arguments},
         -I     {Inquire about i2c devices},
         -0802  {LCD display type 0802},
         -1602  {LCD display type 1602 - default},
         -1604  {LCD display type 1604},
         -2004  {LCD display type 2004},
         -HVI2C {High Voltage I2C (5V - default) },
         -LVI2C {Low  Voltage I2C (4.4V)},
         -Bn    {Backlight mode (n=0->Off, n=1->On - default)},
         -CH    {Clear display & return Home - implies -W},
         -WLT   {Write Line info. Test - implies -W},
         -WMT   {Write Message Test - implies -W},
         -WTT   {Write Timing data Test - implies -W},
         -F4T   {Func set init 4-bit Test*},
         -P     {Preload lcd mi2c},
         -ST    {Strobe Test*},
         -WDT   {Write Data Test*},
         -WRT   {Write Register Test*},
                {*NB: LED Test board req'd with -S},
         -Q     {Quiet - default},
         -S     {use System call methods - default},
         -T     {using LED Test board},
         -V     {Verbose},
         -W     {use Wiring pi i2c methods},
         -X     {eXecute demonstration}.

Check1: Fri Apr 13 18:56:50 2018
Check2: 18:56:52

lcd_ibo_i2c_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/lcd_ibo_i2c_demo
lcd_ibo_i2c_demo.c Version 0.03 {Exp}, [31/03/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_ibo_i2c_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -I    {Inquire about i2c devices},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -1604 {LCD display type 1604},
         -2004 {LCD display type 2004},
         -CH   {Clear display & return Home - implies -W},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -WTT  {Write Timing data Test - implies -W},
         -F4T  {Func set init 4-bit Test*},
         -P    {Preload lcd ibo_i2c},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi i2c methods},
         -X    {eXecute demonstration}.

Check1: Fri Apr 13 18:58:18 2018
Check2: 18:58:20

lcd_spi4b_demo.c

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/lcd_spi4b_demo 
lcd_spi4b_demo.c Version 0.02 {Exp}, [14/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_spi4b_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -1604 {LCD display type 1604},
         -2004 {LCD display type 2004},
         -BLn  {BackLight mode n: n=0,1,2 or 3, default 2},
         -IG   {Initialise used gpio's & Gpio readall},
         -P    {Preload lcd iface},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -CH   {Clear display & return Home - implies -W},
         -F4T  {Func set init 4-bit Test - implies -W},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -W80T {Write 80 characters Test - implies -W},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi spi methods},
         -X    {eXecute demonstration}.


Check1: Mon Aug 14 20:08:53 2017
Check2: 20:08:55

lcd_spi4bV2_demo.c

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/lcd_spi4bV2_demo 
lcd_spi4bV2_demo.c Version 0.02 {Exp}, [14/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_spi4bV2_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -1604 {LCD display type 1604},
         -2004 {LCD display type 2004},
         -BLn  {BackLight mode n: n=0,1,2 or 3, default 2},
         -IG   {Initialise used gpio's & Gpio readall},
         -P    {Preload lcd iface},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -CH   {Clear display & return Home - implies -W},
         -F4T  {Func set init 4-bit Test - implies -W},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -W80T {Write 80 characters Test - implies -W},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi spi methods},
         -X    {eXecute demonstration}.


Check1: Mon Aug 14 20:09:56 2017
Check2: 20:09:58

lcd_spi8b_demo.c

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/lcd_spi8b_demo 
lcd_spi8b_demo.c Version 0.03 {Exp}, [14/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage lcd_spi8b_demo  [Options]
Options: -a arg_filename[.arg],
         -dmsg 's' {Display a MeSsaGe 'like_this_one'... - implies -W},
         +S        {... and Scroll right},
         -E    {Echo command-line arguments},
         -0802 {LCD display type 0802},
         -1602 {LCD display type 1602 - default},
         -2004 {LCD display type 2004},
         -IG   {Initialise used gpio's & Gpio readall},
         -CH   {Clear display & return Home - implies -W},
         -F8T  {Func set init 8-bit Test*},
         -ST   {Strobe Test*},
         -WDT  {Write Data Test*},
         -WRT  {Write Register Test*},
               {*NB: LED Test board req'd with -S},
         -WLT  {Write Line info. Test - implies -W},
         -WMT  {Write Message Test - implies -W},
         -Q    {Quiet - default},
         -S    {use System call methods - default},
         -T    {using LED Test board},
         -V    {Verbose},
         -W    {use Wiring pi spi methods},
         -X    {eXecute demonstration}.

spi_glcd_cacc_demo.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/spi_glcd_cacc_demo 
spi_glcd_cacc_demo.c Version 0.02 {Exp}, [24/02/2015], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcd_cacc_demo  [Options]
Options: -a arg_filename[.arg],
         -CEn {use CEn (/dev/spidev0.n) - n=0|1},
         -E   {Echo command-line arguments},
         -IG  {Initialise gpio's & Gpio readall},
         -CH  {Clear Home},
         -ID  {Initialise Display},
         -inverse {INVERSE display},
         -normal  {NORMAL display},
         -SBn {Set Bias system n, 0<=n<=7 (default 4)},
         -SCn {Set Contrast level n, 0<=n<=8 (default 3)},
         -WFT {Write direct Font data Test},
         -WGT {Write Graphics image data Test},
         -WMT {Write Message Test},
         -Q   {Quiet - default},
         -V   {Verbose},
         -X   {eXecute demonstration}

spi_glcd_demo.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/spi_glcd_demo
spi_glcd_demo.c Version 0.05 {Exp}, [25/01/2015], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcd_demo  [Options]
Options: -a arg_filename[.arg],
         -xpm xpm_filename[.xpm] (for 48x84 rotated graphic),
         -BB  {use Bit-Banged** spi interface},
              {**NB: Prefix with sudo - root privileges reqired!},
         -FS  {use Full Spi interface - default},
         -E   {Echo command-line arguments},
         -IG  {Initialise used gpio's & Gpio readall},
         -RI  {Reset & Initialise display - implies -W},
         -RT  {Reset pulse Test^^},
         -CH  {Clear Home - implies -W},
         -inverse {INVERSE display - implies -W},
         -normal  {NORMAL display - default, implies -W},
         -SCn {Set Contrast level n, 0<=n<=8 - implies -W},
         -SOT {Shift Out Test^^   - implies -BB},
         -WCT {Write Command Test - implies -W},
         -WDT {Write Data Test    - implies -W},
         -WFT {Write direct Font data Test - implies -W},
         -WGT {Write Graphics image data Test - implies -W},
         -WMT {Write Message Test - implies -W},
              {^^ NB: LED Test board req'd with -S},
         -Q   {Quiet - default},
         -S   {use System call methods - default},
         -T   {using LED Test board},
         -V   {Verbose},
         -W   {use Wiring pi methods},
         -X   {eXecute demonstration}

spi_ledx_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/spi_ledx_demo
spi_ledx_demo.c Version 0.03 {Exp}, [31/03/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_ledx_demo  [Options]
Options: -a arg_filename[.arg],
         -cascade d
                {CASCADE of d matrices (1 < d <= 128)},
         -8DGT  {8-DiGiT led display},
         -MTX   {8x8 led MaTriX display - default},
         -MTX2  {16x8 dual led MaTriX display#},
         -MTX4  {32x8 quad led MaTriX display},
                {#on spidev0.0, others on spidev0.1},
         -E     {Echo command-line arguments},
         -Q     {Quiet - default},
         -BT    {Brightness Test},
         -CBT   {Cascade Brightness Test},
         -CST   {Cascade Self Test},
         -CFT1  {Cascade Font Test #1},
         -CFT2  {Cascade Font Test #2},
         -CFT3  {Cascade Font Test #3},
         -DPT   {Decimal Point Test},
         -DT1   {Digit Test #1},
         -DT2   {Digit Test #2},
         -DT3   {Digit Test #3},
         -FT1   {Font Test #1},
         -FT2   {Font Test #2},
         -FT3   {Font Test #3},
         -F8x8  {use 8x8 Font - default},
         -F8x5R {use Rotated 8x5 Font (PCD8544 font)},
         -ST    {Self Test the LED matrix},
         -S     {use System call methods - default},
         -V     {Verbose},
         -WCFFT {Wiring pi Cascaded Full Font Test},
         -WFFT  {Wiring pi Full Font Test},
         -W     {use Wiring pi spi methods},
         -X     {eXecute demonstration}.

Testing Kernel Bug Fix (wiringPi workaround) for -S methods...

spi_glcdV2_demo.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/spi_glcdV2_demo
spi_glcdV2_demo.c Version 0.02 {Exp}, [10/02/2015], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcdV2_demo  [Options]
Options: -a arg_filename[.arg],
         -xpm xpm_filename[.xpm] (for 48x84 rotated graphic),
         -E   {Echo command-line arguments},
         -backlight on|off,
         -IG  {Initialise gpio's, check backlight & Gpio readall},
         -CH  {Clear and return Home},
         -inverse {INVERSE display},
         -normal  {NORMAL display - default},
         -RI  {Reset & Initialise display},
         -SCn {Set Contrast level n, 0<=n<=8},
         -WFT {Write direct Font data Test},
         -WGT {Write Graphics image data Test},
         -WMT {Write Message Test},
         -Q  {Quiet - default},
         -V  {Verbose},
         -X  {eXecute demonstration}

oled_i2c_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/oled_i2c_demo
oled_i2c_demo.c Version 0.02 {Exp}, [31/03/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage oled_i2c_demo  [Options]
Options: -a arg_filename[.arg],
         -E   {Echo command-line arguments},
         -I   {Inquire about i2c devices},
         -CH  {Clear display & return Home^^},
         -ID  {Initialise Display},
         -inverse {INVERSE display},
         -normal  {NORMAL display - default},
         -oled128 {use oled128 font - default},
         -oled256 {use oled256 font},
         -jace128 {use jace128 font},
         -Q   {Quiet - default},
         -RC  {Reset Contrast},
         -SCn {Set Contrast level n, 0<=n<=8},
         -S   {use System call methods - default},
         -TD  {Test Display},
         -V   {Verbose},
         -WFT {Write Font bytes Test^^},
         -WMT {Write Message Test^^},
              {^^ use with -S or -PG methods only},
         -W   {use Wiring pi i2c methods},
         -PG  {use PiGpio i2c methods**},
              {**NB: requires sudo "prefix"! },
         -X   {eXecute demonstration}.

glcd_font_tool.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/glcd_font_tool
glcd_font_tool.c Version 0.00 {Exp}, [19/05/2015], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage glcd_font_tool [path/]fontInfile_name[.h] [options]
Options: -o fontOut_filename_prefix,
         -a arg_filename[.arg],
         -conv d {CONVert upto d font chars. (1 < d <= 256},
         -C   {Clean|Clone font file - default},
         -E   {Echo command-line arguments},
         -O   {auto-generate fontOutfile_name},
         -OCR {Output a Column/Row font},
         -ORC {Output a Row/Column font},
         -Q   {Quiet - default},
         -V   {Verbose},

spi_led_4dq_demo

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/spi_led_4dq_demo 
spi_led_4dq_demo.c Version 0.00 {Exp}, [14/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_led_4dq_demo  [Options]
Options: -a arg_filename[.arg],
         -E      {Echo command-line arguments},
         -CMXT   {Cascaded MultipleXed digits Test},
         -DON    {Display fully ON},
         -DOFF   {Display fully OFF},
         -MXDI d {MultipleXed Display of Integer d},
         -MXT    {MultipleXed digits Test},
         -Q      {Quiet - default},
         -SQT    {Sequential Digit Test},
         -S      {use System call methods - default},
         -V      {Verbose},
         -W      {use Wiring pi spi methods},
         -X      {eXecute demonstration}.

spi_led_4drrg_demo

pi@raspiP3B16Gb:~/i2c_spi_chips-0.0 $ ./src/spi_led_4drrg_demo 
spi_led_4drrg_demo.c Version 0.00 {Exp}, [14/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_led_4drrg_demo  [Options]
Options: -a arg_filename[.arg],
         -E      {Echo command-line arguments},
         +CLKI   {CLocK Indicators enabled},
         -DON    {Display fully ON},
         -DOFF   {Display fully OFF},
         +GXL    {Green eXternal led on},
         -LnT    {cLock indicator n Test, n=1,2 or 3},
         -MXCLKT {MultipleXed CLocK display Test (implies -W)},
         -MXDI d {MultipleXed Display of Integer d},
         -MXT    {MultipleXed digits Test},
         -Q      {Quiet - default},
         +RXL    {Red eXternal led on},
         -SQT    {Sequential Digit Test},
         +YXL    {"Yellow" eXternal led on (when Multi-pleXed)},
         -S      {use System call methods - default},
         -V      {Verbose},
         -W      {use Wiring pi spi methods},
         -X      {eXecute demonstration}.


Check1: Mon Aug 14 20:13:57 2017
Check2: 20:13:59

i2c_rgb_led_demo.c

pi@raspibplus16Gb ~/i2c_spi_chips-0.0 $ ./src/i2c_rgb_led_demo
i2c_rgb_led_demo.c Version 0.00 {Exp}, [04/07/2015], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage i2c_rgb_led_demo  [Options]
Options: -a arg_filename[.arg],
         -C3T {3_Clr rgb diode Test},
         -DNT {Dn rgb diodes Test},
         -E   {Echo command-line arguments},
         -I   {Inquire about i2c devices},
         -S   {use System call methods - default},
         -W   {use Wiring pi i2c methods},
         -X   {eXecute demonstration}.

i2c_ledx_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/i2c_ledx_demo
i2c_ledx_demo.c Version 0.02 {Exp}, [31/03/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage i2c_ledx_demo  [Options]
Options: -a arg_filename[.arg],
         -E      {Echo command-line arguments},
         -I      {Inquire about i2c devices},
         -MX08   {using 0.8in led MatriX module (default)},
         -MX12   {using 1.2in led MatriX module},
         -MXKY   {using KeYestudio 1.2in led MatriX module},
         -BIT    {Blink Initialisation Test},
         -DIT    {Dimming Initialisation Test},
         -FIT    {Full Initialisation Test},
         -F8x8   {use 8x8 Font - default},
         -F8x5R  {use Rotated 8x5 Font (PCD8544 font)},
         -F8x8JR {use Rotated 8x8 Font (Jupiter ACE font)},
         -FT1    {Font Test #1},
         -FT2    {Font Test #2},
         -FT3    {Font Test #3},
         -QIT    {Quick Initialisation Test},
         -QCT    {Quick font Conversion Test},
         -S      {use System call methods - default},
         -W      {use Wiring pi i2c methods},
         -PGD    {use PiGpioD i2c methods^^},
                 {^^NB: requires a running pigpio daemon!},
         -X      {eXecute demonstration}.

i2c_mxledx_demo.c

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0 $ ./src/i2c_mxledx_demo 
i2c_mxledx_demo.c Version 0.01 {Exp}, [27/07/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage i2c_mxledx_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -HP1  {Simple,'Humble Pi' demo (un-multiplexed)},
         -I    {Inquire about i2c devices},
         -S    {use System call methods - default},
         -SMX  {Slow MultipleX test- implies -S},
         -WMX1 {medium MultipleX test - implies -W},
         -WMX2 {rapid MultipleX test - implies -W},
         -W    {use Wiring pi i2c methods},
         -X    {eXecute demonstration}.

i2c_clkled_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/i2c_clkled_demo
i2c_clkled_demo.c Version 0.02 {Exp}, [31/03/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage i2c_clkled_demo  [Options]
Options: -a arg_filename[.arg],
         -E    {Echo command-line arguments},
         -I    {Inquire about i2c devices},
         -BIT  {Blink Initialisation Test},
         -CLKT {CLocK display Test},
         -CCLK {Constant CLocK display},
         -DIT  {Dimming Initialisation Test},
         -di n {Display Integer n},
         -FIT  {Full Initialisation Test},
         -QIT  {Quick Initialisation Test},
         -SDT  {Simple Digit Test},
         +R    {activate Red rgb led},
         +G    {activate Green rgb led},
         +B    {activate Blue rgb led},
         -S    {use System call methods - default},
         -V    {Verbose},
         -W    {use Wiring pi i2c methods},
         -PG   {use PiGpio i2c methods**},
               {**NB: requires sudo "prefix"!},
         -PGD  {use PiGpioD i2c methods^^},
               {^^NB: requires a running pigpio daemon!},
         -X    {eXecute demonstration}.

Check1: Fri Apr 13 19:10:01 2018
Check2: 19:10:03

spi_glcdHP3_demo.c

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0 $ ./src/spi_glcdHP3_demo 
spi_glcdHP3_demo.c Version 0.01 {Exp}, [21/08/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcdHP3_demo  [Options]
Options: -a arg_filename[.arg],
         -xpm xpm_filename[.xpm] (for 48x84 rotated graphic),
         -E   {Echo command-line arguments},
         -IG  {Initialise gpio's & Gpio readall},
         -CH  {Clear and return Home},
         -inverse {INVERSE display},
         -normal  {NORMAL display - default},
         -RI  {Reset & Initialise display},
         -SCn {Set Contrast level n, 0<=n<=8},
         -WFT {Write direct Font data Test},
         -WGT {Write Graphics image data Test},
         -WMT {Write Message Test},
         -Q  {Quiet - default},
         -V  {Verbose},
         -X  {eXecute demonstration}

spi_glcdV2N_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/spi_glcdV2N_demo 
spi_glcdV2N_demo.c Version 0.01 {Exp}, [31/03/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcdV2N_demo  [Options]
Options: -a arg_filename[.arg],
         -xpm xpm_filename[.xpm] (for 48x84 rotated graphic),
         -E   {Echo command-line arguments},
         -IG  {Initialise gpio's & Gpio readall},
         -CH  {Clear and return Home},
         -inverse {INVERSE display},
         -normal  {NORMAL display - default},
         -RI  {Reset & Initialise display},
         -SCn {Set Contrast level n, 0<=n<=8},
         -WFT {Write direct Font data Test},
         -WGT {Write Graphics image data Test},
         -WMT {Write Message Test},
         -Q  {Quiet - default},
         -V  {Verbose},
         -X  {eXecute demonstration}

spi_led_2x4d_demo.c

pi@raspiP3BStretch16Gb:~/i2c_spi_chips-0.0 $ ./src/spi_led_2x4d_demo
spi_led_2x4d_demo.c Version 0.01 {Exp}, [30/09/2017], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_led_2x4d_demo  [Options]
Options: -a arg_filename[.arg],
         -E       {Echo command-line arguments},
         -DON     {Display fully ON},
         -DOFF    {Display fully OFF},
         -MXUDI d {MultipleXed Upper Display of 4-digit Integer d},
         -MXLDI d {MultipleXed Lower Display of 4-digit Integer d},
         -MX8DI d {MultipleXed Display of 8-digit Integer d},
         -MXT     {MultipleXed digits Test},
         -Q       {Quiet - default},
         -SQT     {SeQuential digit block Test},
         -S       {use System call methods - default},
         -V       {Verbose},
         -W       {use Wiring pi spi methods},
         -X       {eXecute demonstration}.

spi_glcdV2A_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/spi_glcdV2A_demo 
spi_glcdV2A_demo.c Version 0.03 {Exp}, [11/06/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcdV2A_demo  [Options]
Options: -a arg_filename[.arg],
         -xpm xpm_filename[.xpm] (for 48x84 rotated graphic),
         -CEn {use CEn (/dev/spidev0.n) - n=0|1, default CE0},
         -E   {Echo command-line arguments},
         -backlight on|off, 
         -IG  {Initialise gpio's & Gpio readall},
         -CH  {Clear and return Home},
         -inverse {INVERSE display},
         -normal  {NORMAL display - default},
         -RI  {Reset & Initialise display},
         -SCn {Set Contrast level n, 0<=n<=8},
         -WFT {Write direct Font data Test},
         -WGT {Write Graphics image data Test},
         -WMT {Write Message Test},
         -Q  {Quiet - default},
         -V  {Verbose},
         -X  {eXecute demonstration}

spi_glcdG_demo.c

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0 $ ./src/spi_glcdG_demo 
spi_glcdG_demo.c Version 0.01 {Exp}, [16/06/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Usage spi_glcdG_demo  [Options]
Options: -a arg_filename[.arg],
         -xpm xpm_filename[.xpm] (for 48x84 rotated graphic),
         -rst# d {RST gpio BCM# is d (1 < d < 28)},
         -dc# d  {DC  gpio BCM# is d (1 < d < 28)},
         -bl# d  {BL  gpio BCM# is d (1 < d < 28)},
         -CEn    {use CEn (/dev/spidev0.n) - n=0|1, default CE0},
         -E      {Echo command-line arguments},
         -backlight on|off, 
         -IG  {Initialise gpio's & Gpio readall},
         -CH  {Clear and return Home},
         -inverse {INVERSE display},
         -normal  {NORMAL display - default},
         -RI  {Reset & Initialise display},
         -SCn {Set Contrast level n, 0<=n<=8},
         -WFT {Write direct Font data Test},
         -WGT {Write Graphics image data Test},
         -WMT {Write Message Test},
         -Q  {Quiet - default},
         -V  {Verbose},
         -X  {eXecute demonstration}

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0/src $ cat spi_glcdG_demo.arg
* Default Argument file for spi_glcdG_demo with spi_glcdV2A_demo's parameters:
-rst# 27
-dc# 17
-bl# 22

pi@raspiP3Bplus18:~/i2c_spi_chips-0.0/src $ ./spi_glcdG_demo -E
spi_glcdG_demo.c Version 0.01 {Exp}, [16/06/2018], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
Loading spi_glcdG_demo.arg ...
* Default Argument file for spi_glcdG_demo with spi_glcdV2A_demo's parameters:
 ... done.
-E 
pcd8544 chip status:
SPI_DEV  /dev/spidev0.0
RST GPIO 27
DC  GPIO 17
BL  GPIO 22
DCVAL    0x00
NAME     Nokia5110G
pcd8544 colpix store status:
First column bytes ...
0x00 0xff 0x00 0xff 0x00 0xff
Last column bytes ...
0xff 0x00 0xff 0x00 0xff 0x00
Using 'C' system calls to 'gpio' and wiringPi methods: ...
gpio -g mode 27 out
gpio export  17 out
gpio -g mode 22 out
gpio -g write 27 1
digitalWrite(#17, 0)
gpio -g write 22 1
gpio exports
ls -laF /sys/class/gpio/
Using wiringPiSPI methods: ...
wP_SPIfd[0] = 3
wP_SPIfd[1] = 4
*nokia5110g.spifd = 3
digitalWrite(#17, 0)
ls -laF /sys/class/gpio/
gpio unexportall
ls -laF /sys/class/gpio/
gpio readall

Snippits from some of the "Convenience Library" Header Files

i2c_chips.h

#define ALL_GPIO_BITS_OUT 0x00
#define ALL_GPIO_BITS_IN 0xff
#define ALL_GPIO_BITS_LOW 0x00
#define ALL_GPIO_BITS_HIGH 0xff
#define ALL_GPIO_BITS_NORMAL 0x00
#define ALL_GPIO_BITS_INVERTED 0xff
#define HIGH_GPIO_NIBBLE_INVERTED 0xf0
#define LOW_GPIO_NIBBLE_INVERTED 0x0f

#define CHIP_NAME_LEN 32

/* MCP23017 */
typedef struct
{
  unsigned int addr;
  unsigned int iocon;
  unsigned int iodira;
  unsigned int iodirb;
  unsigned int ipola;
  unsigned int ipolb;
  unsigned int gpioa;
  unsigned int gpiob;
  /* Registers not yet in use >>> */
  /*
   * unsigned int gpintena;
   * unsigned int defvala;
   * unsigned int intcona;
   * unsigned int gppua;
   * unsigned int intfa;
   * unsigned int intcapa;
   * unsigned int olata;
   * unsigned int gpintenb;
   * unsigned int defvalb;
   * unsigned int intconb;
   * unsigned int gppub;
   * unsigned int intfb;
   * unsigned int intcapb;
   * unsigned int olatb;
   */
  /* <<< */
  char name[CHIP_NAME_LEN];
} mcp23017;

#define MCP23017_I2C_DRT 284 /* micro-seconds (100kHz bus clock, 28 clocks + tpv) */

unsigned int init_mcp23017(mcp23017 *chip,
                           unsigned int addr,
                           char *chip_name);

void echo_mcp23017_status(mcp23017 chip);

/* MCP23008 */
typedef struct
{
  unsigned int addr;
  unsigned int iocon;
  unsigned int iodir;
  unsigned int iopol;
  unsigned int gpio;
  /* Registers not yet in use >>> */
  /*
   * unsigned int gpinten;
   * unsigned int defval;
   * unsigned int intcon;
   * unsigned int gppu;
   * unsigned int intf;
   * unsigned int intcap;
   * unsigned int olat;
   */
  /* <<< */
  char name[CHIP_NAME_LEN];
} mcp23008;

#define MCP23008_I2C_DRT 284 /* micro-seconds (100kHz bus clock, 28 clocks + tpv) */

unsigned int init_mcp23008(mcp23008 *chip,
                           unsigned int addr,
                           char *chip_name);

void echo_mcp23008_status(mcp23008 chip);

/* PCF8574 */
typedef struct
{
  unsigned int addr;
  unsigned int qiop;
  char name[CHIP_NAME_LEN];
} pcf8574;

/* #define PCF8574_I2C_DRT 184 /* micro-seconds (100kHz bus clock, 18 clocks + tpv) */
#define PCF8574_I2C_DRT 204 /* micro-seconds (100kHz bus clock, 20 clocks + tpv) */

unsigned int init_pcf8574(pcf8574 *chip,
                          unsigned int addr,
                          char *chip_name);

void echo_pcf8574_status(pcf8574 chip);

/* LCD Backpack V2 */
typedef struct
{
  unsigned int addr;
  unsigned int printstr;
  unsigned int cursorposn;
  unsigned int clearline;
  unsigned int cleardisp;
  unsigned int lcdtype;
  unsigned int hd44780;
  unsigned int backlight;
  unsigned int writechar;
  unsigned int createchar;
  unsigned int setbaudrate;
  /* Not in use by I2C */
  /*
   * unsigned int changei2caddr;
   */
  char name[CHIP_NAME_LEN];
} lcdbpv2;

unsigned int init_lcdbpv2(lcdbpv2 *chip,
                          unsigned int addr,
                          char *chip_name);

void echo_lcdbpv2_status(lcdbpv2 chip);

/* I2C version of SSD1306 OLED */
typedef struct
{
  unsigned int addr;     /* 0x3c or 0x3d */
  unsigned int c0dc;
  unsigned int cmds;     /* Single-byte CoMmand store */
  unsigned int cmdd[2];  /* Double-byte CoMmand store */
  unsigned int cmdt[3];  /* Triple-byte CoMmand store */
  unsigned int cmdm[7];  /* Multi-byte CoMmand store, m (6|7) in cmdm[0] */
  unsigned int cfont[8]; /* Column-based FONT store   */
  /* Page (column bytes) | Frame Buffer store         */
  unsigned int page[8][128];
  char name[CHIP_NAME_LEN];
} i2c_ssd1306_oled;

#define OLED_COMMAND              0x00
#define OLED_DATA                 0x40
#define OLED_CONTRAST_RESET       0x7f
#define OLED_HORIZONTAL_ADDR_MODE 0x00
#define OLED_VERTICAL_ADDR_MODE   0x01
#define OLED_PAGE_ADDR_MODE       0x02
#define OLED_COLUMN_START_RESET   0
#define OLED_COLUMN_END_RESET     127
#define OLED_PAGE_START_RESET     0
#define OLED_PAGE_END_RESET       7
#define OLED_CHAR_WIDTH           128 /* 8x8 font */

/* Single-byte Commands ... */
#define OLED_DISPLAY_ON_WITH_RAM 0xa4 
#define OLED_DISPLAY_ON_NO_RAM   0xa5
#define OLED_DISPLAY_NORMAL      0xa6 
#define OLED_DISPLAY_INVERSE     0xa7 
#define OLED_DISPLAY_OFF         0xae
#define OLED_DISPLAY_ON          0xaf
#define OLED_SET_SEG0_0          0xa0
#define OLED_SET_SEG0_127        0xa1 /* Re-map */
#define OLED_SET_COMO_NORMAL     0xC0
#define OLED_SET_COMO_REMAP      0xC8

/* Double-byte Command prefixes ... */
#define OLED_SET_CONTRAST        0x81
#define OLED_SET_MEM_ADDR_MODE   0x20

/* Triple-byte Command prefixes ... */
#define OLED_SET_COLUMN_ADDR     0x21
#define OLED_SET_PAGE_ADDR       0x22

/* Multi-byte Command prefixes ... */

/* Contrast ... */
#define OLED_C0 0x0f
#define OLED_C1 0x1f
#define OLED_C2 0x3f
#define OLED_C3 0x5f
#define OLED_C4 OLED_CONTRAST_RESET
#define OLED_C5 0x9f
#define OLED_C6 0xbf
#define OLED_C7 0xdf
#define OLED_C8 0xef

unsigned init_i2c_ssd1306_oled(i2c_ssd1306_oled *chip,
                               unsigned int addr,
                               char *chip_name);

void echo_i2c_ssd1306_oled_status(i2c_ssd1306_oled chip);

/* HT16K33 */
#define DDAP_ADDR   0x00
#define SSR_STANDBY 0x20 /* STANDBY mode (System Oscillator Off) */
#define SSR_NORMAL  0x21 /* NORMAL mode  (System Oscillator On)  */
#define RISR_ADDR   0xa0
#define RISR_ROWD   0xa0 /* ROW Driver output mode    */
#define RISR_INTL   0xa1 /* ROW INTerrupt active low  */
#define RISR_INTH   0xa3 /* ROW INTerrupt active high */
#define DSPR_ADDR   0x80 
#define DMSR_ADDR   0xef
#define DISPOFFMSK  0x80 /* & */  
#define DISPONMSK   0x01 /* | */    
#define DSPRBLNKMSK 0x05
#define BLINKOFF    0x89 /* & */
#define BLINK20HZ   0x8b /* | */
#define BLINK10HZ   0x8c /* | */
#define BLINK05HZ   0x8e /* | */    
#define DIMSETMASK  0xe0
#define DIM01_16    0x00 /* | */
#define DIM02_16    0x01 /* | */
#define DIM03_16    0x02 /* | */
#define DIM04_16    0x03 /* | */
#define DIM05_16    0x04 /* | */
#define DIM06_16    0x05 /* | */
#define DIM07_16    0x06 /* | */
#define DIM08_16    0x07 /* | */
#define DIM09_16    0x08 /* | */
#define DIM10_16    0x09 /* | */
#define DIM11_16    0x0a /* | */
#define DIM12_16    0x0b /* | */
#define DIM13_16    0x0c /* | */
#define DIM14_16    0x0d /* | */
#define DIM15_16    0x0e /* | */
#define DIM16_16    0x0f /* | */
/* Adafruit 8x8 LED Matrix layout ...     */
/* ROW0 at "top", below I2C connector ... */
#define ROW0ADDR    0x00
#define ROW1ADDR    0x02
#define ROW2ADDR    0x04
#define ROW3ADDR    0x06
#define ROW4ADDR    0x08
#define ROW5ADDR    0x0a
#define ROW6ADDR    0x0c
#define ROW7ADDR    0x0e
/* COL0 at left edge ... */
#define COL0MASK    0x80 /* | */
#define COL1MASK    0x01 /* | */
#define COL2MASK    0x02 /* | */
#define COL3MASK    0x04 /* | */
#define COL4MASK    0x08 /* | */
#define COL5MASK    0x10 /* | */
#define COL6MASK    0x20 /* | */
#define COL7MASK    0x40 /* | */
#define ALLCOLON    0xff      
#define ALLCOLOFF   0x00      


/* Green "Clock Style" 4-Digit LED Display + RGB LED */
/* NB: Using HT16K33 notation cf. a matrix layout    */
/* Digit & RGB Columns   */
/* (Digits use Rows 0-7) */
#define DGT1ADDR    0x00 
#define DGT2ADDR    0x02
#define DGT3ADDR    0x04
#define DGT4ADDR    0x06
/* (RGB uses Rows 8-10, order BGR!) */
#define RGBADDR     0x09
/* Segment Masks         */
#define SEGAMASK    0x01 /* | */
#define SEGBMASK    0x02 /* | */
#define SEGCMASK    0x04 /* | */
#define SEGDMASK    0x08 /* | */
#define SEGEMASK    0x10 /* | */
#define SEGFMASK    0x20 /* | */
#define SEGGMASK    0x40 /* | */
#define SEGDPMASK   0x80 /* | */
/* DP only available for digits 2 & 3 */
#define ALLSEGON    0xff
#define ALLSEGOFF   0x00
#define ALLRGBON    0x07
#define ALLRGBOFF   0x00
/* RGB Masks (order BGR!) */
#define BLUEON      0x04 /* | */
#define GREENON     0x02 /* | */
#define REDON       0x01 /* | */

typedef struct
{
  unsigned int addr;
  unsigned int conf;
  unsigned int ddap; /* Display Data Address Pointer */  
  unsigned int ddcb; /* Display Data Column Byte     */
  unsigned int ssr;  /* System Setup Register        */
  unsigned int risr; /* Row/Int Set Register         */
  unsigned int dspr; /* Display SetuP Register       */
  unsigned int dmsr; /* DiMming Set Register         */
  /* Registers not in use... */
  /*
   * unsigned int kdap; Key Data Address Pointer
   * unsigned int ifap; Int Flag Address Pointer
   */
  /* 8x8 LED Matrix data etc. */
  unsigned int crfont[8]; /* Column-based Raw FONT store       */
  unsigned int ccfont[8]; /* Column-based Converted FONT store */
  /* Clock LED Display & RGB LED data etc. */
  unsigned int digits[4]; /* NB: 7-seg CC encoded digits */
  unsigned int rgb;
  char name[CHIP_NAME_LEN];
} ht16k33;

unsigned init_ht16k33(ht16k33 *chip,
                      unsigned int addr,
                      unsigned int conf,
                      char *chip_name);

void echo_ht16k33_status(ht16k33 chip);

void convert_ht16k33_font(ht16k33 *chip);

void load_ht16k33_crfont(ht16k33 *chip,
                         char *thisfont,
                         unsigned int fidx,
                         int nrow);

void load_ht16k33_digits(ht16k33 *chip,
                         unsigned int digits[4]);

void load_ht16k33_rgb(ht16k33 *chip,
                      unsigned int rgb);

i2c_wraps.h

void C2S_i2cdetect(int chan,
                   char qx);

void C2S_i2cset(int chan,
                unsigned int addr,
                unsigned int regr,
                unsigned int data,
                char qx);

void C2S_i2cseti(int chan,
                 unsigned int addr,
                 unsigned int regr,
                 unsigned int data[16],
                 unsigned int nval,
                 char qx);

void C2S_i2cout(int chan,
                unsigned int addr,
                unsigned int data,
                char qx);

#ifdef HAVE_WIRINGPI_H
void C2S_gpio(char *options,
              char qx);

#define GPIO_XIN  0
#define GPIO_XOUT 1

void C2S_gpio_export(int gpio_pin,
                     int gpio_mode,
                     char qx);

void C2S_gpio_unexport(int gpio_pin,
                       char qx);

void C2S_gpio_unexportall(char qx);

#define GPIO_MODE_IN  -1
#define GPIO_MODE_OUT  1

void C2S_gpio_g_mode(int gpio_gpin,
                     int gpio_mode,
                     char qx);

void C2S_gpio_g_write(int gpio_gpin,
                     int gpio_level,
                     char qx);

void C2S_gpio_mode(int gpio_wpin,
                   int gpio_mode,
                   char qx);

void C2S_gpio_write(int gpio_wpin,
                    int gpio_level,
                    char qx);

void C2S_gpio_wb(unsigned int gpio_byte,
                 char qx);

#define GPIO_HIGH HIGH
#define GPIO_LOW  LOW

void WP_pinMode(int wpin,
                int mode,
                char qx);

void WP_digitalWrite(int gpio_pin,
                     int value,
                     char qx);

void WP_digitalWriteByte(int value,
                         char qx);
#endif /* HAVE_WIRINGPI_H */

#ifdef HAVE_WIRINGPII2C_H

#define WP_MAX_IBYTES 128

typedef struct
{
  int did;
  int fd;
  int reg;
  int data;
  char ibytes[WP_MAX_IBYTES];
} wpi2cvb; /* WiringPiI2C Variables Block */

void WP_i2cset(wpi2cvb wpi2c,
               char qx);

void WP_i2cset2(wpi2cvb wpi2c,
                char qx);

void WP_i2cseti(wpi2cvb wpi2c,
                int nbytes,
                char qx);

void WP_i2cout(wpi2cvb wpi2c,
               char qx);

int WP_i2cget(wpi2cvb wpi2c,
              char qx);

#endif /* HAVE_WIRINGPII2C_H */

#endif /* !I2C_WRAP_H */

pigpio_wraps.h

#define PG_BLOCK_SIZE    32
#define PG_UNDEF_HANDLE 999

typedef struct
{
  unsigned int i2cBus;
  unsigned int i2cAddr;
  unsigned int i2cFlags; /* Currently always set to zero - see pigpio.h */
  unsigned int handle;
  unsigned int i2cReg;
  unsigned int bVal;
  unsigned int wVal;
  char block_buf[PG_BLOCK_SIZE];
} pgi2cvb; /* PiGpio I2C Variables Block */

void PG_i2cset(pgi2cvb pgi2c,
               char qx);
  
void PG_i2cset2(pgi2cvb pgi2c,
                char qx);

void PG_i2cseti(pgi2cvb pgi2c,
                unsigned int count,
                char qx);

void PG_i2cout(pgi2cvb pgi2c,
               char qx);

pigpiod_wraps.h

/*
#define PG_BLOCK_SIZE    32
*/
#define PGD_UNDEF_HANDLE 999

typedef struct
{
  int thispi;
  unsigned int i2cbus;
  unsigned int i2caddr;
  unsigned int i2cflags; /* Currently always set to zero - see pigpiod_if2.h */
  unsigned int handle;
  unsigned int i2cReg;
  unsigned int bVal;
  unsigned int wVal;
  /*  char block_buf[PG_BLOCK_SIZE]; */
} pgdi2cvb; /* PiGpioD I2C Variables Block */


void PGD_i2cset(pgdi2cvb pgdi2c,
                char qx);

void PGD_i2cset2(pgdi2cvb pgdi2c,
                 char qx);

/*
void PGD_i2cseti(pgdi2cvb pgdi2c,
                 unsigned int count,
                 char qx);
*/

void PGD_i2cout(pgdi2cvb pgdi2c,
                char qx);

spi_chips.h

#ifndef CHIP_NAME_LEN
#define CHIP_NAME_LEN 32
#endif /* !CHIP_NAME_LEN */

#define SPI_DEV00 0
#define SPI_DEV01 1

static char SPIdev0[]   = "/dev/spidev0.0";
static char SPIdev1[]   = "/dev/spidev0.1";
static char SPIdevNul[] = "SPI /dev undefined";

/* MCP23S08 */
typedef struct
{
  char *spidev;
  int  *spifd;
  unsigned int waddr; /* Write ADDRess */
  unsigned int iocon;
  unsigned int iodir;
  unsigned int iopol;
  unsigned int gpio;
  /* Registers not yet in use >>> */
  /*
   * unsigned int gpinten;
   * unsigned int defval;
   * unsigned int intcon;
   * unsigned int gppu;
   * unsigned int intf;
   * unsigned int intcap;
   * unsigned int olat;
   */
  /* <<< */
  char name[CHIP_NAME_LEN];
} mcp23S08;

#define MCP23S08_SPI_DRT 48 /* micro-seconds (500kHz bus clock, 24 clocks/3 bytes) */

unsigned int init_mcp23S08(mcp23S08 *chip,
                           unsigned int waddr,
                           char spidev,
                           char *chip_name);

void echo_mcp23S08_status(mcp23S08 chip);

/* MAX7219 */
typedef struct
{
  char *spidev;
  int  *spifd;
  unsigned int NoOp;
  unsigned int Digit0;
  unsigned int Digit1;
  unsigned int Digit2;
  unsigned int Digit3;
  unsigned int Digit4;
  unsigned int Digit5;
  unsigned int Digit6;
  unsigned int Digit7;
  unsigned int DecodeMode;
  unsigned int Intensity;
  unsigned int ScanLimit;
  unsigned int Shutdown;
  unsigned int DisplayTest;
  char name[CHIP_NAME_LEN];
} max7219;

void init_max7219(max7219 *chip,
                  char spidev,
                  char *chip_name);

void echo_max7219_status(max7219 chip);

/* MAX7221 */
typedef struct
{
  char *spidev;
  int  *spifd;
  unsigned int NoOp;
  unsigned int Digit0;
  unsigned int Digit1;
  unsigned int Digit2;
  unsigned int Digit3;
  unsigned int Digit4;
  unsigned int Digit5;
  unsigned int Digit6;
  unsigned int Digit7;
  unsigned int DecodeMode;
  unsigned int Intensity;
  unsigned int ScanLimit;
  unsigned int Shutdown;
  unsigned int DisplayTest;
  char name[CHIP_NAME_LEN];
} max7221;

void init_max7221(max7221 *chip,
                  char spidev,
                  char *chip_name);

void echo_max7221_status(max7221 chip);

/* Useful MAX7219/7221 commands ... */
/* NB: All "Don't care" bits = 0    */
#define NOOP_DATA                0x00
#define SHUTDOWN_MODE            0x00
#define NORMAL_OPERATION         0x01
#define NO_DECODE_ALL_DIGITS     0x00
#define CODE_B_DECODE_ALL_DIGITS 0xff
#define MIN_INTENSITY            0x00
#define MED_INTENSITY            0x07
#define MAX_INTENSITY            0x0f
#define SCAN_ALL_DIGITS          0x07
#define DISPLAY_NORMAL_MODE      0x00
#define DISPLAY_TEST_MODE        0x01
#define ALL_DOTS_ON              0xff /* NO_DECODE_ALL_DIGITS active!     */
#define ALL_DOTS_OFF             0x00 /* NO_DECODE_ALL_DIGITS active!     */
#define ALL_SEG_DP_OFF           0x0f /* CODE_B_DECODE_ALL_DIGITS active! */
#define ALL_SEG_DP_ON            0x88 /* CODE_B_DECODE_ALL_DIGITS active! */
#define ALL_SEG_ON_DP_OFF        0x08 /* CODE_B_DECODE_ALL_DIGITS active! */
#define ALL_SEG_OFF_DP_ON        0x8f /* CODE_B_DECODE_ALL_DIGITS active! */
#define CODE_B_HYPHEN            0x0a /* CODE_B_DECODE_ALL_DIGITS active! */
#define CODE_B_E                 0x0b /* CODE_B_DECODE_ALL_DIGITS active! */
#define CODE_B_H                 0x0c /* CODE_B_DECODE_ALL_DIGITS active! */
#define CODE_B_L                 0x0d /* CODE_B_DECODE_ALL_DIGITS active! */
#define CODE_B_P                 0x0e /* CODE_B_DECODE_ALL_DIGITS active! */
#define DP_OFFSET                0x80

/* PCD8544/Nokia5110 */
typedef struct
{
  char *spidev;
  int  *spifd;
  int rst_gpio;
  int dc_gpio;
  int bl_gpio; /* Reserved for future use */
  unsigned int dcval; /* Data or Command VALue */
  char name[CHIP_NAME_LEN];
} pcd8544;

#define GPIO_UNASSIGNED -1

void init_pcd8544(pcd8544 *chip,
                  int rst_gpio,
                  int dc_gpio,
                  int bl_gpio,
                  char spidev,
                  char *chip_name);
                  
void echo_pcd8544_status(pcd8544 chip);

/* Bit-Banged PCD8544/Nokia5110         */
/* NB: Uses wiringPi pin numbers        */
/* and requires sudo (root) priviliges! */
typedef struct
{
  int rst_wpin;
  int ce_wpin;
  int dc_wpin;
  int din_wpin;
  int clk_wpin;
  int bl_wpin; /* Reserved for future use */
  unsigned char dcval; /* Data or Command VALue */
  unsigned int speed;
  char name[CHIP_NAME_LEN];
} bbpcd8544;

#define WPIN_UNASSIGNED -1
#define PCD8544_SLOW_CLOCK   500 /* uS ==   1kHz */
#define PCD8544_MEDIUM_CLOCK  50 /* uS ==  10kHz */
#define PCD8544_FAST_CLOCK     5 /* uS == 100kHz */
#define PCD8544_VFAST_CLOCK    2 /* uS == 250kHz */
/* Contrast ... */
#define PCD8544_C0          0x2f
#define PCD8544_C1          0x33
#define PCD8544_C2          0x37
#define PCD8544_C3          0x3b
#define PCD8544_C4          0x3d
#define PCD8544_C5          0x3f
#define PCD8544_C6          0x43
#define PCD8544_C7          0x47
#define PCD8544_C8          0x4b
/* Bias (BS0 - BS2) */
#define PCD8544_B0          0x00
#define PCD8544_B1          0x01
#define PCD8544_B2          0x02
#define PCD8544_B3          0x03
#define PCD8544_B4          0x04
#define PCD8544_B5          0x05
#define PCD8544_B6          0x06
#define PCD8544_B7          0x07

void init_bbpcd8544(bbpcd8544 *chip,
                    int rst_wpin,
                    int ce_wpin,
                    int dc_wpin,
                    int din_wpin,
                    int clk_wpin,
                    int bl_wpin,
                    unsigned int speed,
                    char *chip_name);

void echo_bbpcd8544_status(bbpcd8544 chip);
/* GPIO controlled 74HC595 */
/* CE0 or CE1 --> RCK (12) */
/* MOSI       --> SER (14) */
/* SCLK       --> SCK (11) */
/* goe_gpio   --> G   (13) [Gate or ¬Output Enable]    */
/* scl_gpio   --> SCL (10) [¬Shift reg.CLear or ¬reset */
typedef struct
{
  char *spidev;
  int  *spifd;
  int goe_gpio;
  int scl_gpio;
  char name[CHIP_NAME_LEN];
} gc74hc595;

#define GC74HC595_SPI_DRT 16 /* micro-seconds (500kHz bus clock, 8 clocks/1 byte) */

void init_gc74hc595(gc74hc595 *chip,
                    int goe_gpio,
                    int scl_gpio,
                    char spidev,
                    char *chip_name);
                    
void echo_gc74hc595_status(gc74hc595 chip);

/* Hard-Wired 74HC595 */
/* CE0 or CE1 --> RCK (12) */
/* MOSI       --> SER (14) */
/* SCLK       --> SCK (11) */
/* Vss        <-- G   (13) [Gate or ¬Output Enable]    */
/* Vdd        <-- SCL (10) [¬Shift reg.CLear or ¬reset */
typedef struct
{
  char *spidev;
  int  *spifd;
  char name[CHIP_NAME_LEN];
} hw74hc595;

#define HW74HC595_SPI_DRT GC74HC595_SPI_DRT

void init_hw74hc595(hw74hc595 *chip,
                    char spidev,
                    char *chip_name);
                    
void echo_hw74hc595_status(hw74hc595 chip);

/* Hard-Wired 74HC164 */
/* Vcc  --> A1 (1) or A2 (2) */
/* MOSI --> A2 (2) or A1 (1) */
/* ie. CE0/CE1 NOT IN USE!   */
/* SCLK --> CLOCK  (8)       */
/* Vcc  --> /RESET (9)       */
typedef struct
{
  char *spidev;
  int  *spifd;
  int chainlen; /* #chips in the chain */
  char name[CHIP_NAME_LEN];
} hw74hc164;

#define HW74HC164X1_SPI_DRT GC74HC595_SPI_DRT

void init_hw74hc164(hw74hc164 *chip,
                    int chainlen,
                    char spidev,
                    char *chip_name);
                    
void echo_hw74hc164_status(hw74hc164 chip);

/* ST7920 GLCD in Serial Mode */
/* ¬CE0 or ¬CE1 --> inverter --> RS        */
/* MOSI                      --> R/¬W      */
/* SCLK                      --> E         */
/* Vss   (Hard-wired)        --> PSB(P/¬S) */
typedef struct
{
  char *spidev;
  int  *spifd;
  char name[CHIP_NAME_LEN];
} st7920sm;

void init_st7920sm(st7920sm *chip,
                   char spidev,
                   char *chip_name);

void echo_st7920sm_status(st7920sm chip);

/* SPI version of SSD1306 OLED */
typedef struct
{
  char *spidev;
  int  *spifd;
  int rst_gpio;
  int dc_gpio;
  unsigned int cmds;     /* Single-byte CoMmand store */
  unsigned int cmdd[2];  /* Double-byte CoMmand store */
  unsigned int cmdt[3];  /* Triple-byte CoMmand store */
  unsigned int cmdm[7];  /* Multi-byte CoMmand store, m (6|7) in cmdm[0] */
  unsigned int cfont[8]; /* Column-based FONT store   */
  /* Page (column bytes) | Frame Buffer store         */
  unsigned int page[8][128];
  char name[CHIP_NAME_LEN];
} spi_ssd1306_oled;

void init_spi_ssd1306_oled(spi_ssd1306_oled *chip,
                           char spidev,
                           int rst_gpio,
                           int dc_gpio,
                           char *chip_name);

void echo_spi_ssd1306_oled_status(spi_ssd1306_oled chip);

#define OLED_CONTRAST_RESET       0x7f
#define OLED_HORIZONTAL_ADDR_MODE 0x00
#define OLED_VERTICAL_ADDR_MODE   0x01
#define OLED_PAGE_ADDR_MODE       0x02
#define OLED_COLUMN_START_RESET   0
#define OLED_COLUMN_END_RESET     127
#define OLED_PAGE_START_RESET     0
#define OLED_PAGE_END_RESET       7
#define OLED_CHAR_WIDTH           128 /* 8x8 font */

/* Single-byte Commands ... */
#define OLED_DISPLAY_ON_WITH_RAM 0xa4 
#define OLED_DISPLAY_ON_NO_RAM   0xa5
#define OLED_DISPLAY_NORMAL      0xa6 
#define OLED_DISPLAY_INVERSE     0xa7 
#define OLED_DISPLAY_OFF         0xae
#define OLED_DISPLAY_ON          0xaf
#define OLED_SET_SEG0_0          0xa0
#define OLED_SET_SEG0_127        0xa1 /* Re-map */
#define OLED_SET_COMO_NORMAL     0xC0
#define OLED_SET_COMO_REMAP      0xC8

/* Double-byte Command prefixes ... */
#define OLED_SET_CONTRAST        0x81
#define OLED_SET_MEM_ADDR_MODE   0x20

/* Triple-byte Command prefixes ... */
#define OLED_SET_COLUMN_ADDR     0x21
#define OLED_SET_PAGE_ADDR       0x22

/* Multi-byte Command prefixes ... */

/* Contrast ... */
#define OLED_C0 0x0f
#define OLED_C1 0x1f
#define OLED_C2 0x3f
#define OLED_C3 0x5f
#define OLED_C4 OLED_CONTRAST_RESET
#define OLED_C5 0x9f
#define OLED_C6 0xbf
#define OLED_C7 0xdf
#define OLED_C8 0xef

spi_wraps.h

typedef struct
{
  int next; /* NEXT index */
  unsigned int regr;
  unsigned int data;
} cascade;

#define EMPTY_CASCADE    -1
#define MAX_CASCADE_LEN 128
#define CASCADE_BUF_LEN 256 /* 2 x MAX_CASCADE_LEN */
#define CASCADE_CMD_LEN 512 /* 4 x MAX_CASCADE_LEN */

/* Ensure globals only declared once ... */
/* Relies on NO_MAIN being defined in libraries */
#ifndef NO_MAIN
cascade led_matrix[MAX_CASCADE_LEN];
char cascade_buffer[CASCADE_BUF_LEN];
#else /* !NO_MAIN */
extern cascade led8x8[MAX_CASCADE_LEN];
extern char cascade_buffer[CASCADE_BUF_LEN];
#endif /* !NO_MAIN */

void reset_cascade(cascade thiscascade[]);

void dump_cascade(cascade thiscascade[],
                  int caslen);

int add_to_cascade(cascade thiscascade[],
                   unsigned int regr,
                   unsigned int data,
                   int caslen);

int fill_cascade(cascade thiscascade[],
                 unsigned int regr,
                 unsigned int data,
                 int caslen);

int insert_into_cascade(cascade thiscascade[],
                        unsigned int regr,
                        unsigned int data,
                        int casposn,
                        int caslen);

int load_cascade_buffer(cascade thiscascade[]);

void dump_cascade_buffer(int nbytes);   

void C2S_cascade2spidev(char *spidev,
                        cascade thiscascade[],
                        char qx);
                      
#ifdef HAVE_WIRINGPISPI_H
void WP_write_cascade(int spifd,
                      cascade thiscascade[],
                      char qx);               
#endif /* HAVE_WIRINGPISPI_H */

void C2S_sechob2spidev(char *spidev,
                       unsigned int sbyte,
                       char qx);        

void C2S_secho2spidev(char *spidev,
                      unsigned int regr,
                      unsigned int data,
                      char qx);               

void C2S_secho3b2spidev(char *spidev,
                        unsigned int waddr,
                        unsigned int regr,
                        unsigned int data,
                        char qx);                     

#ifdef HAVE_WIRINGPI_H
void C2S_echob2spidev(char *spidev,
                      unsigned int sbyte,
                      char qx); 
              
void C2S_echo2spidev(char *spidev,
                     unsigned int regr,
                     unsigned int data,
                     char qx);                
              
void C2S_echo3b2spidev(char *spidev,
                       unsigned int waddr,
                       unsigned int regr,
                       unsigned int data,
                       char qx);                      
#endif /* HAVE_WIRINGPI_H */

#ifdef HAVE_WIRINGPISPI_H
void WP_write_byte(int spifd,
                   unsigned int sbyte,
                   char qx);
                      
void WP_write2bytes(int spifd,
                    unsigned int regr,
                    unsigned int data,
                    char qx);                 
                      
void WP_write3bytes(int spifd,
                    unsigned int waddr,
                    unsigned int regr,
                    unsigned int data,
                    char qx);                 
#endif /* HAVE_WIRINGPISPI_H */

lcd_disptools.h

#define LCD_DDRAM_SIZE              80

typedef enum
{
  LCM0801,
  LCM0802,
  LCM1602,
  LCM2004,
  LAST_LCM,
  LCMTYPES
} lcmclass;

typedef struct
{
  int pixel_row0;
  int pixel_row1;
  int pixel_row2;
  int pixel_row3;
  int pixel_row4;
  int pixel_row5;
  int pixel_row6;
  int pixel_row7;
} lcd_5x8_pixel; 

#define MAX_LCD_NL 4

typedef struct
{
  lcmclass lcd_type;
  int lcd_nc;
  int lcd_nl;
  int lcd_ddram_idx[MAX_LCD_NL];
  int lcd_rs_gpio;
  int lcd_e_gpio;
  pcf8574 lcd_data;
  int lcd_ehmin; /* Enable High MINimum time, uS  */
  int lcd_elmin; /* Enable Low MINimum time^^, uS */
  int lcd_elmax; /* Enable Low MAXimum time^^, uS */
  int lcd_wait;  /* WAIT time, uS                 */ 
  int lcd_nfb;
  int lcd_bsize;
  char lcd_buffer[LCD_DDRAM_SIZE+1];
} lcd_iface_8bit;
/* ^^IE. internal delay before next operation, typically ~41uS|1600uS */

typedef struct
{
  lcmclass lcd_type;
  int lcd_nc;
  int lcd_nl;
  int lcd_ddram_idx[MAX_LCD_NL];
  pcf8574 lcd_data;
  int lcd_ehmin; /* Enable High MINimum time, uS  */
  int lcd_elmin; /* Enable Low MINimum time^^, uS */
  int lcd_elmax; /* Enable Low MAXimum time^^, uS */
  int lcd_wait;  /* WAIT time, uS                 */ 
  int lcd_nfb;
  int lcd_bsize;
  char lcd_buffer[LCD_DDRAM_SIZE+1];
} lcd_fi2c_4bit;
/* ^^IE. internal delay before next operation, typically ~41uS|1600uS */

typedef struct
{
  lcmclass lcd_type;
  int lcd_nc;
  int lcd_nl;
  int lcd_ddram_idx[MAX_LCD_NL];
  int lcd_ehmin; /* Enable High MINimum time, uS  */
  int lcd_elmin; /* Enable Low MINimum time^^, uS */
  int lcd_elmax; /* Enable Low MAXimum time^^, uS */
  int lcd_wait;  /* WAIT time, uS                 */ 
  int lcd_nfb;
  int lcd_bsize;
  char lcd_buffer[LCD_DDRAM_SIZE+1];
} lcd_core;

typedef struct
{
  pcf8574 lcd_data;
  lcd_core M4bit;
  unsigned int lcd_M4data;
} lcd_mi2c_4bit;

typedef struct
{
  pcf8574 lcd_data;
  lcd_core IBO4bit;
  unsigned int lcd_IBO4data;
} lcd_ibo_i2c_4bit;

#ifndef GPIO_IFACE_NAME_LEN
#define GPIO_IFACE_NAME_LEN 32
#endif /* !GPIO_IFACE_NAME_LEN */

typedef struct
{
  int rs_gpio;
  int e_gpio;
  int bl0_gpio;
  int bl1_gpio;
  int d4_gpio;
  int d5_gpio;
  int d6_gpio;
  int d7_gpio;
  char name[GPIO_IFACE_NAME_LEN];
} gpio_4bit4;

typedef struct
{
  gpio_4bit4 lcd_condat;
  lcd_core G4bit;
  unsigned int lcd_G4data;
} lcd_gpio_4bit;

typedef struct
{
  mcp23017 lcd_data;
  int lcd_rs_gpioA;
  int lcd_e_gpioA;
  int lcd_rs_gpioB;
  int lcd_e_gpioB;
  lcd_core A8bit;
  lcd_core B4bit;
  unsigned int lcd_B4data;
} dual_lcd;

typedef struct
{
  mcp23S08 lcd_data;
  int lcd_e_gpio;
  lcd_core S4bit;
  unsigned int lcd_S4data;
} lcd_spi_4bit;

typedef struct
{
  hw74hc595 lcd_data;
  int lcd_e_gpio;
  lcd_core S4bit;
  unsigned int lcd_S4data;
} lcd_spi_4bitV2;

typedef struct
{
  lcmclass lcd_type;
  int lcd_nc;
  int lcd_nl;
  int lcd_ddram_idx[MAX_LCD_NL];
  int lcd_ctrl;
  int lcd_rs_gpio;
  int lcd_e_gpio;
  gc74hc595 lcd_data;
  int lcd_ehmin; /* Enable High MINimum time, uS  */
  int lcd_elmin; /* Enable Low MINimum time^^, uS */
  int lcd_elmax; /* Enable Low MAXimum time^^, uS */
  int lcd_wait;  /* WAIT time, uS                 */ 
  int lcd_nfb;
  int lcd_bsize;
  char lcd_buffer[LCD_DDRAM_SIZE+1];
} lcd_spi_8bit;
/* ^^IE. internal delay before next operation, typically ~41uS|1600uS */

typedef enum
{
  HC8X16, /* GB Half-Character font      */ 
  C16X16, /* GB 16x16 symbol font        */
  G16X16, /* user-defined 16x16 Graphics */
  I16X16, /* chinese 16x16 Iconic font   */
  GLFTYPES
} glcdfonttype;

#define GLCD_NL 4

typedef struct
{
  int glcd_nc;
  int glcd_nl;
  int glcd_ddram_idx[GLCD_NL];
  int glcd_rs_gpio;
  int glcd_e_gpio;
  int glcd_bl_gpio;
  gc74hc595 glcd_data;
  int glcd_ehmin; /* Enable High MINimum time, uS  */
  int glcd_elmin; /* Enable Low MINimum time^^, uS */
  int glcd_elmax; /* Enable Low MAXimum time^^, uS */
  int glcd_wait;  /* WAIT time, uS                 */ 
} glcd_spi2p_8bit;
/* ^^IE. internal delay before next operation, typically ~72uS|1600 */

/* Ensure globals only declared once ... */
/* Relies on NO_MAIN being defined in libraries */
#ifndef NO_MAIN
lcmclass lcdmodel;
glcdfonttype glcdfont;
lcd_5x8_pixel hd44780u;
lcd_iface_8bit current_iface_8bit;
lcd_iface_8bit blue_1602;
lcd_iface_8bit blue_2004;
lcd_iface_8bit yellow_1602;
lcd_fi2c_4bit current_fi2c_4bit;
lcd_fi2c_4bit fun_yellow_1602;
lcd_mi2c_4bit current_mi2c_4bit;
lcd_ibo_i2c_4bit current_ibo_i2c_4bit;
dual_lcd current_dual_lcd;
lcd_gpio_4bit current_gpio_4bit;
lcd_spi_4bit current_spi_4bit;
lcd_spi_4bitV2 current_spi_4bitV2;
lcd_spi_8bit current_spi_8bit;
glcd_spi2p_8bit current_spi2p_8bit;
#else /* !NO_MAIN */
extern lcmclass lcdmodel;
extern glcdfonttype glcdfont;
extern lcd_5x8_pixel hd44780u;
extern lcd_iface_8bit current_iface_8bit;
extern lcd_iface_8bit blue_1602;
extern lcd_iface_8bit blue_2004;
extern lcd_iface_8bit yellow_1602;
extern lcd_fi2c_4bit current_fi2c_4bit;
extern lcd_fi2c_4bit fun_yellow_1602;
extern lcd_mi2c_4bit current_mi2c_4bit;
extern lcd_ibo_i2c_4bit current_ibo_i2c_4bit;
extern dual_lcd current_dual_lcd;
extern lcd_gpio_4bit current_gpio_4bit;
extern lcd_spi_4bit current_spi_4bit;
extern lcd_spi_4bitV2 current_spi_4bitV2;
extern lcd_spi_8bit current_spi_8bit;
extern glcd_spi2p_8bit current_spi2p_8bit;
#endif /* !NO_MAIN */

/* Prototypes */
void init_hd44780u(void);
/* Chessboard 5x8 pixel block */

int get_lcd_nc(lcmclass lcdtype);

int get_lcd_nl(lcmclass lcdtype);

void get_lcd_ddram_idx(lcmclass lcdtype,
                       int lcd_nl,
                       int lcd_ddram_idx[MAX_LCD_NL]);

void lcd_set_createchar_data(int id,
                             int *pixdata);

int init_any_iface_8bit(lcd_iface_8bit *any_iface_8bit,
                        lcmclass lcdtype,
                        int rs_gpio,
                        int e_gpio,
                        unsigned int addr,
                        char name[]);

int init_blue_1602(lcmclass lcdtype,
                   int rs_gpio,
                   int e_gpio,
                   unsigned int addr);

int init_blue_2004(lcmclass lcdtype,
                   int rs_gpio,
                   int e_gpio,
                   unsigned int addr);

int init_yellow_1602(lcmclass lcdtype,
                     int rs_gpio,
                     int e_gpio,
                     unsigned int addr);

int init_any_fi2c_4bit(lcd_fi2c_4bit *any_fi2c_4bit,
                       lcmclass lcdtype,
                       unsigned int addr,
                       char name[]);

int init_fun_yellow_1602(lcmclass lcdtype,
                         unsigned int addr);

unsigned int init_any_mi2c_4bit(lcd_mi2c_4bit *any_mi2c_4bit,
                                lcmclass lcdtype,
                                char name[]);

unsigned int init_any_ibo_i2c_4bit(lcd_ibo_i2c_4bit *any_ibo_i2c_4bit,
                                   lcmclass lcdtype,
                                   unsigned int addr,
                                   char name[]);

unsigned int init_any_dual_lcd(dual_lcd *any_dual_lcd,
                               unsigned int addr,
                               lcmclass lcdtypeA,
                               int rs_gpioA,
                               int e_gpioA,
                               lcmclass lcdtypeB,
                               int rs_gpioB,
                               int e_gpioB,
                               char name[]);

void init_current_gpio_4bit(lcd_gpio_4bit *any_gpio_4bit,
                            lcmclass lcdtype,
                            int rs_gpio,
                            int e_gpio,
                            int bl0_gpio,
                            int bl1_gpio,
                            int d4_gpio,
                            int d5_gpio,
                            int d6_gpio,
                            int d7_gpio,
                            char name[]);

unsigned int init_current_spi_4bit(lcd_spi_4bit *any_spi_4bit,
                                   lcmclass lcdtype,
                                   int e_gpio,
                                   unsigned int waddr,
                                   char spidev,
                                   char name[]);

void init_current_spi_4bitV2(lcd_spi_4bitV2 *any_spi_4bitV2,
                             lcmclass lcdtype,
                             int e_gpio,
                             char spidev,
                             char name[]);

void init_current_spi_8bit(lcd_spi_8bit *any_spi_8bit,
                           lcmclass lcdtype,
                           int rs_gpio,
                           int e_gpio,
                           int goe_gpio,
                           int scl_gpio,
                           char spidev,
                           char name[]);

void init_current_spi2p_8bit(glcd_spi2p_8bit *any_spi2p_8bit,
                             int rs_gpio,
                             int e_gpio,
                             int bl_gpio,
                             int goe_gpio,
                             int scl_gpio,
                             char spidev,
                             char name[]);

void echo_any_iface_8bit_status(lcd_iface_8bit *any_iface_8bit);

void echo_lcd_iface_8bit_status(lcd_iface_8bit iface);

void echo_any_fi2c_4bit_status(lcd_fi2c_4bit *fi2c);

void echo_any_mi2c_4bit_status(lcd_mi2c_4bit *mi2c);

void echo_any_ibo_i2c_4bit_status(lcd_ibo_i2c_4bit *ibo_i2c);

void echo_lcd_fi2c_4bit_status(lcd_fi2c_4bit fi2c);

void echo_any_dual_lcd_status(dual_lcd *any_dual_lcd);

void echo_any_gpio_4bit_status(lcd_gpio_4bit *any_gpio_4bit);

void echo_any_spi_4bit_status(lcd_spi_4bit *any_spi_4bit);

void echo_any_spi_4bitV2_status(lcd_spi_4bitV2 *any_spi_4bitV2);

void echo_any_spi_8bit_status(lcd_spi_8bit *any_spi_8bit);

void echo_any_spi2p_8bit_status(glcd_spi2p_8bit *any_spi2p_8bit);

led_disptools.h

/* Humble Pi LED matrix #defines etc. ... */
/* Based on 2 x MCP23008 I.C.'s           */
#define ALL_ROW_CATHODES_ON   0x00
#define ALL_ROW_CATHODES_OFF  0xff
#define ALL_COLUMN_ANODES_ON  0xff
#define ALL_COLUMN_ANODES_OFF 0x00

#define RC1_ON 0x7f
#define RC2_ON 0xbf
#define RC3_ON 0xdf
#define RC4_ON 0xef
#define RC5_ON 0xf7
#define RC6_ON 0xfb
#define RC7_ON 0xfd
#define RC8_ON 0xfe

#define CA1_ON 0x10
#define CA2_ON 0x20
#define CA3_ON 0x40
#define CA4_ON 0x80
#define CA5_ON 0x01
#define CA6_ON 0x02
#define CA7_ON 0x04
#define CA8_ON 0x08

/* LC Technology 2x4-Digit 74HC164 driven Display #defines etc. */
/* Chip#1 --> Segment + DP Cathodes                             */
/* Chip#2 --> Digit (Common) Anodes                             */
#define ALL_CSEGSDP_ON  0x00
#define ALL_CSEGSDP_OFF 0xff
#define CSEGA_OFF       0x01
#define CSEGB_OFF       0x02
#define CSEGC_OFF       0x04
#define CSEGD_OFF       0x08
#define CSEGE_OFF       0x10
#define CSEGF_OFF       0x20
#define CSEGG_OFF       0x40
#define CSEGDP_OFF      0x80
#define CSEGDP_ON       0x3f 
#define ALL_ADIGITS_ON  0xff
#define ALL_ADIGITS_OFF 0x00
#define ADIGIT_U1_ON    0x01
#define ADIGIT_U2_ON    0x02
#define ADIGIT_U3_ON    0x04
#define ADIGIT_U4_ON    0x08
#define ADIGIT_L1_ON    0x10
#define ADIGIT_L2_ON    0x20
#define ADIGIT_L3_ON    0x40
#define ADIGIT_L4_ON    0x80

typedef struct
{
  int poll;
  int data;
  int dcode;
} mxdigit; /* Multi-pleXed DIGIT */

typedef struct
{
  unsigned int poll;
  int data;
  unsigned int dcode;
} mxudigit; /* Multi-pleXed Unsigned DIGIT */

typedef struct
{
  unsigned int *poll;
  int *data;
  unsigned int *dcode;
  int ncascade;
} cmxudigit; /* Cascaded Multi-pleXed Unsigned DIGIT */

typedef struct
{
  unsigned int poll;
  int data;
  unsigned int dcode;
  unsigned int lgrmask;
} mxudigitlgr; /* Multi-pleXed Unsigned DIGIT + Ln/Red/Green mask */

/* Ensure globals only declared once ... */
/* Relies on NO_MAIN being defined in libraries */
#ifndef NO_MAIN
int codes7seg0[19]; /* 16 (hex) digits + All on/off + d.p. */
int codes7seg7[19]; /* 16 (hex) digits + All on/off + d.p. */
unsigned int codes7seg0a[19]; /* 16 (hex) digits + All on/off + d.p. */
unsigned int codes7seg7a[22]; /* 16 (hex) digits + All on/off + d.p. + L1-3 */
unsigned int lgrmask;
int cathode[10];
int cath4x7[6];
unsigned int anode4d[6];
unsigned int anode4dlgr[10];
unsigned int rowcath[10],colanode[10]; /* 8x8 LED matrix */
mxdigit sevenseg[8];
mxdigit four7seg[4];
mxudigit four7seg0a[4],ulfour7seg0a[8];
mxudigitlgr four7seglgra[8];
#else /* !NO_MAIN */
extern int codes7seg0[19]; /* 16 (hex) digits + All on/off + d.p. */
extern int codes7seg7[19]; /* 16 (hex) digits + All on/off + d.p. */
extern unsigned int codes7seg0a[19]; /* 16 (hex) digits + All on/off + d.p. */
extern unsigned int codes7seg7a[22]; /* 16 (hex) digits + All on/off + d.p. + L1-3 */
extern unsigned int lgrmask;
extern int cathode[10];
extern int cath4x7[6];
extern unsigned int anode4d[6];
extern unsigned int anode4dlgr[10];
extern unsigned int rowcath[10],colanode[10]; /* 8x8 LED matrix */
extern mxdigit sevenseg[8];
extern mxdigit four7seg[4];
extern mxudigit four7seg0a[4],ulfour7seg0a[8];
extern mxudigitlgr four7seglgra[8];
#endif /* !NO_MAIN */

void init_codes7seg0(void);
/* Common cathode LED display - Anode (high-level) hex codes */
/* Bit 0 1 2 3 4 5 6 7  */
/* Seg a b c d e f g DP */

void init_codes7seg0a(void);
/* Common anode LED display - Cathode (low-level) hex codes */
/* Bit 0 1 2 3 4 5 6 7  */
/* Seg a b c d e f g DP */

void init_codes7seg7(void);
/* Common cathode LED display - Anode (high-level) hex codes */
/* Bit 7 6 5 4 3 2 1 0  */
/* Seg a b c d e f g DP */

void init_codes7seg7a(void);
/* Common anode LED display - Cathode (low-level) hex codes */
/* Bit 7 6 5 4 3 2 1 0  */
/* Seg a b c d e f g DP */

void init_cathodes(void);
/* 8 digits from left to right */
/* Bit 0 1 2 3 4 5 6 7 */
/* Dgt 8 7 6 5 4 3 2 1 */

void init_cath4x7(void);
/* 4 digits from left to right */
/* Bit 4 5 6 7 */
/* Dgt 4 3 2 1 */


void init_anode4d(void);
/* 4 digits from left to right */
/* Bit 0 1 2 3 */
/* Dgt 4 3 2 1 */

void init_anode4dul(void);
/* 2 rows of 4 digits from left to right */

void init_anode4dlgr(void);
/* 4 digits from left to right + cLock indicators & Red|Green eXternal led */
/* Bit 7 6 5 4 3 - 2 1 */
/* Dgt 4 3 2 1 L - G R */

void init_8x8ledx(void);
/* multiplexed 8 X 8 LED matriX */

void init_sevenseg(void);

void init_four7seg(void);

void init_four7seg0a(void);

void init_ulfour7seg0a(void);

void init_four7seglgra(void);

int load_sevenseg_digit(int index,
                        int dpflag,
                        int value);
/* LOAD index'th SEGment DIGIT */
/* dpflag = 1 (TRUE) assigns Decimal Point */

int load_four7seg_digit(int index,
                        int dpflag,
                        int value);
/* LOAD index'th 4 x 7-SEGment DIGIT */
/* dpflag = 1 (TRUE) assigns Decimal Point */

int load_four7seg0a_digit(int index,
                          int dpflag,
                          int value);
/* LOAD index'th 4 x 7-SEGment (common Anode) DIGIT */
/* dpflag = 1 (TRUE) assigns Decimal Point */

int load_ulfour7seg0a_digit(int index,
                            int dpflag,
                            int value);
/* LOAD index'th 2 x 4 x 7-SEGment (common Anode) DIGIT */
/* Upper row indeces 0 - 3 */
/* Lower row indeces 4 - 7 */
/* dpflag = 1 (TRUE) assigns Decimal Point */

int load_four7seglgra_digit(int index,
                            int dpflag,
                            int value,
                            unsigned int lgrmask);
/* LOAD index'th 4 x 7-SEGment (common Anode) DIGIT|Ln|GRY */
/* dpflag = 1 (TRUE) assigns Decimal Point */
/* indexed poll value combined with lgrmask to control external G|R(|Y) led */

glcd_xbmtools.h

/* *.xbm (xpm) file parser ... */

#define XBM_FN_LEN (FN_LEN + 7) /* extra 7 chars. of "height" */
#define XPM_FN_LEN (FN_LEN + 3) /* +3 for "*[]"               */         

typedef enum
{
  CCOMMENT,    /* /*       */
  HASHDEFKEY,  /* #define  */
  STATICKEY,   /* static   */
  UNSIGNEDKEY, /* unsigned */
  CHARKEY,     /* char     */
  KEYDATA,
  /* Extra XPM keys ...    */
  XPMKEY,      /* XPM      */
  CLRKEY,      /* c        */
  /* XPM file "support codes" ... */
  XPMPIXEL8,   /* Pixel8   */
  XPMUDGC,     /* UDGC     */
  XPMNIU,      /* NotInUse */
  LAST_XBMKEY,
  XBMKEYTYPES
} xbmkeynames;

typedef struct
{
  int width;
  int height;
  char wname[XBM_FN_LEN];
  char hname[XBM_FN_LEN];
  char bname[XBM_FN_LEN];
} xbm_header;

typedef struct
{
  int width;
  int height;
  int colours;
  int charperpixel;
  char back;
  char fore;
  char cname[XPM_FN_LEN];
} xpm_header;

/* QC12864B GLCD using the  ST7920 controller ... */
#define QC12864B_width  128
#define QC12864B_height  64
#define QC12864B_nblocks  4
/* Each block is 128 x 16 pixels, stored end-to-end but   ... */
/* displayed top-to-bottom ie. (in character mode) line 1 ... */
/* wraps around into line 3 (and 2 to 4 likewise)             */
#define QC12864B_nbytes ((QC12864B_width / 8) * (QC12864B_height / QC12864B_nblocks))       
/* 8-pixel values stored per byte */
#define QC12864B_xbmbytes (QC12864B_nbytes * QC12864B_nblocks)

typedef struct
{
  unsigned char block11[QC12864B_nbytes];
  unsigned char block22[QC12864B_nbytes];
  unsigned char block13[QC12864B_nbytes];
  unsigned char block24[QC12864B_nbytes];
} qc12864b_pixel8;

#define QC12864B_udgcbits 16
#define QC12864B_udgcpixc (QC12864B_udgcbits * QC12864B_udgcbits)

typedef struct
{
  unsigned char cgram_addr;
  unsigned char hbyte_rows[QC12864B_udgcbits];
  unsigned char lbyte_rows[QC12864B_udgcbits];
} qc12864b_udgc;

/* Nokia 5110 84x48 GLCD using the PCD8544 controller ...                  */
/* NB: XPM images are rotated +90deg since the GLCD is column-based. */
#define PCD8544_column_width 48
#define PCD8544_row_height   84
#define PCD8544_nblocks       6
#define PCD8544_xpmpixc      (PCD8544_column_width * PCD8544_row_height)
/* Each column block is 8 x 84 pixels, in 8-bit rows stored  */
/* bottom-to-top then left-to-right (from the rotated image) */
typedef struct
{
  unsigned char rowblock0[PCD8544_row_height]; /* Bottom row ... */
  unsigned char rowblock1[PCD8544_row_height]; 
  unsigned char rowblock2[PCD8544_row_height];
  unsigned char rowblock3[PCD8544_row_height]; 
  unsigned char rowblock4[PCD8544_row_height];
  unsigned char rowblock5[PCD8544_row_height]; /* ... Top row    */ 
} pcd8544_colpix8;

/* Ensure globals only declared once ... */
/* Relies on NO_MAIN being defined in libraries */
#ifndef NO_MAIN
/* Useful strings ... */
char xbmblank[] = " ";
char xbmerror[] = "***ERROR*** ";
char xbmwarng[] = "**WARNING** "; 
xbmkeynames xbmwhat,xbmwhich,xpmtype;
char *xbmkeylist[XBMKEYTYPES];
char xbmfile[FN_LEN],xpmfile[FN_LEN];
char xbmfopen,xpmfopen;
char xbmfread,xpmfread;
char XbmError,XpmError;
FILE *xbmfn,*xpmfn;
xbm_header this_xbm_header;
xpm_header this_xpm_header;
qc12864b_pixel8 current_qc12864b_buffer;
qc12864b_udgc cgram0000,cgram0002,cgram0004,cgram0006;
pcd8544_colpix8 bbnokia5110_buffer,fsnokia5110_buffer,nokia5110v2_buffer,nokia5110HP3_buffer;
#else /* !NO_MAIN */
extern char xbmblank[];
extern char xbmerror[];
extern char xbmwarng[]; 
extern xbmkeynames xbmwhat,xbmwhich,xpmtype;
extern char *xbmkeylist[XBMKEYTYPES];
extern char xbmfile[],xpmfile[FN_LEN];
extern char xbmfopen,xpmfopen;
extern char xbmfread,xpmfread;
extern char XbmError,XpmError;
extern FILE *xbmfn,*xpmfn;
extern xbm_header this_xbm_header;
extern xpm_header this_xpm_header;
extern qc12864b_pixel8 current_qc12864b_buffer;
extern qc12864b_udgc cgram0000,cgram0002,cgram0004,cgram0006;
extern pcd8544_colpix8 bbnokia5110_buffer,fsnokia5110_buffer,nokia5110v2_buffer,nokia5110HP3_buffer;
#endif /* !NO_MAIN */

/* XBM data is "byte-bit-reversed       ... */
/* "Nibble Bit Reversal Look-Up Tables" ... */
static unsigned char right_nbrlut[] = {
  0x00, /* 0x00 */
  0x80, /* 0x01 */
  0x40, /* 0x02 */
  0xc0, /* 0x03 */
  0x20, /* 0x04 */
  0xa0, /* 0x05 */
  0x60, /* 0x06 */
  0xe0, /* 0x07 */
  0x10, /* 0x08 */
  0x90, /* 0x09 */
  0x50, /* 0x0a */
  0xd0, /* 0x0b */
  0x30, /* 0x0c */
  0xb0, /* 0x0d */
  0x70, /* 0x0e */
  0xf0, /* 0x0f */ };

static unsigned char left_nbrlut[] = {
  0x00, /* 0x00 */
  0x08, /* 0x10 */
  0x04, /* 0x20 */
  0x0c, /* 0x30 */
  0x02, /* 0x40 */
  0x0a, /* 0x50 */
  0x06, /* 0x60 */
  0x0e, /* 0x70 */
  0x01, /* 0x80 */
  0x09, /* 0x90 */
  0x05, /* 0xa0 */
  0x0d, /* 0xb0 */
  0x03, /* 0xc0 */
  0x0b, /* 0xd0 */
  0x07, /* 0xe0 */
  0x0f, /* 0xf0 */ };

/* Primitives */

void setupxbmkeys(void);

xbmkeynames whichxbmkey(char *xbmkeystr);

void listxbmkeys(void);

void Open_Xbm_File(void);

void Open_Xpm_File(char *mode);

void Close_Xbm_File(void);

void Close_Xpm_File(void);

void Xbm_Error(xbmkeynames error_key);

void Xpm_Error(xbmkeynames error_key);

void Read_Xbm_Header(char qv);
/* qv == Query Verbose flag */

void Read_Xpm_Header(char qv);
/* qv == Query Verbose flag */

void Read_Xpm_Header_Data(char qv);
/* qv == Query Verbose flag */

xbmkeynames Check_Xpm_Header(void);

unsigned char ReverseXbmByte(unsigned char xbmbyte);

int Read_Xbm_Pixel8_Data(qc12864b_pixel8 *buffer,
                         char qv);
/* qv == Query Verbose flag */

int Read_Xpm_Udgc_Data(qc12864b_udgc *buffer,
                       unsigned char cgram_addr,                        
                       char qv);
/* qv == Query Verbose flag */

int Read_Xpm_Colpix8_Data(pcd8544_colpix8 *buffer,
                          char qv);
/* qv == Query Verbose flag */

void clear_pixel_store(qc12864b_pixel8 *buffer);

void fill_pixel_store(qc12864b_pixel8 *buffer);

void init_pixel_store(qc12864b_pixel8 *buffer);

void echo_pixel_store_status(qc12864b_pixel8 *buffer);

void xbm_dump_pixel_store(qc12864b_pixel8 *buffer);

void xpm_dump_pixel_store(qc12864b_pixel8 *buffer);

void preset_cgram_store(qc12864b_udgc *buffer,
                        unsigned char cgram_addr,                       
                        unsigned char allrows_hbyte,
                        unsigned char allrows_lbyte);

void clear_colpix_store(pcd8544_colpix8 *buffer);

void fill_colpix_store(pcd8544_colpix8 *buffer);

void init_colpix_store(pcd8544_colpix8 *buffer);

void echo_colpix_store_status(pcd8544_colpix8 *buffer);

spi_PCD8544.h

#define PCD8544_POWERDOWN           0x04
#define PCD8544_ENTRYMODE           0x02
#define PCD8544_EXTENDEDINSTRUCTION 0x01

#define PCD8544_DISPLAYBLANK    0x00
#define PCD8544_DISPLAYNORMAL   0x04
#define PCD8544_DISPLAYALLON    0x01
#define PCD8544_DISPLAYINVERTED 0x05

/* H = 0 */
#define PCD8544_FUNCTIONSET    0x20
#define PCD8544_DISPLAYCONTROL 0x08
#define PCD8544_SETYADDR       0x40
#define PCD8544_SETXADDR       0x80

/* H = 1 */
#define PCD8544_SETTEMP 0x04
#define PCD8544_SETBIAS 0x10
#define PCD8544_SETVOP  0x80

/* keywords */
#define LSBFIRST  0
#define MSBFIRST  1

/* BackLight constants */
#define PCD8544_BL_NONE      -1 /* IE. No backlight Control */
#define PCD8544_BL_CC_NPN     1 /* Common Cathode or NPN transistor drive */
#define PCD8544_BL_CC_NPN_ON  1
#define PCD8544_BL_CC_NPN_OFF 0
#define PCD8544_BL_CA_PNP     0 /* Common Anode or PNP transistor drive */
#define PCD8544_BL_CA_PNP_ON  0
#define PCD8544_BL_CA_PNP_OFF 1

/* Ensure globals only declared once ... */
/* Relies on NO_MAIN being defined in libraries */
/* NB: unsigned char is == to arduino's uint8_t */
#ifndef NO_MAIN
/* LCD port variables (from PCD8544.c) */
unsigned char cursor_x, cursor_y, textsize, textcolor;
/* The memory buffer for the LCD (adapted PCD8544.c) */
unsigned char pcd8544_buffer[LCDWIDTH * LCDHEIGHT / 8];
#else /* !NO_MAIN */
/* LCD port variables (from PCD8544.c) */
extern unsigned char cursor_x, cursor_y, textsize, textcolor;
/* The memory buffer for the LCD (adapted PCD8544.c) */
extern unsigned char pcd8544_buffer[LCDWIDTH * LCDHEIGHT / 8];
#endif /* !NO_MAIN */

/* Prototypes */

void WP_FS_WriteCommandByte(pcd8544 *this_pcd8544,
                            char qx);

void WP_FS_WriteDataByte(pcd8544 *this_pcd8544,
                         char qx);

void WP_FS_ClearHome(pcd8544 *this_pcd8544, char qx);

void WP_FS_WriteFontDataBytes(pcd8544 *this_pcd8544,
                              unsigned int ascii_code,
                              char *this8x5font,
                              char qx);

void WP_FS_WriteGraphicsDataBytes(pcd8544 *this_pcd8544,
                                  pcd8544_colpix8 *this_colpix8,
                                  char qx);

void WP_FS_WriteMessage(pcd8544 *this_pcd8544,
                        char *this8x5font,
                        char qx,
                        char *message);

glcd_fonttools.h

/* Header file associated with GLCD FONT header file handling TOOLS structures etc. */

/* *font.h file parser ... */

#define NOTYETFONT      -1 /* order NOT YET known or defined */
#define CLONEFONT        0 /* CLONE input FONT order */
#define ROWCOLFONT       1 /* Height, Width */
#define COLROWFONT       2 /* Width, Height */
#define MAX_FONT_HEIGHT 16
#define MAX_FONT_WIDTH  16

typedef enum
{
  CCOMMENT,    /* /*         */
  STATICKEY,   /* static     */
  CONSTKEY,    /* const      */
  UNSIGNEDKEY, /* unsigned   */
  INTKEY,      /* int        */
  CHARKEY,     /* char       */
  CHRBRKSKEY,  /* []         */
  LBRACEKEY,   /* {          */
  RBRACESCKEY, /* };         */
  KEYDATA,     /* ***DATA*** */
  HEIGHTDKEY,  /* Height     */
  WIDTHDKEY,   /* Width      */
  LAST_FONTKEY,
  FONTKEYTYPES
} fontkeynames;


/* Ensure globals only declared once ... */
/* Relies on NO_MAIN being defined in libraries */
#ifndef NO_MAIN
/* Useful strings ... */
char fontblank[] = " ";
char fonterror[] = "***ERROR*** ";
char fontwarng[] = "**WARNING** ";
fontkeynames fontwhat,fontwhich,qfontkey;
char *fontkeylist[FONTKEYTYPES];
char fontInfile[FN_LEN],fontOutfile[FN_LEN];
char fontInfopen,fontOutfopen;
char fontfread;
char FontInError;
int  FontInHeight;
int  FontInOrder;
int  FontInWidth;
int  FontOutOrder;
FILE *fontInfn,*fontOutfn;
#else /* !NO_MAIN */
extern char fontblank[];
extern char fonterror[];
extern char fontwarng[];
extern fontkeynames fontwhat,fontwhich,qfontkey;
extern char *fontkeylist[FONTKEYTYPES];
extern char fontInfile[FN_LEN],fontOutfile[FN_LEN];
extern char fontInfopen,fontOutfopen;
extern char fontfread;
extern char FontInError;
extern int  FontInHeight;
extern int  FontInOrder;
extern int  FontInWidth;
extern int  FontOutOrder;
extern FILE *fontInfn,*fontOutfn;
#endif /* !NO_MAIN */

/* Primitives */

void setupfontkeys(void);

fontkeynames whichfontkey(char *fontkeystr);

void listfontkeys(void);

void Open_Font_In_File(void);

void Close_Font_In_File(void);

void Font_In_Error(fontkeynames error_key);

void Open_Font_Out_File(void);

void Close_Font_Out_File(void);

void Clone_Font_Header_Comments(char qv);
/* qv == Query Verbose flag */

char *get_stem_no_path(char filename[]);

void Regen_Font_HW(char qv);
/* Regen(erate) Font H(eight) & W(idth) */
/* qv == Query Verbose flag */

void RegenFontDefnHdr(char qv);
/* Regen(erate) Font Def(initio)n H(ea)d(e)r */
/* qv == Query Verbose flag */

void RegenLBrace(void);
/* Regen(erate) L(eft) Brace */

fontkeynames QueryCloneCharBlockComment(char qv);
/* QueryClone Char(acter) Block Comment ...
 * Returns fontkeyname of first non-blank line
 * qv == Query Verbose flag
 */

void LoadCharBlockData(unsigned int pixbyte[],
                       int index,
                       char qv);
/* Load Char(acter) Block Data ...
 * qv == Query Verbose flag
 */

unsigned int getPixBit(unsigned int pixbyte,
                       unsigned int mask);

void WriteCharBlockData(unsigned int pixbyte[],
                        int index);

void Append_Empty_Change_Log(char qv);
/* qv == Query Verbose flag */

Dump of the initial state of some 'C' structures

(Output of lcd_structures_list.c)

lcd_structures_list.c Version 0.06 {Exp}, [12/11/2016], (c) F_Trevor_Gowen
                <--| Package i2c_spi_chips_0.0 |-->
lcd_iface_8bit:
lcd iface_8bit status:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
RS GPIO 27
E  GPIO 22
EHMIN  204 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     3b
BSIZE   80
pcf8574 chip status:
ADDR    26
QIOP    ff
NAME    HD44780U

lcd_fi2c_4bit:
lcd fi2c_4bit status:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
EHMIN  612 uS
ELMIN  408 uS
ELMAX 1600 uS
WAIT   408 uS
NFB     28
BSIZE   80
pcf8574 chip status:
ADDR    27
QIOP    ff
NAME    HD44780U

lcd_mi2c_4bit:
lcd mi2c_4bit status:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
EHMIN  612 uS
ELMIN  408 uS
ELMAX 1600 uS
WAIT   408 uS
NFB     28
BSIZE   80
pcf8574 chip status:
ADDR    20
QIOP    ff
NAME    HD44780U

lcd_ibo_i2c_4bit:
lcd ibo_i2c_4bit status:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
EHMIN  612 uS
ELMIN  408 uS
ELMAX 1600 uS
WAIT   408 uS
NFB     28
BSIZE   80
pcf8574 chip status:
ADDR    3a
QIOP    ff
NAME    HD44780U

dual_lcd:
dual lcd status:
mcp23017 chip status:
ADDR     20
IOCON    0a
IODIRA   00
IODIRB   01
IPOLA    02
IPOLB    03
GPIOA    12
GPIOB    13
NAME     HD44780U
lcd A8bit:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
RS GPIO 22
E  GPIO 17
EHMIN  284 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     3b
BSIZE   80
lcd B4bit:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
RS GPIO 23
E  GPIO 18
EHMIN  852 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     28
BSIZE   80
B4DATA  00

lcd_spi_8bit:
lcd spi_8bit status:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
RS GPIO 22
E  GPIO 27
EHMIN   16 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     3b
BSIZE   80
gc74hc595 chip status:
SPI_DEV  /dev/spidev0.0
GOE GPIO 17
SCL GPIO 18
NAME     HD44780U

lcd_spi_4bit:
lcd spi_4bit status:
mcp23S08 chip status:
SPI_DEV /dev/spidev0.1
WADDR   40
IOCON   05
IODIR   00
IOPOL   01
GPIO    09
NAME    HD44780U
lcd S4bit:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
E  GPIO 22
EHMIN   48 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     28
BSIZE   80
S4DATA  00

lcd_spi_4bitV2:
lcd spi_4bitV2 status:
hw74hc595 chip status:
SPI_DEV  /dev/spidev0.0
NAME     HD44780U
lcd S4bit:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
E  GPIO 27
EHMIN   16 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     28
BSIZE   80
S4DATA  00

lcd_gpio_4bit:
lcd gpio_4bit status:
RS  GPIO 17
E   GPIO 18
BL0 GPIO 27
BL1 GPIO 22
D4  GPIO 23
D5  GPIO 24
D6  GPIO 25
D7  GPIO 04
NAME HD44780U
lcd G4bit:
TYPE     1
NC      16
NL       2
DDRAM[] 00 28 00 00
EHMIN    1 uS
ELMIN   41 uS
ELMAX 1600 uS
WAIT    41 uS
NFB     28
BSIZE   80
G4DATA  00

glcd_spi2p_8bit:
glcd spi2p_8bit status:
NC      16
NL       4
DDRAM[] 80 90 80 90
RS GPIO 25
E  GPIO 24
BL GPIO 23
EHMIN   16 uS
ELMIN   72 uS
ELMAX 1672 uS
WAIT    72 uS
gc74hc595 chip status:
SPI_DEV  /dev/spidev0.1
GOE GPIO 27
SCL GPIO 22
NAME     QC12864B/ST7920

i2c_ssd1306_oled:
i2c_ssd1306_oled status:
ADDR    3c
C0DC    00
CMDS    af
CMDD[0] 20
CMDD[1] 00
CMDT[0] 22
CMDT[1] 00
CMDT[2] 07
CMDM[0] 00
NAME    KEYES

glcd_spibl2:
glcd spibl2 status:
NC      16
NL       4
DDRAM[] 80 90 80 90
BL0 GPIO 04
BL1 GPIO 17
st7920sm chip status:
SPI_DEV /dev/spidev0.1
NAME    12864ZW/ST7920

Download a "Snapshot" tarball

NB: This may include current "work-in-progress" that is not yet documented here or in the README file!

Download i2c_spi_chips-0.0.tar.gz (2018-06-16 20:07:15, 389.3 KB)



2018-06-16 20:23