I have the following class:
MIDIDevice midi;
class ExampleMidi
{
protected:
void noteOnHandler(byte channel, byte note, byte velocity)
{
Serial.print("Note On, ch=");
Serial.print(channel, DEC);
Serial.print(", note=");
Serial.print(note, DEC);
Serial.print(", velocity=");
Serial.println(velocity, DEC);
}
protected:
void init()
{
midi.setHandleNoteOn((void (*)(byte, byte, byte)) & ExampleMidi::noteOnHandler);
}
}
midi.setHandleNoteOn expect a point to a function, or I would like to pass a method to it. This cast is working, it compile and there is no error during execution but I am getting the following warning:
warning: converting from 'void (ExampleMidi::*)(byte, byte, byte) {aka> void (ExampleMidi::*)(unsigned char, unsigned char, unsigned char)}' to 'void (*)(byte, byte, byte) {aka void (*)(unsigned char, unsigned char, unsigned char)}' [-Wpmf-conversions] midi.setHandleNoteOn((void (*)(byte, byte, byte)) & ExampleMidi::noteOnHandler);
How can I get rid of this warning?