diff options
author | Ayke van Laethem <[email protected]> | 2021-05-13 14:07:22 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-05-13 16:43:37 +0200 |
commit | b67351babefb0b430642d8cde5f6113685706230 (patch) | |
tree | 52248a1d8b769057210ab3c48dae6c0ca0e4b9c3 /src/machine/board_feather-nrf52840.go | |
parent | aa5b8d0df733330147fb7cc2912a9c4fb44a8b47 (diff) | |
download | tinygo-b67351babefb0b430642d8cde5f6113685706230.tar.gz tinygo-b67351babefb0b430642d8cde5f6113685706230.zip |
machine: define Serial as the default output
Previously, the machine.UART0 object had two meanings:
- it was the first UART on the chip
- it was the default output for println
These two meanings conflict, and resulted in workarounds like:
- Defining UART0 to refer to the USB-CDC interface (atsamd21,
atsamd51, nrf52840), even though that clearly isn't an UART.
- Defining NRF_UART0 to avoid a conflict with UART0 (which was
redefined as a USB-CDC interface).
- Defining aliases like UART0 = UART1, which refer to the same
hardware peripheral (stm32).
This commit changes this to use a new machine.Serial object for the
default serial port. It might refer to the first or second UART
depending on the board, or even to the USB-CDC interface. Also, UART0
now really refers to the first UART on the chip, no longer to a USB-CDC
interface.
The changes in the runtime package are all just search+replace. The
changes in the machine package are a mixture of search+replace and
manual modifications.
This commit does not affect binary size, in fact it doesn't affect the
resulting binary at all.
Diffstat (limited to 'src/machine/board_feather-nrf52840.go')
-rw-r--r-- | src/machine/board_feather-nrf52840.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/machine/board_feather-nrf52840.go b/src/machine/board_feather-nrf52840.go index f353a3b7b..2c6e84658 100644 --- a/src/machine/board_feather-nrf52840.go +++ b/src/machine/board_feather-nrf52840.go @@ -75,9 +75,9 @@ const ( UART_TX_PIN = D1 ) -// UART0 is the USB device +// Serial is the USB device var ( - UART0 = USB + Serial = USB ) // I2C pins |