-
-
Notifications
You must be signed in to change notification settings - Fork 49
Restrict ArduinoISP name collision fix to ArduinoCore-API 1.0.1 #24
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
Merged
facchinm
merged 1 commit into
arduino:main
from
per1234:arduinoisp-arduinocore-api-version
Nov 18, 2020
Merged
Restrict ArduinoISP name collision fix to ArduinoCore-API 1.0.1 #24
facchinm
merged 1 commit into
arduino:main
from
per1234:arduinoisp-arduinocore-api-version
Nov 18, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArduinoCore-API 1.0.1 declares a SPISettings class, but ArduinoCore-API 1.0.0 and 1.1.0 don't do this, so the previous preprocessor conditional that was added to fix the ArduinoCore-API sketch for platforms using ArduinoCore-API 1.0.1 actually breaks it for platforms using previous or later versions.
per1234
referenced
this pull request
Nov 18, 2020
...bitbanged SPI mode for board using ArduinoCore-API When using bit banged SPI, which the sketch did when compiled for any architecture other than AVR, a `SPISettings` class was declared by the sketch. At the time the sketch was written, it was reasonable to expect this would not cause a name collision, since SPI.h is not `#include`d when doing bit banged SPI. However, since then a `SPISettings` class has been declared in [ArduinoCore-API's HardwareSPI.h](https://github.com/arduino/ArduinoCore-API/blob/932c7c7d4d4d334b10484284cc846672ad59607c/api/HardwareSPI.h#L37), causing the ArduinoISP sketch to not compile for any board whose core uses ArduinoCoreAPI (currently Arduino Mega AVR Boards, "Arduino nRF528x Boards (Mbed OS]", and "Arduino Mbed OS Boards (nRF52840 / STM32H747)"): ``` /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:191:27: error: reference to 'SPISettings' is ambiguous void beginTransaction(SPISettings settings) { ^~~~~~~~~~~ /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:167:7: note: candidates are: class SPISettings class SPISettings { ^~~~~~~~~~~ In file included from /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/ArduinoAPI.h:31:0, from /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/Arduino.h:23, from /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:39: /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/HardwareSPI.h:37:7: note: class arduino::SPISettings class SPISettings { ^~~~~~~~~~~ ``` The fix is to use the `ARDUINO_API_VERSION` macro defined by ArduinoCore-API to detect when it is in use and make the bitbanged SPI code use the `SPISettings` class from ArduinoCore-API in this case.
facchinm
facchinm
approved these changes
Nov 18, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
ArduinoCore-API 1.0.1 declares a
SPISettings
class:https://github.com/arduino/ArduinoCore-API/blob/7c9e4f8abde3ce75234e51c0e5be3083832c3e49/api/ArduinoAPI.h#L31
but ArduinoCore-API 1.0.0 and 1.1.0 don't do this:
So the previous preprocessor conditional that was added to fix the ArduinoISP sketch for platforms using ArduinoCore-API 1.0.1 actually breaks it for platforms using previous or later versions.
Reference: b94e757#r44269343