4 years, 1 month ago.

Strange compiler Error 147 and 135 in InterruptIn

I have declared an interrupt like this:-

InterruptIn tone_isr(dp15);

My main() looks like this:-

tone.mode(PullUp); . . . tone.fall(&tone_isr);

this is the same as for all other inrterrupts I am using, but when I compile, I get the following:-

Error: Declaration is incompatible with "mbed::InterruptIn tone_isr" (declared at <a href="#" onmousedown="mbed_doc_goto('/RC5_AndrewR/Pindef1114.h', '24'); return false;">Pindef1114.h:24</a>) in "main.cpp", Line: 199, Col: 7

and a bit further down nin the compile error report

Error: Class "mbed::DigitalIn" has no member "fall" in "main.cpp", Line: 430, Col: 11

Any pointers as to what I am doing wrong?

'pointer' is the issue...

InterruptIn builds a class with a 'name' you have used tone_isr this should be (according to other line)

InterruptIn tone(dp15);

the line.....

tone.fall(&tone_isr); // this will on the falling edge goto the routine 'pointed' to &tone_isr

so you should have a routine or similar...

int tone_isr(void){
// code you want to service;
 return 0;}
posted by Martin Simpson 01 Dec 2015

Thanks Martin - clear.

posted by Andrew R 01 Dec 2015
Be the first to answer this question.