Page 1 of 1

uart problem

Posted: Sat Apr 16, 2016 3:34 am
by wwsheldons
Does the micropython support the receive interruption of uart? And the API function is what? thank you

Re: uart problem

Posted: Sat Apr 16, 2016 3:46 am
by dhylands
When the read_buf_len (argument to the init function) is non-zero, then interrupts enabled to put received characters into the buffer.

The default is a read_buf_len of 64.

Re: uart problem

Posted: Sat Apr 16, 2016 5:16 am
by wwsheldons
thank you :D :D

Re: uart problem

Posted: Sat Apr 16, 2016 5:22 am
by wwsheldons
And the callback function is...?

Re: uart problem

Posted: Sat Apr 16, 2016 6:00 am
by pythoncoder
There isn't a user callback. The UART performs I/O using interrupts in the background. You need to poll the any() method to determine how many characters are in its buffer.

Re: uart problem

Posted: Sat Apr 16, 2016 6:05 am
by dhylands
You can also use select on the uarts.

Re: uart problem

Posted: Sun Apr 17, 2016 12:21 am
by wwsheldons
dhylands wrote:You can also use select on the uarts.

thanks , and do you give me an example?

Re: uart problem

Posted: Sun Apr 17, 2016 12:54 am
by dhylands

Re: uart problem

Posted: Sun Apr 17, 2016 2:51 am
by wwsheldons
thank you very much! :geek: :geek: