6 #ifndef ACE_TIME_COMMON_FLASH_H 7 #define ACE_TIME_COMMON_FLASH_H 15 #define ACE_TIME_USE_PROGMEM 1 16 #if ACE_TIME_USE_PROGMEM 17 #define ACE_TIME_PROGMEM PROGMEM 19 #define ACE_TIME_PROGMEM 26 #include <avr/pgmspace.h> 27 #define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p)) 28 #define acetime_strcmp_P strcmp_P 29 #elif defined(TEENSYDUINO) 30 #include <avr/pgmspace.h> 31 #define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p)) 34 #define acetime_strcmp_P strcmp 35 #elif defined(ESP8266) 39 inline int acetime_strcmp_P(
const char* str1,
const char* str2P) {
40 return strcmp_P((str1), (str2P));
44 const char* strchr_P(
const char* s,
int c);
45 const char* strrchr_P(
const char* s,
int c);
53 #define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p)) 54 #define acetime_strcmp_P strcmp_P 57 const char* strchr_P(
const char* s,
int c);
58 const char* strrchr_P(
const char* s,
int c);
61 #elif defined(__linux__) or defined(__APPLE__) 63 #define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p)) 64 #define acetime_strcmp_P strcmp_P 66 #error Unsupported platform 73 inline int acetime_strcmp_PP(
const char* a,
const char* b) {
74 if (a == b) {
return 0; }
75 if (a ==
nullptr) {
return -1; }
76 if (b ==
nullptr) {
return 1; }
79 uint8_t ca = pgm_read_byte(a);
80 uint8_t cb = pgm_read_byte(b);
81 if (ca != cb)
return (
int) ca - (int) cb;
82 if (ca ==
'\0')
return 0;