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.
10 years ago.
how can I use UART iterrupt inside library?
Basicalli i'm incapsulating one project and i'm creating a library out of that, i'm able to create a layer on the serial port, write and read, everythings looks ok, I'm now tryng to understand how to use interrupts inside the library, that's my code, and yes it's wrong, any idea?
void DL50::uartReader(void) { while(_DL50Serial.readable ()){ //do stuff,see people } } void DL50::Init() { _DL50Serial.baud(38400); _DL50Serial.attach(&uartReader(),Serial::RxIrq); }
2 Answers
10 years ago.
See this for a similar question (for ticker, but serial is identical): http://developer.mbed.org/forum/mbed/topic/1964/
10 years ago.
Andrea,
You can take a look at my Apeiros Robot Class Library, which uses a UART interrupt service routine to handle incoming serial data. I hope this helps you out.
http://developer.mbed.org/users/abotics/code/Apeiros/
Regards, Abe