mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Workaround strict-aliasing warnings
See: https://travis-ci.org/felis/USB_Host_Shield_2.0/jobs/328511332 and 8a02ea67f5 (diff-6e1ff9551639ac89d99617863bf84e10)
This commit is contained in:
parent
a7f67cdfc6
commit
0fb3e504d2
1 changed files with 32 additions and 2 deletions
34
avrpins.h
34
avrpins.h
|
@ -1328,6 +1328,7 @@ MAKE_PIN(P13, 13); //
|
||||||
|
|
||||||
#elif defined(ESP8266) || defined(ESP32)
|
#elif defined(ESP8266) || defined(ESP32)
|
||||||
|
|
||||||
|
#define pgm_read_pointer(p) pgm_read_ptr(p)
|
||||||
|
|
||||||
#define MAKE_PIN(className, pin) \
|
#define MAKE_PIN(className, pin) \
|
||||||
class className { \
|
class className { \
|
||||||
|
@ -1351,8 +1352,6 @@ public: \
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
|
|
||||||
#define pgm_read_pointer(p) pgm_read_ptr(p)
|
|
||||||
|
|
||||||
// Pinout for ESP-12 module
|
// Pinout for ESP-12 module
|
||||||
// 0 .. 16 - Digital pins
|
// 0 .. 16 - Digital pins
|
||||||
// GPIO 6 to 11 and 16 are not usable in this library.
|
// GPIO 6 to 11 and 16 are not usable in this library.
|
||||||
|
@ -1370,6 +1369,37 @@ MAKE_PIN(P15, 15); // SS
|
||||||
|
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
|
|
||||||
|
// Workaround strict-aliasing warnings
|
||||||
|
#ifdef pgm_read_word
|
||||||
|
#undef pgm_read_word
|
||||||
|
#endif
|
||||||
|
#ifdef pgm_read_dword
|
||||||
|
#undef pgm_read_dword
|
||||||
|
#endif
|
||||||
|
#ifdef pgm_read_float
|
||||||
|
#undef pgm_read_float
|
||||||
|
#endif
|
||||||
|
#ifdef pgm_read_ptr
|
||||||
|
#undef pgm_read_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define pgm_read_word(addr) ({ \
|
||||||
|
typeof(addr) _addr = (addr); \
|
||||||
|
*(const unsigned short *)(_addr); \
|
||||||
|
})
|
||||||
|
#define pgm_read_dword(addr) ({ \
|
||||||
|
typeof(addr) _addr = (addr); \
|
||||||
|
*(const unsigned long *)(_addr); \
|
||||||
|
})
|
||||||
|
#define pgm_read_float(addr) ({ \
|
||||||
|
typeof(addr) _addr = (addr); \
|
||||||
|
*(const float *)(_addr); \
|
||||||
|
})
|
||||||
|
#define pgm_read_ptr(addr) ({ \
|
||||||
|
typeof(addr) _addr = (addr); \
|
||||||
|
*(void * const *)(_addr); \
|
||||||
|
})
|
||||||
|
|
||||||
// Pinout for ESP32 dev module
|
// Pinout for ESP32 dev module
|
||||||
|
|
||||||
MAKE_PIN(P0, 0);
|
MAKE_PIN(P0, 0);
|
||||||
|
|
Loading…
Reference in a new issue