joan wrote:Just for the record you could have used i2cWriteDevice instead. The buffer would have needed to have 15 bytes instead of 14 with the first byte being the register (0x01).
In effect that would be
S Addr Wr [A] Data [A] Data [A] ... [A] Data [A] P
with the first Data byte being Comm.
Had you not pointed me to
i2cWriteI2CBlockData that's what I was thinking of trying. Given that the backpack and OLED controller don't really have a "register byte" following the address, in some ways it may be better (or less confusing) to use
i2cWriteDevice (or a wrapped version thereof) directly rather than a function that emulates (and is similarly named as)
i2cset -y 1 ... i.
Slightly off-topic, but still a pigpio related issue: I use GNU autotools methods to build my codes and, unfortunately, whilst I can test for
pigpio.h with an appropriate
configure.ac entry such as:
Code: Select all
# 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_CHECK_LIB([pigpio], [i2cWriteByteData])
#AC_SEARCH_LIBS([i2cWriteByteData], [pigpio])
# 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
neither of the
AC_CHECK_LIB or
AC_SEARCH_LIBS mechanisms (commented out above) detect the presence of the pigpio library successfully and thus the
-lpigpio linker directive is not automatically appended to the LIBS variable of my makefile etc. My current workaround is to add a direct reference in the src directories
makefile.am:
Code: Select all
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 /usr/local/lib/libpigpio.a
which means that everything builds but that means that the code will no longer build (without the pigpio-based functionallity) if I move to another Pi on which pigpio has not installed without a re-edit of the
makefile.am file. I'm not sure why the detection mechanism fails, unless it's something to do with pigpio's library type or permissions:
Code: Select all
pi@raspibplus16Gb ~/i2c_spi_chips-0.0/src $ ls -laF /usr/local/lib/
total 364
drwxr-sr-x 5 root staff 4096 Apr 23 21:10 ./
drwxrwsr-x 10 root staff 4096 Jan 1 1970 ../
-rw-r--r-- 1 root staff 211386 Apr 23 21:10 libpigpio.a
-rw-r--r-- 1 root staff 62512 Apr 23 21:10 libpigpiod_if.a
lrwxrwxrwx 1 root staff 21 Jul 18 2014 libwiringPiDev.so -> libwiringPiDev.so.2.0*
-rwxr-xr-x 1 root staff 23229 Jul 18 2014 libwiringPiDev.so.2.0*
lrwxrwxrwx 1 root staff 18 Jul 18 2014 libwiringPi.so -> libwiringPi.so.2.0*
-rwxr-xr-x 1 root staff 47965 Jul 18 2014 libwiringPi.so.2.0*
drwxrwsr-x 4 root staff 4096 Jan 1 1970 python2.7/
drwxrwsr-x 3 root staff 4096 Jan 1 1970 python3.2/
drwxr-sr-x 3 root staff 4096 Jan 1 1970 site_ruby/
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm