Uh oh!
There was an error while loading. Please reload this page.
Allow variants to define an initVariant() function that is called at startup - #2139
Conversation
matthijskooijman
commented
Jun 25, 2014
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 |
matthijskooijman
commented
Jun 25, 2014
Ah, seems your pullreq is against master, while mine was against 1.5.x. That probably explains the difference? |
cmaglie
commented
Jun 25, 2014
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: https://github.com/arduino/Arduino/blob/ide-1.5.x/app/src/processing/app/debug/Compiler.java#L710 So, yes, all your assumptions are correct. |
matthijskooijman
commented
Jun 25, 2014
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. |
vicatcu
commented
Jun 26, 2014
@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? |
cmaglie
commented
Jun 27, 2014
Thanks for testing this out, I'll merge that before IDE release 1.5.7 and 1.0.6. |
matthijskooijman
commented
Jun 27, 2014
@cmagilie, Please also add the declaration of |
See arduino#2080 for more details.
cmaglie
commented
Jun 27, 2014
Here we go! |
matthijskooijman
commented
Jun 28, 2014
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