nRF24 / RF24

OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
https://nrf24.github.io/RF24
GNU General Public License v2.0
2.2k stars 1.01k forks source link

Error compiling version 1.3.7 and later on Nano 33 BLE Sense due to pgmspace.h inclusion #617

Closed underseeg closed 3 years ago

underseeg commented 3 years ago

Since commit https://github.com/nRF24/RF24/commit/5d6a02af52d0bf4e9a9baabb8fe22a4db43b4030 I am unable to compile the RF24 library against the Nano 33 BLE Sense.

Versions:

Arduino nRF528x Boards (Mbed OS) 1.1.6
RF24 1.3.8

Code:

#include <RF24.h>

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Error:

In file included from E:\CJ\Sources\Arduino\libraries\RF24/RF24.h:18:0,
                 from E:\CJ\Sources\Arduino\testsketch_deleteme\testsketch_deleteme.ino:1:
E:\CJ\Sources\Arduino\libraries\RF24/RF24_config.h:147:20: fatal error: avr/pgmspace.h: No such file or directory
           #include <avr/pgmspace.h>
                    ^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Nano 33 BLE.
TMRh20 commented 3 years ago

This file can be copied into E:\CJ\Sources\Arduino\libraries\RF24\ https://gist.github.com/TMRh20/e219622cf0b6016802a90156b8a0588d It tests ok and compiles fine on all the boards I have installed in the IDE.

Changes are as follows, you can also edit RF24_config.h manually: https://gist.github.com/TMRh20/e219622cf0b6016802a90156b8a0588d#file-rf24_config-h-L147 https://gist.github.com/TMRh20/e219622cf0b6016802a90156b8a0588d#file-rf24_config-h-L173

Could have sworn I tested this, guess not. This one is kind of odd, avr/pgmspace.h is there in the API core, ( AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.1.6\cores\arduino/api/deprecated-avr-comp/avr/pgmspace.h) and it seems that pgm_read_ptr is broken for mbed, so that needed to be redefined. The changes exclude pgmspace.h and redefine pgm_read_ptr for mbed devices.

Please let me know if this works, if so I guess I'll need to make a new release quickly to correct this.

underseeg commented 3 years ago

This compiles just fine, thanks for the quick response.

I noticed pgmspace.h was present, although I've no idea how the include directories hang together in Arduino.

TMRh20 commented 3 years ago

https://github.com/nRF24/RF24/commit/c0440e0b7fc425d1c0b9819c9f9bfeac731ec069