uart problem

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
wwsheldons
Posts: 31
Joined: Wed Dec 02, 2015 1:47 pm

uart problem

Post by wwsheldons » Sat Apr 16, 2016 3:34 am

Does the micropython support the receive interruption of uart? And the API function is what? thank you

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: uart problem

Post by dhylands » Sat Apr 16, 2016 3:46 am

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.

wwsheldons
Posts: 31
Joined: Wed Dec 02, 2015 1:47 pm

Re: uart problem

Post by wwsheldons » Sat Apr 16, 2016 5:16 am

thank you :D :D

wwsheldons
Posts: 31
Joined: Wed Dec 02, 2015 1:47 pm

Re: uart problem

Post by wwsheldons » Sat Apr 16, 2016 5:22 am

And the callback function is...?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uart problem

Post by pythoncoder » Sat Apr 16, 2016 6:00 am

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.
Peter Hinch
Index to my micropython libraries.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: uart problem

Post by dhylands » Sat Apr 16, 2016 6:05 am

You can also use select on the uarts.

wwsheldons
Posts: 31
Joined: Wed Dec 02, 2015 1:47 pm

Re: uart problem

Post by wwsheldons » Sun Apr 17, 2016 12:21 am

dhylands wrote:You can also use select on the uarts.

thanks , and do you give me an example?


wwsheldons
Posts: 31
Joined: Wed Dec 02, 2015 1:47 pm

Re: uart problem

Post by wwsheldons » Sun Apr 17, 2016 2:51 am

thank you very much! :geek: :geek:

Post Reply