9 years, 5 months 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

9 years, 5 months ago.

See this for a similar question (for ticker, but serial is identical): http://developer.mbed.org/forum/mbed/topic/1964/

Accepted Answer
9 years, 5 months 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