I'm getting the following compiler complaints but the referenced strays cannot be found. Arduino version 1.0.
Project files accompany post.
C:\arduino-1.0\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -IC:\arduino-1.0\hardware\arduino\cores\arduino -IC:\arduino-1.0\hardware\arduino\variants\standard -IC:\arduino-1.0\libraries\FastADC C:\Users\AARONJ~1.SCO\AppData\Local\Temp\build5886924818106296315.tmp\FastDAC_ino.cpp -oC:\Users\AARONJ~1.SCO\AppData\Local\Temp\build5886924818106296315.tmp\FastDAC_ino.cpp.o
In file included from FastDAC_ino.cpp:1:
C:\arduino-1.0\libraries\FastADC/FastADC.h:1: error: stray '\357' in program
C:\arduino-1.0\libraries\FastADC/FastADC.h:1: error: stray '\273' in program
C:\arduino-1.0\libraries\FastADC/FastADC.h:1: error: stray '\277' in progra
I see I will have to handle the interrupt externally and ping the function from the ISR or make a copy of the attachInterrupt function and make it local to the class. The reasoning for the class was not for multiple instances, but for ease of use...or so I thought. The easiest for me is to just call CompareShift from the main body.
The reasoning for the class was not for multiple instances, but for ease of use..
Perhaps, but the compiler has no way of knowing that you will only make one instance of the class.
There are ways of making a copy of the this pointer in the constructor, and then using that copy in the static method to access the non-static members of the class IF you do only create one instance.
I do that all the time at work, when the class is a dialog class, and I want to use a progress bar dialog class. The progress bar class requires a static method, just like attachInterrupt, for very similar reasons. Each class that uses the progress bar class is a singleton (only one instance at a time), so I register a static method for the progress bar class to call, and in that static method I call the real class member function using the static copy of the pointer to this that the constructor of the singleton made.