-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
reducing arch specific #ifdefs in Firmata lib with better alignment across variant files #1030
Comments
It probably makes sense to provide the equivalent of IS_PIN_ANALOG(), On Sat, Oct 12, 2013 at 4:29 PM, Jeff Hoefs notifications@git.luolix.topwrote:
|
Just pushed a bunch of commits that adds LED_BUILTIN to all the arduino variants: arduino/Arduino@8e3da56 C |
This is related to #985 The first step should be to document what is the standardized interface of a boards platform in the specification, then to make sure all the official platforms are compliant with the specification. |
A few weeks ago in a discussion on the arduino dev mailing list, David Mellis asked if I could look into what it would take to reduce the number of architecture specific #ifdefs in the Firmata library (in the Boards.h file).
Here's an example from Boards.h so it's clear what I'm talking about (there are definitions like this for multiple architectures):
I can update IS_PIN_I2C(p) to use SDA and SCL for all variants. I can also up remove TOTLAL_ANALOG_PINS and TOTAL_PINS and use NUM_DIGITAL_PINS and NUM_ANALOG_PINS instead for all variants.
However there are some macros and constants that are not available across all arduino variant pins_arduino.h files:
The following macros and constants need to be added to the leonardo, robot_control, robot_motor and due variants (micro and yun would get this functionality as well since they simply import the leonardo variant):
analogInputToDigitalPin(p) ... digitalPinHasPWM(p) ... LED_BUILTIN
However in order to eliminate all architecture specific #ifdefs in Firmata/Boards.h for those boards that are defined in the arduino variants directory, I'd also have to figure out how to support the following macros (defined in Boards.h):
I'm not sure if any other Arduino core libraries would benefit from these macros. If there is no use for them outside of Firmata, then it's probably better to keep the #ifdefs in Firmata/Boards.h. I can at least incorporate the new constants and macros as they're added to the variants.
The text was updated successfully, but these errors were encountered: