Skip to content

Commit

Permalink
Fix pgm_read_ptr() (fixes bblanchon/ArduinoJson#1790) (#864)
Browse files Browse the repository at this point in the history
Calling this macro caused the following error: 'const void*' is not a pointer-to-object type when defined by another library (in this instance ArduinoJSON)

see bblanchon/ArduinoJson/#1790
  • Loading branch information
bblanchon committed Sep 6, 2022
1 parent 9850c05 commit 0bb5af4
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions RF24_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ extern HardwareSPI SPI;
#include <pgmspace.h>
#define PRIPSTR "%s"
#ifndef pgm_read_ptr
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))
#endif
#elif defined(ARDUINO) && !defined(ESP_PLATFORM) && !defined(__arm__) && !defined(__ARDUINO_X86__) || defined(XMEGA)
#include <avr/pgmspace.h>
Expand Down Expand Up @@ -208,7 +208,7 @@ typedef uint16_t prog_uint16_t;
#define pgm_read_word(p) (*(p))
#endif
#if !defined pgm_read_ptr || defined ARDUINO_ARCH_MBED
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))
#endif
#ifndef PRIPSTR
#define PRIPSTR "%s"
Expand Down
2 changes: 1 addition & 1 deletion utility/LittleWire/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern LittleWireSPI _SPI;
#define _BV(x) (1 << (x))
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

//typedef uint16_t prog_uint16_t;
#define PSTR(x) (x)
Expand Down
2 changes: 1 addition & 1 deletion utility/MRAA/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define _BV(x) (1 << (x))
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))
#define _SPI spi

#define RF24_LINUX
Expand Down
2 changes: 1 addition & 1 deletion utility/RPi/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define _BV(x) (1 << (x))
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

//typedef uint16_t prog_uint16_t;
#define PSTR(x) (x)
Expand Down
2 changes: 1 addition & 1 deletion utility/SPIDEV/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef uint16_t prog_uint16_t;
#define pgm_read_word(p) (*(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

// Function, constant map as a result of migrating from Arduino
#define LOW GPIO::OUTPUT_LOW
Expand Down
2 changes: 1 addition & 1 deletion utility/pigpio/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef uint16_t prog_uint16_t;
#define pgm_read_word(p) (*(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

// Function, constant map as a result of migrating from Arduino
#define LOW GPIO::OUTPUT_LOW
Expand Down
2 changes: 1 addition & 1 deletion utility/rp2/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef uint16_t prog_uint16_t;
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))

#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

// Function, constant map as a result of migrating from Arduino
#define LOW GPIO::OUTPUT_LOW
Expand Down
2 changes: 1 addition & 1 deletion utility/wiringPi/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ typedef uint16_t prog_uint16_t;
#define pgm_read_word(p) (*(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_ptr(p) (*(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

#endif // RF24_UTILITY_WIRINGPI_RF24_ARCH_CONFIG_H_

0 comments on commit 0bb5af4

Please sign in to comment.