mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 15:03:41 +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
@@ -51,7 +51,7 @@ func (p Pin) getPortPin() (*nrf.GPIO_Type, uint32) {
|
||||
return nrf.P0, uint32(p)
|
||||
}
|
||||
|
||||
func (uart UART) setPins(tx, rx Pin) {
|
||||
func (uart *UART) setPins(tx, rx Pin) {
|
||||
nrf.UART0.PSELTXD.Set(uint32(tx))
|
||||
nrf.UART0.PSELRXD.Set(uint32(rx))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user