I am trying to use the NRF24L01+ radio transceiver with the Portenta C33. I have been successful with other devices but I can't get the sketch to compile for C33 when including the RF24 library. When omitting #include <RF24.h> the sketch compiles successfully. This is the only error I get when including the library:
In file included from C:\Users\Seth\Documents\Arduino\libraries\RF24\RF24.cpp:9:0:
C:\Users\Seth\Documents\Arduino\libraries\RF24\nRF24L01.h:36:21: error: expected unqualified-id before numeric constant
#define CD 0x09
^
c:\users\seth\appdata\local\arduino15\packages\arduino\hardware\renesas_portenta\1.1.0\variants\portenta_c33\includes\ra\fsp\src\bsp\cmsis\device\renesas\include\R7FA6M5BH.h:6456:28: note: in expansion of macro 'CD'
__IOM uint32_t CD : 1; /*!< [9..9] Late Collision Detect Flag */
^~
exit status 1
Its a little over my head. Does anyone know how to fix it?
Hi @8751. Unfortunately the developer of the RF24 library chose a fairly generic name for the CD macro. That resulted in a name collision with an unrelated use of that name inside the "Renesas FSP" framework used by the "Arduino Renesas Portenta Boards" platform of the Portenta C33.
The solution is to change the library code to use a unique name. I'll provide instructions you can follow to do that:
Open the file at the following path in any text editor: