Commit Graph

5 Commits

Author SHA1 Message Date
robert-hh
2251cb774b samd/machine_uart: Implement uart.txdone() and uart.flush().
Using the stream method for uart.flush().

uart.txdone() returns True, if the uart not busy, False otherwise.

uart.flush() waits until all bytes have been transmitted or a timeout
triggers.  The timeout is determined by the buffer size and the baud rate.

Also fix two inconsistencies when not using txbuf:
- Report in ioctl as being writeable if there is room in the tx buffer,
  only if it is configured.
- Print the txbuf size if configured.
2022-10-25 23:11:57 +11:00
robert-hh
d9338aabc5 samd: Change the symbol names for the peripheral clocks.
From APB_FREQ to DFLL48M_FREQ, and from apb_freq to peripheral_freq.
2022-10-06 23:10:08 +11:00
robert-hh
9a567b04e7 samd/machine_uart: Support buffered TX for UART.
It can be enabled/disabled by a configuration switch.  The code size
increase is 308 bytes, but it requires RAM space for buffers, the larger
UART object and root pointers.
2022-10-06 22:57:37 +11:00
robert-hh
3625388d8c samd/samd_isr: Change the way a Sercom ISR is registered and called.
Code size diff: +12 Bytes
BSS diff: -12 Bytes
RAM usage: +16 Bytes
Speed increase: a few clock cycles per call
Style improvement: ++
2022-10-06 22:52:10 +11:00
robert-hh
b33f204529 samd/machine_uart: Add the machine.UART class.
All board pins that have UART's assigned can be used.  Baud rate range is
75 Baud to ~2 MBaud.

No flow control yet, and only RX is buffered.  TX buffer and flow control
may be added later for SAMD51 with its larger RAM and Flash.
2022-10-06 22:48:12 +11:00