mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
b67351babe
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.
79 lines
1.1 KiB
Go
79 lines
1.1 KiB
Go
// +build sam,atsamd21 arduino_nano33 circuitplay_express
|
|
|
|
package machine
|
|
|
|
// Return the current CPU frequency in hertz.
|
|
func CPUFrequency() uint32 {
|
|
return 48000000
|
|
}
|
|
|
|
// Hardware pins
|
|
const (
|
|
PA00 Pin = 0
|
|
PA01 Pin = 1
|
|
PA02 Pin = 2
|
|
PA03 Pin = 3
|
|
PA04 Pin = 4
|
|
PA05 Pin = 5
|
|
PA06 Pin = 6
|
|
PA07 Pin = 7
|
|
PA08 Pin = 8
|
|
PA09 Pin = 9
|
|
PA10 Pin = 10
|
|
PA11 Pin = 11
|
|
PA12 Pin = 12
|
|
PA13 Pin = 13
|
|
PA14 Pin = 14
|
|
PA15 Pin = 15
|
|
PA16 Pin = 16
|
|
PA17 Pin = 17
|
|
PA18 Pin = 18
|
|
PA19 Pin = 19
|
|
PA20 Pin = 20
|
|
PA21 Pin = 21
|
|
PA22 Pin = 22
|
|
PA23 Pin = 23
|
|
PA24 Pin = 24
|
|
PA25 Pin = 25
|
|
PA26 Pin = 26
|
|
PA27 Pin = 27
|
|
PA28 Pin = 28
|
|
PA29 Pin = 29
|
|
PA30 Pin = 30
|
|
PA31 Pin = 31
|
|
PB00 Pin = 32
|
|
PB01 Pin = 33
|
|
PB02 Pin = 34
|
|
PB03 Pin = 35
|
|
PB04 Pin = 36
|
|
PB05 Pin = 37
|
|
PB06 Pin = 38
|
|
PB07 Pin = 39
|
|
PB08 Pin = 40
|
|
PB09 Pin = 41
|
|
PB10 Pin = 42
|
|
PB11 Pin = 43
|
|
PB12 Pin = 44
|
|
PB13 Pin = 45
|
|
PB14 Pin = 46
|
|
PB15 Pin = 47
|
|
PB16 Pin = 48
|
|
PB17 Pin = 49
|
|
PB18 Pin = 50
|
|
PB19 Pin = 51
|
|
PB20 Pin = 52
|
|
PB21 Pin = 53
|
|
PB22 Pin = 54
|
|
PB23 Pin = 55
|
|
PB24 Pin = 56
|
|
PB25 Pin = 57
|
|
PB26 Pin = 58
|
|
PB27 Pin = 59
|
|
PB28 Pin = 60
|
|
PB29 Pin = 61
|
|
PB30 Pin = 62
|
|
PB31 Pin = 63
|
|
)
|
|
|
|
var Serial = USB
|