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

Only include wiring_private.h if it exists (Arduino UNO R4 support) #89

Closed
wants to merge 5 commits into from

Conversation

KurtE
Copy link
Contributor

@KurtE KurtE commented Sep 2, 2023

Some of the new Arduino cores do not include this file. This includes the cores for the Arduino UNO Rev 4.

The change is limited to use the __has_include() preprocessor stuff be used to limit when arduino_private.h is included.

Two ways to fix this.

  1. add it specifically to a list of cores to not include it, like this file has #ifndef RASPI

Or use GCC __has_include to detect it and then include it. With Arduino this will not work well for library headers, as the library search stuff will not see this as a dependency and as such won't add the -I to command line to find it. But this file is in core which is always on the search path

I ran this modified version on the UNO R4 Minima with the graphictest example.

Some of the new Arduino cores do not include this file.  This includes the cores for the Arduino UNO Rev 4.

Two ways to fix this.
1) add it specifically to a list of cores to not include it, like this file has
#ifndef RASPI

Or use GCC __has_include to detect it and then include it.
With Arduino this will not work well for library headers, as the library search stuff will not see this as a dependency and as such won't add the -I to command line to find it.  But this file is in core which is always on the search path
Used the indention of this that GCC example showed to use...
@mpechner
Copy link

mpechner commented Sep 6, 2023

Do not want to causwe conflicts, but https://forum.arduino.cc/t/compilation-error-wiring-private-h-no-such-file-or-directory/1146752/2
Seems to have a more complete fix

#if defined(__has_include)
#if __has_include("wiring_private.h")
#include "wiring_private.h"
#endif  // __has_include("wiring_private.h")
#else  //defined(__has_include)
#include "wiring_private.h"
#endif  //defined(__has_include)

Then include it.

As suggested
@KurtE
Copy link
Contributor Author

KurtE commented Sep 7, 2023

Sounds good...
Pushed up change

Copy link

@mpechner mpechner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if defined __has_include. -> #if defined(__has_include)

@KurtE
Copy link
Contributor Author

KurtE commented Jul 15, 2024

Closing out detritus

@KurtE KurtE closed this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants