Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pgm_read_ptr(): 'const void*' is not a pointer-to-object type #864

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is not used. Maybe at some point in the past it was needed, but the latest versions of the ESP* cores have their own definitions

  • ESP8266 uses pgmspace.h defined in the arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.4-gcc10.3-1757bed\xtensa-lx106-elf\include\sys\
    However, the definition doesn't match the definition in ArduinoCore-API without explicitly defining
    #define PGM_READ_UNALIGNED 0
    Otherwise it uses the old definition seen here.
  • ESP32 uses pgmspace.h defined in Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32\ which matches the ArduinoCore-API definition.

#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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is need to satisfy the changes in arduino/ArduinoCore-API#118

I suspect that this is the problem shown in bblanchon/ArduinoJson#1790, but the line/column numbers don't match.

Ultimately, this should affect any board wrapping the mbed framework (which is most of the newer boards that Arduino has produced).

#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_