Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adafruit_GFX.h always needed #12

Open
warloofer opened this issue Jan 30, 2021 · 4 comments
Open

Adafruit_GFX.h always needed #12

warloofer opened this issue Jan 30, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@warloofer
Copy link

As far as I understand, Adafruit_GFX.h is needed for matrix display.
I'm trying to use only the segments display of the TM1620 (I have only put the #include TM1620 in the code), and the compiler is giving the error of Adafruit_GFX.h missing.

Why is the library required if it is not used? (as far as I know...)

Thanks in advance

@ev-olution
Copy link

ev-olution commented Jan 30, 2021

I was getting same error with TMS1640. Downloaded this library: https://github.com/adafruit/Adafruit-GFX-Library . And now I get another error: "C:......Adafruit-GFX-Library-master\Adafruit_GrayOLED.h:30:10: fatal error: Adafruit_I2CDevice.h: No such file or directory"

Not sure why these errors exist as these libraries are not used.

UPDATE:
I have downloaded this library: https://github.com/adafruit/Adafruit_BusIO . And added missing files from this downloaded zip file to "C:......Documents\Arduino\libraries\Adafruit-GFX-Library-master" directory. Now it compiles without any error messages. Still not sure why this was required...

@maxint-rd
Copy link
Owner

maxint-rd commented Jan 30, 2021

Hello, you raise a good point. Thanks!
At the moment I don't know how to dynamically skip including the part of the library that you don't need. As far as I can see the Arduino IDE first builds the library by compiling all cpp files in the folder. After that the sketch .ino is compiled.
I think a work around can be to delete the library files you don't need (TM16xxMatrixGFX.cpp and TM16xxMatrixGFX.h) or to rename them to .txt

The dependencies of the Adafruit GFX library has changed over the past years and now it indeed requires some other Adafruit support files. I think the reason is that they made their library more hardware-independent.

Edit: BTW. When linking the libraries and the sketch, the linker skips linking those parts that are not used, to keep your binary small and not use excess flah space. A library is often compiled just once to speed up subsequent builds, but as time of compiling the library it doesn't know which sections your sketch is using or not.

(See also first posts of this issue ).

@maxint-rd maxint-rd self-assigned this Jan 30, 2021
@maxint-rd maxint-rd added enhancement New feature or request question Further information is requested labels Jan 30, 2021
@ev-olution
Copy link

Thanks for your library! It works to me with a trick from my previous post. And your library is super helpful for my current project. I am using it to drive WINRISE HBS640 driver. Works perfectly with your TMS1640 library.

@maxint-rd
Copy link
Owner

maxint-rd commented Feb 21, 2021

Today I ran into a similar problem. When compiling for an ATtiny44A (using ATtinyCore), the latest version of Adafruit GFX along with Adafruit BusIO wouldn't compile due to some missing definition in the latter part. As my project didn't use any GFX functionality I removed the TM16xxMatrixGFX files to get TM16xx compiled without issue.

At the moment I think moving TM16xxMatrixGFX into a separate library might be a good solution to reduce dependencies and avoid compilation errors on MCU's that are not supported by Adafruit GFX. I think there are plenty of people that only use this library for 7-segment displays and don't use the dot-matrix functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants