Hi,
I want to know how to define my own ISR and set it dynamically at run time. First, here’s some background info.
I have an application where I want to use both the radioCom and radioQueue libraries. They’re not being used simultaneously, exactly. But rather, the application can switch between two modes based on user input, and each mode uses one of the two radio libraries.
At first, I couldn’t get my application to compile because of multiple definitions of radioMacEventHandler
. So I made copies of radioCom, radioLink, and radioMac and called them radioCom2, radioLink2, and radioMac2. And then I renamed radioMacEventHandler
in these copied libs to radioMacEventHandler2
.
Now the application won’t compile because of multiple definitions of the RF ISR. My thought is to give the RF ISR inside of radioMac2 a different name and then change the RF ISR at runtime.
As I understand it, there are 2 things I need to do:
-
Define my own ISR with a different name, but with the function definition copied from the current RF ISR
e.g.void my_isr(void) { ... copy from RF ISR ...}
But I’m pretty sure SDCC adds instructions to the beginning and end of an ISR to save registers and return with a RETI instead of RET. Do I just need to add__interrupt()
to the function signature to make it safe to call from an interrupt? -
What do I put at the RF interrupt vector address, and how do I do it, so that
my_isr
gets called? From the data sheet, the relevant vector address is 0x83.
Please give me your thoughts on 1 and 2 above. Or if you think there’s a better way to accomplish my general goal of compiling radioQueue and radioCom on one app, I’d like to hear that too.
Thanks