How to modify RF69_IRQ_PIN and RF69_IRQ_NUM in a sketch using the same lib

Started by Clemens, February 20, 2015, 05:18:09 PM

Clemens

Change CS pin is a bit tricky in the RFM12B lib as described above.

I now have switched to the RFM69 modules. Seems to be a bit more easy. I changed in

RFM69.h
#define RF69_SPI_CS             SS // SS is the SPI slave select pin, for instance D10 on ATmega328


into

#define RF69_SPI_CS            9


but it doesn't run really smooth. So I don't know if this is the only thing I have to do. The Seeeduino Stalker has an ATmega328P
at 8 MHz and is programmed as Pro /  Pro Mini over the IDE. SD is hardwired to D10, so I have to change it.

Clemens

I have modified RFM69.h for different boards I use e.g. for the Uno

#define RF69_IRQ_PIN          3
#define RF69_IRQ_NUM          1


but I have to use

#define RF69_IRQ_PIN          3
#define RF69_IRQ_NUM          0


for the Yun.

It is a bit annoying to change this in the RFM69.h, close and re-open the IDE, do it again for an other board. So I'm searching for a way to do this in the sketch not in the lib files. I tried to overwrite the default values in the sketch but

#include <RFM69.h>  
#define RF69_IRQ_PIN          3
#define RF69_IRQ_NUM          0


seems not to work. Any idea what's wrong?

Clemens

Any suggestion to this problem? Also a "does not go" would be helpful.

TomWS

Do you want to override just the IRQ pin & num or do you want to override the CS pin as well? 

Tom

Clemens

My posts are a branch of an other older thread so it may be confusing. To clarify: This are two problems (1) changing CS and (2) changing IRQ. I need both. RFMxx lib's default CS is not working for my Seeeduino Stalker because--I think it was SD--is hardwired to D10. I use a similar shield for the Yun, there I have to change the IRQs.

All is working well when I change the pins in the lib directly. But it is annoying to change the pins in the lib, restart the IDE. Do the same in case I switch to an other board while debugging. So I tried to set the pins in the sketch after including the lib. But it doesn't work and I don't know if this is possible and how to get it working with the current lib version.

TomWS

Quote from: Clemens on May 27, 2015, 07:02:47 AM
My posts are a branch of an other older thread so it may be confusing. To clarify: This are two problems (1) changing CS and (2) changing IRQ. I need both. RFMxx lib's default CS is not working for my Seeeduino Stalker because--I think it was SD--is hardwired to D10. I use a similar shield for the Yun, there I have to change the IRQs.

All is working well when I change the pins in the lib directly.

Quote from: Clemens on May 27, 2015, 07:02:47 AM
But it is annoying to change the pins in the lib, restart the IDE.
Ok, to take care of this problem immediately, you don't need to restart the IDE if you edit the LIB files.  The IDE will rebuild the compiled code if you just do a re-build.

Quote from: Clemens on May 27, 2015, 07:02:47 AM
Do the same in case I switch to an other board while debugging. So I tried to set the pins in the sketch after including the lib. But it doesn't work and I don't know if this is possible and how to get it working with the current lib version.
You are correct, if the change isn't made to the lbrary file, it won't change the settings.  My question to you is whether you are willing to maintain your own branch of the library as I don't see this problem getting enough support to warrant a global change to the library.  I can show you how to change the library so it is universal for all your applications, but you'll need to 'own' it after that.

Tom

TomWS

My other question is whether you use the SPIFlash library or not?  If you do use it, does this have an issue where you need to remap the CS pin?

Tom