aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/board_trinket.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-05-13 12:32:12 +0200
committerRon Evans <[email protected]>2021-05-13 16:43:37 +0200
commitaa5b8d0df733330147fb7cc2912a9c4fb44a8b47 (patch)
tree8455be579dde2e4398cb6bd4494d0267d1860f8e /src/machine/board_trinket.go
parent7c949ad386ef36eb0be100eb54a4190740f6f24d (diff)
downloadtinygo-aa5b8d0df733330147fb7cc2912a9c4fb44a8b47.tar.gz
tinygo-aa5b8d0df733330147fb7cc2912a9c4fb44a8b47.zip
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.
Diffstat (limited to 'src/machine/board_trinket.go')
-rw-r--r--src/machine/board_trinket.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/machine/board_trinket.go b/src/machine/board_trinket.go
index 8535fdfe2..6305cb708 100644
--- a/src/machine/board_trinket.go
+++ b/src/machine/board_trinket.go
@@ -47,7 +47,8 @@ const (
// UART1 on the Trinket M0.
var (
- UART1 = UART{
+ UART1 = &_UART1
+ _UART1 = UART{
Buffer: NewRingBuffer(),
Bus: sam.SERCOM0_USART,
SERCOM: 0,
@@ -55,7 +56,7 @@ var (
)
func init() {
- UART1.Interrupt = interrupt.New(sam.IRQ_SERCOM0, UART1.handleInterrupt)
+ UART1.Interrupt = interrupt.New(sam.IRQ_SERCOM0, _UART1.handleInterrupt)
}
// SPI pins