-
Notifications
You must be signed in to change notification settings - Fork 119
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
PINS_COUNT is useless and inconsistent. #268
Comments
thanks, please submit a PR for fixed pins if you care about it |
Sigh. Do y'all have a recommended procedure for pulling a "core", editing it, and actually testing the new code? Since the core doesn't include the rest of the IDE, manual testing, and there's (maybe?) and api directory to worry about, live testing seems harder than I'd hoped. Do you mind if I don't do it the same way that Arduino did it? Do you ever merge the Arduino samd core edits into the adafruit core? Should I change the "arduino" variants in the adafruit core, or leave them? BTW, the motivation for this is: https://github.com/WestfW/Duino-hacks/tree/master/SAMD_Explorer - a sketch/function/eventually-library for examining SAMD internal state for debugging and educational purposes... |
you can git fork this repo in to ~/Arduino/libraries/hardware/Adafruit folder and it will appear in the boards dropdown as "In Sketchbook" |
@WestfW I've also written a library to dump the device configuration, I just iterated over I've noticed that Arduino (well, Wiring) provides a clean interface for beginners/hobbyists, but the "deeper" API doesn't seem to be too well thought out for "intermediate" developers, folks writing libraries, etc. (I see a lot of libraries fall back to custom written bitbanging if they don't have access to hardware SPI, for example.) That might just be something we're stuck with for historical reasons. Also on embedded devices there's not a lot of overhead for a bunch of layers of abstraction. |
…ns defined in the g_APinDescription[] array. adafruit#268
in the variants.h file, PINS_COUNT says it should be the number of pins in the array:
However, this rarely true, with the advent of internal pins, semi-internal pins, aliases for pins, and so on. This makes PINS_COUNT useless for error-checking a passed value in library code (for example.)
Worse, the meaning seems to vary from board to board, even when the boards are supposed to be somewhat compatible WRT pin numbering...
Also, nothing in the core actually USES PINS_COUNT
(hey! I think the GCM4 is "correct"!)
This was fixed recently (well, relatively recently) in the arduino samd core:
arduino@a536cc8#diff-d93fff30801193a3f0511f85af4a2c56ad1056e133224838d32a171497f2af47
I don't particularly LIKE the way they did it (who needs a function when this could just be an int in variant.cpp, for example), but the adafruit SAMD cores ought to do something...
The text was updated successfully, but these errors were encountered: