Hi,
I hope someone has done this before and that there is a simple fix for it.
I have a relatively complex system of about 30 or so library files that I am using for a project. One of those files is a 'master' class, allowing me to keep my actual sketch I load onto my arduino super short, like this:
// sketch
#include "Master.h"
Master myObject;
void setup(){
myObject.begin();
}
void loop(){
myObject.update();
}
I would like to include the ShiftPWM library within this system of files. So, I created my own 'Registers.h' file, which would deal with interacting between my own LED objects in my code and the shiftPWM implementation. The top of my 'Registers.h' file looks like this (similar to how my working sketches look):
// Registers.h
#define SHIFTPWM_NOSPI
const int ShiftPWM_latchPin = 2;
const int ShiftPWM_dataPin = 4;
const int ShiftPWM_clockPin = 3;
const bool ShiftPWM_invertOutputs = true;
const bool ShiftPWM_balanceLoad = false;
#include "../ShiftPWM/ShiftPWM.h" // this syntax is required to include this library from within a separate folder
When I go to compile the code, I get the following errors:
multiple definitions of '__vector_11'
.../ShiftPWM/ShiftPWM.h:175 first defined here
multiple definitions of 'ShiftPWM'
.../ShiftPWM/ShiftPWM.h:175 first defined here
The line the errors are referring to is:
ISR(TIMER1_COMPA_vect) {
ShiftPWM_handleInterrupt();
It seems, from my research, that people get these sorts of errors when two libraries are trying to use the same timer to handle interrupts. A lot of people experience issues when they try to use the Servo and Tone libraries, for instance. But, I don't think that I am defining ShiftPWM twice, and don't understand why my compiler is suggesting that 'ShiftPWM' and '__vector_11' are first defined in the ISR() macro.
I don't get this error when I run the example sketch Elco Jacobs provides with the libraries. I even crafted my own example sketch only using the ShiftPWM library and all works well.
Is there something particular I need to do to be able to #include this library into one of my own? I feel like there has to be a stupid easy fix that I am just not seeing.
Thanks in advance!