TM1637Display.h inverted outputs needed

The TM1637Display.h is a library for use with 4 digit 7-segment displays using the TM1637 chip. An I2C-like signal is used although it is not compatible with I2C protocol; the module input uses a clock and a data signal, driven by a library.

My issue is that I need the library outputs to be inverted because I use an experimental MCU module where the outputs are open drain, so reversing the signal on the output from what the corresponding MCU output is.
I could use an open collector or open drain separate transistor or mosfet to obtain this but I prefer a software solution because it is cheaper and faster.

So, my question: how do I get this library (GitHub - bremme/arduino-tm1637: Arduino library for using a 4 digit seven segment display with TM1636 or TM1637 driver IC) to output its data to DIO and CLK in an inverted fashion?

Delta_G:
Look through the code in the library. Anywhere you find they write a pin HIGH, change it to LOW. Anywhere they write a pin LOW, change it to HIGH.

Am I missing something here?

No you are not missing anything; but is there a means to have this inverting done automatically, say like setting a flag or a optional input when configuring this library?

Can you indicate where in this library CLK and DIO must be changed to get inverted outputs?
Help is surely appreciated, I am not familiar with library writing.

TM1637Display.h (5.35 KB)

If it were that simple for me I wouldn't ask the question.

For starters the .h file does not contain digitalWrite();
Next, the library seems to imply that the clock pulses do come from the TM1637, and that the DIO is alternating between input and output.
Next, the write signals to the chip occur when the clock pulse is low, yet the state of DIO alternates between input and output (see the .cpp file annexed)

So, is there a way to automate the program by adding a library configuration setting so that a choice can be made between inverted or non-inverted output for DIO, while keeping a functional use for the CLK (when configured as output: invert, wen configured as input keep signal polarity)?

Yet to me it seems that the CLK signal needs to be connected directly to an MCU pin (for this library and .cpp file): if, as in my case,there is an open drain mosfet in between MCU and connector, this experimental board hardware setup may not allow this?

TM1637Display.cpp (5.28 KB)

TM1637Display.h (5.35 KB)

It is changing from INPUT to OUTPUT because it is emulating an open-drain (open collector? It has been a long day) output. They set the pin to an INPUT to let an external resistor pull it HIGH, and set it to an OUTPUT(which is already LOW) to pull the output LOW.
To do what you want to do, reverse the pinMode() calls to the CLK and DIO.

Delta_G:
No kidding. You asked. I answered. I told you what to do. I made it easy. If you aren't capable of opening those files in a text editor and searching for the digitalWrite commands then you should find a new hobby. Programming will be way too hard for you.

Open the .cpp files one at a time in wordpad. Press Control-F. That will open up a search. Type in the little window "digitalWrite" and press search. It will find all the digitalWrite lines. It isn't hard at all. It just takes a little effort. Just give it a try for pete's sake and then let us know if it doesn't work. But don't act like you're so helpless you can't search a text document.

Delete. Ignore. :grin: .

Both of you should go back and read Reply #7.