Hello, I use the MODSERIAL library on KL25Z is when I want to attach a function, the compiler indicates the following error message: Error: No instance of overloaded function “AjK::MODSERIAL::attach” matches the argument list in “main.cpp”, Line: 23, Col: 15
Since you are using Andy Kirkham’s MODSERIAL library the RxIrq ISR must have one argument - a pointer to MODSERIAL_IRQ_INFO (even when it isn’t used in the body of your ISR). Moreover, if your intention is to use the same variable in the ISR and also in the main function then it shall be defined as global and volatile (to make it visible at both places and to prevent the compiler from deleting it when optimizing the code):
…
volatile int toto = 0; // global & volatile
...
//void test()
void test(MODSERIAL_IRQ_INFO *) {
//int toto;
toto += 3;
}
...
int main()
{
...
PC_Short.attach(&test, MODSERIAL::RxIrq);
...
while(true) {
...
if (toto != 0) {
printf("toto = %d\r\n", toto);
}
...
}
}
Thank you for your specific answer!
I had found this method in other post, and so with the argument * it works.
But I have another problem now!
In my interuption, I call the “move” function of MODSERIAL which allows me to retrieve a string of text via thebuffer serie.
It works the first time, but then has every interrupt call, a character and truncated!
Here is the code: