mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
machine: make UART objects pointer receivers
This means that machine.UART0, machine.UART1, etc are of type *machine.UART, not machine.UART. This makes them easier to pass around and avoids surprises when they are passed around by value while they should be passed around by reference. There is a small code size impact in some cases, but it is relatively minor.
This commit is contained in:
committed by
Ron Evans
parent
7c949ad386
commit
aa5b8d0df7
@@ -229,7 +229,7 @@ func initInternal() {
|
||||
func postinit() {}
|
||||
|
||||
func putchar(c byte) {
|
||||
machine.PutcharUART(&machine.UART0, c)
|
||||
machine.PutcharUART(machine.UART0, c)
|
||||
}
|
||||
|
||||
func abort() {
|
||||
@@ -256,9 +256,9 @@ func abort() {
|
||||
// keep polling some communication while in fault
|
||||
// mode, so we don't completely die.
|
||||
// machine.PollUSB(&machine.USB0)
|
||||
machine.PollUART(&machine.UART0)
|
||||
machine.PollUART(&machine.UART1)
|
||||
machine.PollUART(&machine.UART2)
|
||||
machine.PollUART(machine.UART0)
|
||||
machine.PollUART(machine.UART1)
|
||||
machine.PollUART(machine.UART2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user