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

Disable pin checks if no platform support #29

Merged
merged 2 commits into from
Jan 25, 2024
Merged

Disable pin checks if no platform support #29

merged 2 commits into from
Jan 25, 2024

Conversation

dmadison
Copy link
Owner

If a platform doesn't support checking if a given pin supports interrupts (using the NOT_AN_INTERRUPT define), disable the code snippets which check if a pin supports interrupts. Since we cannot tell which pins support interrupts, this also disables the pin-change interrupt feature on those platforms.

This should fix compilation issues on some platforms.

See issue #28 for reference.

Some platforms don't define this macro, so we can define it for ourselves.
The library won't compile on Arduino platforms that do not define the `NOT_AN_INTERRUPT` macro. This macro is used by the library to evaluate whether a pin is supported for interrupts.

The previous fix (e7e5845) defines this macro if it's missing, with the assumption that all pins on the platform support interrupts. That didn't solve the issue with the renesas platform (#28) however, as the `digitalPinToInterrupt()` function is a passthrough and not a compile-time constant. That fails the `static_assert()` check.

Instead, this patch adds a bypass. If `NOT_AN_INTERRUPT` is not defined, all code that uses the `digitalPinToInterrupt()` function and the `NOT_AN_INTERRUPT` flag is disabled. There won't be any compile-time or run-time checks for whether the pin is supported or not, but there's nothing we can do about that if the platform doesn't support the feature.
@dmadison dmadison merged commit 5fa1d59 into master Jan 25, 2024
6 checks passed
@dmadison dmadison deleted the renesas branch January 25, 2024 15:39
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.

1 participant