read() & readline() on rp2 port don't work/work as expected
the UART on the rp2 port mostly works. read([num of bytes]) works mostly as expected although it seems to drop bytes occasionally and "hangs" if you try to read more bytes than currently available however read() with no number of bytes to read set and readline() just sit there indefinitely. I suspect it's to do with the fact that timeout isn't implemented
rp2: Add timeout and invert to the machine.uart class
This is a first attempt. It works, timeout and timeout_chars can be set and the object is properly printed, but there is an inherent problem in the way, machine_uart_read() and maybe machine_uart_write() is called. The problem is, when .e.g at uart.read() the numbers requested is larger than the ones in the FIFO. And that is different to e.g. the esp32 port.
Situation ESP32 RP2
request == present OK OK
none requested OK Error
request > present OK Error
What happens is, that on the RP2, if machine_uart_read() returns less than the initially requested bytes, it will be called again with the remaining number, which will then run into a timeout. On ESP32, the caller is just happy with what it got and returns to the top level. When uart.read() is called without an argument, the size at the machine_uart_read() is 256.
So the stream algorithm behaves different. machine_uart_read() is called different in these two ports.
As a temporary fix, the function machine_uart_read() returns on timeout without an error and with the numbers of bytes read.