mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
Allow changing the UART pins
This commit is contained in:
committed by
Daniel Esteban
parent
fd1785ed2d
commit
bdef52ad62
@@ -79,8 +79,14 @@ func (uart UART) Configure(config UARTConfig) {
|
|||||||
|
|
||||||
uart.SetBaudRate(config.BaudRate)
|
uart.SetBaudRate(config.BaudRate)
|
||||||
|
|
||||||
// Set TX and RX pins from board.
|
// Set TX and RX pins
|
||||||
uart.setPins(UART_TX_PIN, UART_RX_PIN)
|
if config.TX == 0 && config.RX == 0 {
|
||||||
|
// Use default pins
|
||||||
|
uart.setPins(UART_TX_PIN, UART_RX_PIN)
|
||||||
|
} else {
|
||||||
|
uart.setPins(config.TX, config.RX)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
nrf.UART0.ENABLE.Set(nrf.UART_ENABLE_ENABLE_Enabled)
|
nrf.UART0.ENABLE.Set(nrf.UART_ENABLE_ENABLE_Enabled)
|
||||||
nrf.UART0.TASKS_STARTTX.Set(1)
|
nrf.UART0.TASKS_STARTTX.Set(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user