I'm trying to put together an implementation of the liquidcrystal library which can use digitalWriteFast and this will be switched in the library via a define in the sketch.
Unfortunately the pre-processor won't pick up the #define in the sketch =(
Has anyone worked out how to use a define in the sketch?
#define statements are pre-processed, before the compiler gets called. They are local to the compilation unit. You can't use a #define from one compilation unit in another one.
Taking that on board I can think of a few workarounds with includes but that wont work within the Arduino environment.
Like if the build process' transformation could be configured to insert an include for a predefined header file which resides in the sketch directory into the libraries before the preprocessor runs.
Not going to happen, i think.
Or is there some means to affect the build transformation?