I am currently using a 128x64 graphics LCD that has a PCF8567 interface IC. my code is based on the excellent U8G2 library from Oli Kraus, and I'm operating in 4W Software serial mode. My controller is a Teensy 4.0.
Instead of connecting directly to the controller, I would instead like to use a PCF8574 IO expander.
To test the SW Serial, I am connecting the Teensy as Serial In (SDI) = 0, Serial clock (SCK) = 1, Data/Command (DC) = 2, Chip Select (CS) = 3, Reset (RS) = 4. That way I am definitely not using any of the hardware SPI. I am then passing those pin numbers to the libary constructor.
My thinking is that I could set up an expander with multiIoAddExpander(multiIo, ioFrom8574(0x20), 10); with the range starting at 100 as per your example. I then pass the abstracted pin numbers to the constructor SDI = 100, SCK = 101, DDC = 102, CS = 103, RS = 104.
This all seems logical, but the points where I am stuck are:
1. The multiIO example explicitly declares the data direction for the pins, but this is not exposed to me in the graphics library, so would the library be able to set up the data direction?
2. How do I get the Abstracted pins to update?
I'm thinking that you must have already solved these for your two line LCD, so might have some suggestions.
I'm not fixed on using the u8g2 library, and the adafruit GFX would be fine if that is more of a known quantity?
|