sipeed / MaixPy-v1

MicroPython for K210 RISC-V, let's play with edge AI easier
https://wiki.sipeed.com/maixpy
Other
1.68k stars 439 forks source link

UART.irq() support #313

Open ChahidTALHA opened 4 years ago

ChahidTALHA commented 4 years ago

Hi, I am using a Sipeed Maixduino board for my project, flashed with the latest maixpy firmware available on the github. I am unable to use the UART.irq() function in order to callback defined functions once i get data received on the Rx pin from the ESP8266. Is this UART.irq supported with latest firmwares (it is supported on the MicroPython libraries) ? If not, is there any alternative besides this method or am I able to modify the source code for it. You can refer to this code example which i would like to run on my Maixduino Board : https://forum.micropython.org/viewtopic.php?t=1448

junhuanchen commented 4 years ago

The serial port interrupt is not an excellent method, because at the MicroPython system level, the interrupt has been built into the bottom of the system, and whether you use irq or not, it will import your data into the system, so you only need to judge by any Whether there is data in the buffer, and seek to check whether the buffer has the data it needs.

such as code.

https://github.com/sipeed/MaixPy_scripts/blob/245bb973ccaa792730cf70251e6ae6a4192dbbea/modules/mlx90640/mlx90640.py#L26-L52