Before going into interrupts, why they’re needed, and why they are tricky, let’s first look into an example which does not use interrupts: writing a pass-through USB-to-serial application.
Note that many of the observations and issues that follow apply to any procedural language!
Here’s a simple loop to pass characters from the UART to USB, and from USB to the UART:
: run uart-init 19200 uart-baud begin uart-key? if uart-key emit then key?
↧