-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Allow variants to define an initVariant() function that is called at startup #2139
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
Conversation
Ok, this looks like it would work. I'd say the commit message is a bit brief, especially since it doesn't mention the changes to the compile process. I had to look realy closely to find out what was happening exactly - it seems there are some whitespace changes that blur the diff. Perhaps you could put the whitespace changes in a separate commit? In any case, I think your commit:
Because the variant source files are included in the build directly (not through However, I think that in my previous testing, source files in the variant directory were already included in the build somehow. Looking at #2080, I didn't change the compilation process, but I'm sure I tested this using a |
Ah, seems your pullreq is against master, while mine was against 1.5.x. That probably explains the difference? |
Hi @matthijskooijman, thanks for reviewing it and sorry about the white-spaces mess, I was a bit in a hurry when I made it. The patch is against master, IDE 1.5 already compiles files in variant folder, basically this is a backport to 1.0 of this part: So, yes, all your assumptions are correct. |
Ok, then the changes you present here look good to me (except for the whitespace mess ;-p) For 1.5, however, the variant files are included in the build through However, I did come across something else - since main.cpp is a C++ file, the If we declare Am I making any sense? I'll push the implementation of my proposal to #2080 in a minute. |
@cmaglie @matthijskooijman I can confirm this pull request works as expected for my board. I vote for a merge 👍. I tested it running Arduino from within Eclipse and using my board variant to blink the LED from within the initVariant function. I also confirmed that the presence of variant.h and variant.cpp in my variant folder is harmlessly ignored to my existing Arduino 1.0.5 installation. So when does this become part of what you can download from arduino.cc as a normal user? |
Thanks for testing this out, I'll merge that before IDE release 1.5.7 and 1.0.6. |
@cmagilie, Please also add the declaration of |
See arduino#2080 for more details.
Here we go! |
Looks good to me. |
Allow variants to define an initVariant() function that is called at startup
Following #2080, this is a way to allow "variants" to define an initVariant() function (in a file called pins_arduino.cpp for example).
/cc @matthijskooijman @vicatcu