relax restriction on configuration with duplicate settings
Этот коммит содержится в:
родитель
1e92e5f6c6
коммит
ca4f251050
1 изменённых файлов: 0 добавлений и 10 удалений
|
@ -45,11 +45,6 @@ func (uart *UART) resetTransmitting() {
|
||||||
uart.Bus.GLOBAL.ClearBits(nxp.LPUART_GLOBAL_RST)
|
uart.Bus.GLOBAL.ClearBits(nxp.LPUART_GLOBAL_RST)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (uart *UART) usesConfig(c UARTConfig) bool {
|
|
||||||
return uart.configured && uart.baud == c.BaudRate &&
|
|
||||||
uart.rx == c.RX && uart.tx == c.TX
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure initializes a UART with the given UARTConfig and other default
|
// Configure initializes a UART with the given UARTConfig and other default
|
||||||
// settings.
|
// settings.
|
||||||
func (uart *UART) Configure(config UARTConfig) {
|
func (uart *UART) Configure(config UARTConfig) {
|
||||||
|
@ -67,11 +62,6 @@ func (uart *UART) Configure(config UARTConfig) {
|
||||||
config.TX = UART_TX_PIN
|
config.TX = UART_TX_PIN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not reconfigure pins and device buffers if duplicate config provided.
|
|
||||||
if uart.usesConfig(config) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
uart.baud = config.BaudRate
|
uart.baud = config.BaudRate
|
||||||
uart.rx = config.RX
|
uart.rx = config.RX
|
||||||
uart.tx = config.TX
|
uart.tx = config.TX
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче