Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 11 months ago.
callback declared deprecated
Hello,
My code looks like:
callback stuff
Serial pc(PA_2, PA_3,115200);
DigitalOut led2(PA_5);
event_callback_t serial_callback_RX;
uint16_t out_buff[12];
void serial_callback_handler_RX(int event){
if(event & SERIAL_EVENT_TX_COMPLETE){
led2.write(1);
}
else{
led2.write(0);
}
}
void init_serial(){
serial_callback_RX.attach(serial_callback_handler_RX);
}
serial stuff
pc.write(out_buff,12,&serial_callback_RX,SERIAL_EVENT_RX_COMPLETE);
I get the warning : Warning: Function "mbed::Callback<R (A0)>::attach(R (*)(A0)) [with R=void, A0=int]" (declared at line 918 of "/extras/mbed/platform/Callback.h") was declared "deprecated" in "main.cpp", Line: 26, Col: 25 for the serial_callback_RX.attach(serial_callback_handler_RX); line
Also I get the error Error: No instance of overloaded function "mbed::Serial::write" matches the argument list in "main.cpp", Line: 60, Col: 13 , for the pc.write(out_buff,12,&serial_callback_RX,SERIAL_EVENT_RX_COMPLETE);
More on the serial.write method I get the ERROR Error: No instance of overloaded function "mbed::Serial::write" matches the argument list in "main.cpp", Line: 60, Col: 13 if I omit the event argument but that could because of the previous warning?
Please let me know if someone knows what is going on. How could the first warning be resolved?