wokwi / rp2040js

A Raspberry Pi Pico Emulator in JavaScript
MIT License
384 stars 40 forks source link

UART write never blocks and doesn't actually write to GPIO pins #115

Open c1570 opened 1 year ago

c1570 commented 1 year ago

Writing to the UART never blocks at the moment: https://github.com/wokwi/rp2040js/blob/61e1d2cc9953eb049f7c45f8f0d3acc39c4c55e1/src/peripherals/uart.ts#L76 This also means that printf() using pico_stdio_uart is way faster in emulation than in reality quite often (basically whenever the silicon 8 byte TX buffer is exhausted).

Additionally, using the UART doesn't actually change the GPIO pins but only triggers the onByte() callback: https://github.com/wokwi/rp2040js/blob/61e1d2cc9953eb049f7c45f8f0d3acc39c4c55e1/src/peripherals/uart.ts#L119

Probably not a big deal but worth documenting anyways.

Erhannis commented 1 month ago

Oh - good thing you mentioned this, one of the first things I was about to do was depend on those GPIO pins being written, hahaha