X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Fpgm.h;h=ea28043e98587cdf166bffec5c81844cecff752c;hb=9f6832426387c3730bf2c9b6202db9eb8d159f42;hp=d8ef9f5426df09b5996b9c0c0ce64a7cf70d762c;hpb=64969cdb6b48f50b642178779baf9e1e317e0645;p=bertos.git diff --git a/mware/pgm.h b/mware/pgm.h index d8ef9f54..ea28043e 100755 --- a/mware/pgm.h +++ b/mware/pgm.h @@ -22,7 +22,8 @@ #ifndef MWARE_PGM_H #define MWARE_PGM_H -#include +#include +#include /* For intXX_t */ #if CPU_AVR @@ -135,8 +136,12 @@ #endif + #ifndef PROGMEM #define PROGMEM __attribute__((__progmem__)) + #endif + #ifndef PSTR #define PSTR(s) ({ static const char __c[] PROGMEM = (s); &__c[0]; }) + #endif #elif CPU_HARVARD #error Missing CPU support @@ -164,9 +169,7 @@ typedef PROGMEM uint32_t pgm_uint32_t; /*\}*/ /*! - * \def PGM_READ_CHAR - * \def PGM_FUNC - * \def PGM_ATTR + * \name PGM support macros. * * These macros enable dual compilation of code for both program * and data memory. @@ -193,16 +196,21 @@ typedef PROGMEM uint32_t pgm_uint32_t; * // To be used when invoking inside other PGM_FUNC functions: * PGM_FUNC(lcd_puts)(some_string); * \endcode + * + * \{ */ #ifdef _PROGMEM #define PGM_READ_CHAR(s) pgm_read_char(s) #define PGM_FUNC(x) x ## _P + #define PGM_STR(x) PSTR(x) #define PGM_ATTR PROGMEM #else #define PGM_READ_CHAR(s) (*(s)) #define PGM_FUNC(x) x + #define PGM_STR(x) x #define PGM_ATTR /* nothing */ #endif +/* \} */ #endif /* MWARE_PGM_H */