Hi world101
To make this modification, I determined the speed of the M5Stack by making a program with:
Serial.println (F_CPU)which gave 24000000
Then, I modified the file ..\libraries\RF24-master\RF24.cpp by adding these lines (who have // For M5Stack Gray as a remark)
#if !defined(SOFTSPI) _SPI.setBitOrder(MSBFIRST); _SPI.setDataMode(SPI_MODE0); #if !defined(F_CPU) || F_CPU < 20000000 _SPI.setClockDivider(SPI_CLOCK_DIV2); #elif F_CPU < 40000000 _SPI.setClockDivider(SPI_CLOCK_DIV4); #elif F_CPU < 80000000 _SPI.setClockDivider(SPI_CLOCK_DIV8); #elif F_CPU < 160000000 _SPI.setClockDivider(SPI_CLOCK_DIV16); #elif F_CPU == 240000000 // For M5Stack Grey _SPI.setClockDivider(SPI_CLOCK_DIV2); // For M5Stack Grey** #elif F_CPU < 320000000 _SPI.setClockDivider(SPI_CLOCK_DIV32); #elif F_CPU < 640000000 _SPI.setClockDivider(SPI_CLOCK_DIV64); #elif F_CPU < 1280000000 _SPI.setClockDivider(SPI_CLOCK_DIV128); #else #error "Unsupported CPU frequency. Please set correct SPI divider." #endif #endifRegarding the program where I use the RF24, it is very large, I can, if you want, give you an example of use, with several pipes.
cordially
jpbbricole