#137552 - Robthar - Mon Aug 13, 2007 11:32 am
When i try to set the irqHandlers inside a class i get this error
Code: |
error: cannot convert 'void (Nds::ExtensibleDrawing::FormRoot::*)()' to 'void (*)()' for argument '2' to 'void irqSet(IRQ_MASK, void (*)())'
|
How can I fix this
#137554 - Lick - Mon Aug 13, 2007 11:57 am
Make the function static. Explained.
A simple workaround would be this: Code: |
void SomeIRQHandler() {
myclass.Function();
} |
_________________
http://licklick.wordpress.com
Last edited by Lick on Mon Aug 13, 2007 12:02 pm; edited 2 times in total
#137555 - Robthar - Mon Aug 13, 2007 12:01 pm
Which funktion, The function I set the Irqs from or the function on which the irq handler will be set?
#137556 - Lick - Mon Aug 13, 2007 12:03 pm
Robthar wrote: |
Which funktion, The function I set the Irqs from or the function on which the irq handler will be set? |
The function that will act as IRQ handler.
_________________
http://licklick.wordpress.com
#137557 - silent_code - Mon Aug 13, 2007 12:03 pm
the handler... member functions allways get an "invisible" first parameter, which is the "this" pointer. making it static will get rid of it.
#137560 - Robthar - Mon Aug 13, 2007 12:16 pm
Is there no way to use member functions as irq handlers?
#137562 - silent_code - Mon Aug 13, 2007 12:46 pm
read the posts, again. (hint: make the handler member function static!)
#137563 - Robthar - Mon Aug 13, 2007 12:57 pm
?.?
member functions that are non-static are impossible to use as handlers?? Thats what i meant
#137565 - silent_code - Mon Aug 13, 2007 1:18 pm
well, they don't match the function type (return and parameter types [as well as number of parameters]), so i guess the answer is: NO.
do static functions work for you?
happy coding. :^)
#137567 - kusma - Mon Aug 13, 2007 2:53 pm
Robthar wrote: |
?.?
member functions that are non-static are impossible to use as handlers?? Thats what i meant |
No, because a non-static member function requires an invisible parameter; a pointer to the class-instance (the "this"-pointer). The standard IRQ-handler won't track the class instance for you, but you could make a wrapping function storing away the class instance as a global pointer yourself.
#137645 - Robthar - Tue Aug 14, 2007 10:38 am
Hah^^
I made a global pointer to the class i wish to have interrupt functions and another class with static functions that handle the interrupts and calls the functions. Seems to work, compiles fine