I won't get into all the nitty gritty details unless required, but I'm running a LoRa radio library and a GPS module. The GPS module requires that I read the gps output ever 1ms. To do this they recommend using an interrupt on the M0.
From a bit of digging, interrupts seem much harder on the M0 than on more standard arduino systems. Luckily I found a library that a guy wrote that simplifies everything:
Using his library, I was able to make a working interrupt.
I took that exact interrupt and copied it into my LoRa radio code and I get a compiler error. I think the libraries are conflicting.
Here is a simpler example. Just by loading the radio code and SAMDtimer libraries, I get a compiler error.
#include <SPI.h>
#include <RH_RF69.h>
#include <Arduino.h>
#include <avdweb_SAMDtimer.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
The compiler error is as follows:
libraries\Adafruit_ASFcore\tc_interrupt.c.o: In function `TC3_Handler':
C:\Users\jaleemhu\Documents\Arduino\libraries\Adafruit_ASFcore/tc_interrupt.c:140: multiple definition of `TC3_Handler'
libraries\RadioHead\RH_ASK.cpp.o:C:\Users\jaleemhu\Documents\Arduino\libraries\RadioHead/RH_ASK.cpp:600: first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Adafruit Feather M0.
Now to my question, is there a way I could modify the interrupt library so I can remove this conflict? I think it's the only thing keeping me from finishing my project and this is a bit over my head.
Well of course they are, since you didn't even bother to rename the handler.
Now, of course, we do not see any links to the libraries you are using, so we can only guess at what TC3_Handler() is going to do.
However, it seems likely that you will not be able to use both libraries together, since they apparently both need the same resource, and there is only one of whatever it is they need.
I would be very surprised if you need to use interrupts at all. In Arduino terms 1 millisec is a long time and it should be doable with polling using micros() to manage the timing.
In any case, I can't see the need to read a GPS every millisec - your position won't change that quickly. i suspect once every 10 seconds would be sufficient - or maybe once per minute.
Be careful not to waste more time trying to figure out a library than you would need to write the same functionality without the library.
Hello, I ran into the same problem interfacing the Adafruit_NeoPixel_ZeroDMA and the Radiohead library on a Feather M0... after a little bit of trial and error, I found this seemingly reasonable solution.
Comment out the 7 lines of void TC3_Handler() to eliminate the multiple definition error
This works for my application, but I'm interested to know what (if any) the consequence of this modification is!?