Callback attach method?

looking at this page, it tells you that attach is a function inside callback class.
But when I try to use it, compiler say "no member named attach in 'mbed::callback<void()>'
What is going on or what I do wrong? I use latest mbed.
Thanks in advance.



you did not post the code where you have the issue. Be so kind and share the problematic code.

BR, Jan

It is not a big secret.
I need to make SoftSerial working again. There are old definition of attach and fall callbacks that needs to be modified.
I struggle to fix the issues. I don’t think there is any working version out there.

BR Mariwan

No I mean, the line of code what give you the error or the line what you want to convert from old system to new one.

Hmm, in case of SoftSerial I remember there were some issue about it. Try to check this topic - SoftSerial problem L432KC - Mbed OS / Hello world! - Arm Mbed OS support forum

BR, Jan

Look at this code,

 if (RX != NC) {
        rx = new InterruptIn(RX);
        rx_en = true;
        out_valid = false;
        rxticker.attach(this, &SoftSerial::rx_handler);
        rx->fall(&SoftSerial::rx_gpio_irq_handler);             <-- wrong!!

fall defined like that 
  void fall(Callback<void()> func);

and the error i s

 no matching conversion for functional-style cast from 'void' to 'Callback<void ()>'

Maybe the solution is to do like here

  rx->fall(std::bind(&SoftSerial::rx_gpio_irq_handler, this));

How I wrote check the topic… Inside is a version of the library with some modifications.

SoftSerial - Not work original Lib on F446RE & L432KC . Change… | Mbed

rx->fall(callback(this, &SoftSerial::rx_gpio_irq_handler));

BR, Jan