Skip to content

Commit bdef52a

Browse files
sudaconejoninja
authored andcommitted
Allow changing the UART pins
1 parent fd1785e commit bdef52a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/machine/machine_nrf.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,14 @@ func (uart UART) Configure(config UARTConfig) {
7979

8080
uart.SetBaudRate(config.BaudRate)
8181

82-
// Set TX and RX pins from board.
83-
uart.setPins(UART_TX_PIN, UART_RX_PIN)
82+
// Set TX and RX pins
83+
if config.TX == 0 && config.RX == 0 {
84+
// Use default pins
85+
uart.setPins(UART_TX_PIN, UART_RX_PIN)
86+
} else {
87+
uart.setPins(config.TX, config.RX)
88+
}
89+
8490

8591
nrf.UART0.ENABLE.Set(nrf.UART_ENABLE_ENABLE_Enabled)
8692
nrf.UART0.TASKS_STARTTX.Set(1)

0 commit comments

Comments
 (0)