I am creating software for the Linux + AVR Arduino project. Obviously, all the work is divided into several projects in Eclipse (I do not use the Arduino IDE). I would like to use common, mostly string, constants for all these projects. I also have to save the microcontroller from RAM, so compilation constants are needed. What is the best way to implement this? My idea is to create a separate, header-only project for these constants.
Using:
class A { public: static const char * const STRING; static const unsigned char BOOL; };
not good enough because I would like to concatenate string constants as follows:
class A { public: static const char * const STRING_PART1; static const char * const STRING_PART2; static const unsigned char BOOL; }; const char * const A::STRING_PART1 = "PART1_";
I also do not want to use define
. I would like to use:
class A { public: static const std::string STRING_PART1; static const std::string STRING_PART2; }
which allows string concatenation and is (AFAIK) compilation, but std :: string is not available in avr projects - or I'm wrong here and just donβt know how to use it.
Any help was appreciated.
source share