Hi Forum :-)
i am writing a library ( the idea was to extract some code i will use in the next and some other projects too...)
the functionality is finished in the current project - so it is just the task to extract it into a external library.
I have read the LibraryTutorial
as a starting point. (Its really cool! easy understanding!)
So in the original project the function accessed lots of global variables. So my Idea was to pack them in a struct.
But hm - not so easy^^
i have tried with something like:
this definition is written in the header file of the lib.
word wLevel_Min = 0;
word wLevel_Max = 65535;
word wStep_Up = 1;
word wStep_Down = 1;
word wDelay_Up = 1;
word wDelay_Down = 1;
typedef struct someValues svXXX;
if i try to compile my test / example sketch he throws some errors:
test.h:38: error: ISO C++ forbids initialization of member 'wLevel_Min'
test.h:38: error: making 'wLevel_Min' static
test.h:38: error: ISO C++ forbids in-class initialization of non-const static member 'wLevel_Min'
if i am interpreting this right - i am not able to initialize my struct to standard values?
in the example sketch i have something like:
* Values for a Testing Thing
const svXXX someNiceNameing;
someNiceNameing.wLevel_Min = 0;
someNiceNameing.wLevel_Max = 65535;
someNiceNameing.wStep_Up = 1;
someNiceNameing.wStep_Down = 1;
someNiceNameing.wDelay_Up = 5;
someNiceNameing.wDelay_Down = 15;
is this the right idea or iam on the absolut wrong way with the hole struct?