[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 

This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

4W Serial Graphics display with PCF8574 RSS feed
Forum Index » IoAbstraction & TaskManagerIO
Author Message

Joined: Aug 8, 2022
Messages: 1
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?

Joined: Jan 19, 2019
Messages: 686
Hi there, sounds like an interesting project

For pin direction, how does it work for normal SW pins. I’d maybe see how that works with U8G2 now. At the end of the day you could set that upfront.

For IO expander devices you need to call runLopp or use the helper functions ending with S. They sync with the device too. That’s done to improve performance

I’m writing from my phone so I’ll keep each reply short.

Joined: Jan 19, 2019
Messages: 686
U8G2 should be fine for this, I would imagine implementing the two callbacks for data and pin setup should be all that’s needed. I implement the data callback in tcMenu to prevent slow i2c from hampering menu performance.

See https://github.com/davetcc/tcMenu/blob/master/xmlPlugins/core-display/u8g2Driver/tcMenuU8g2.cpp#L30
Forum Index » IoAbstraction & TaskManagerIO
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.