11 years, 3 months ago.

How to use MODSERIAL rx interrupt ??

Hi, For me it is impossible to use MODSERIAL. I allways get next compiler error:

no instance of overloaded function "AjK::MODSERIAL::attach" matches the argument list error 304

I also tried PC_USB.attach(&char_received,RxIrq);

It all gives the same error. What is wrong here ?? Can someone help me out? What are the right libs?

My simplified code is :

#include "mbed.h"                    
 #include "MODSERIAL.h"
   
 void char_received();
 
 MODSERIAL PC_USB(USBTX, USBRX); // : USB communication Mbed USB TX and RX lines

 int main(void)
 {
     PC_USB.baud(38400); 
     PC_USB.attach(&char_received, MODSERIAL::RxIrq);    // : attach function char_received to RX inerrupt
     
  //  more code ...............      
 }

Question relating to:

1 Answer

11 years, 3 months ago.

See the modserial cookbook page, but short answer, modserial sends a pointer to itself to the callback function, which needs to accept that:

void char_received(MODSERIAL_IRQ_INFO *q);

Accepted Answer