I'm using a RFM96W from Adafruit (which is just a breakout board for the SX1276 LoRa® based module)
To handle the communication, the RadioHead library seemed the best choice as it allows you to easily implement encryption, retries and timeouts (as well as setting the interface, etc...) by initializing a driver (corresponding to the chip) and a manager (to implement a reliable datagram) Link to documentation
Now to my question :
The RFM96W generate a signal on its DIO0 to indicate that a message has arrived, or that a message finished being sent, and I intended to manually write an interrupt handler. However I found in the driver's documentation " The RH_RF95 driver uses interrupts to react to events in the RFM module, such as the reception of a new packet, or the completion of transmission of a packet. The driver configures the radio so the required interrupt is generated by the radio's DIO0 pin."
Does it means that i shouldn't try to attach my own interrupt handler to this pin, as it's already used by the driver ?
Thank you all, I hope I provided enough info.
If not I'll respond as quickly as I can
The thing is that when initialising the driver, you already give it the interrupt pin number : RH_RF95 (uint8_t slaveSelectPin=SS, uint8_t interruptPin=2, RHGenericSPI &spi=hardware_spi)
I was wondering if creating my own interrupt handler on the same pin I already gave to the driver was gonna create a conflict.
Rather than regularly checking if some data is available, and using processing power to do so, I'd rather just have a flag raised when a message has been transmitted and read it then.
Im surely not the only one who would move mountains to avoid interrupts or modifying a library.
Which raises the qusstion: how does this help you at all? If your loop is running smoothly, just use the available calls to check on things at the top of the loop.
If your loop is not running smoothly, that is where you might focus your attention. If you don't know how to write non-blocking code, it would be better to learn now than to keep turning to flags and interrupts and stuff. They are no panacea.
Moreover, the interrupt just indicates (for example) that a new packet has been received by the radio. If you wrote your own ISR for that, you'd have to handle pulling the packet into the processor over SPI, verifying it (destination address, checksum, etc), resetting radio hardware flags as required, etc. If you're going to do all that, why bother with the library at all?