diff options
author | Ayke van Laethem <[email protected]> | 2021-05-13 12:32:12 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-05-13 16:43:37 +0200 |
commit | aa5b8d0df733330147fb7cc2912a9c4fb44a8b47 (patch) | |
tree | 8455be579dde2e4398cb6bd4494d0267d1860f8e /src/machine/machine_stm32l0.go | |
parent | 7c949ad386ef36eb0be100eb54a4190740f6f24d (diff) | |
download | tinygo-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/machine_stm32l0.go')
-rw-r--r-- | src/machine/machine_stm32l0.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/machine/machine_stm32l0.go b/src/machine/machine_stm32l0.go index f4df17aba..8dab461b5 100644 --- a/src/machine/machine_stm32l0.go +++ b/src/machine/machine_stm32l0.go @@ -144,14 +144,14 @@ func (p Pin) enableClock() { //---------- UART related types and code // Configure the UART. -func (uart UART) configurePins(config UARTConfig) { +func (uart *UART) configurePins(config UARTConfig) { // enable the alternate functions on the TX and RX pins config.TX.ConfigureAltFunc(PinConfig{Mode: PinModeUARTTX}, uart.TxAltFuncSelector) config.RX.ConfigureAltFunc(PinConfig{Mode: PinModeUARTRX}, uart.RxAltFuncSelector) } // UART baudrate calc based on the bus and clockspeed -func (uart UART) getBaudRateDivisor(baudRate uint32) uint32 { +func (uart *UART) getBaudRateDivisor(baudRate uint32) uint32 { var clock, rate uint32 switch uart.Bus { case stm32.LPUART1: |