Merge pull request #6771 from marcuschangarm/fix-uart-init

Fix UART initialization for NRF52
pull/6522/merge
Cruz Monrreal 2018-05-07 10:35:40 -05:00 committed by GitHub
commit e023bb67c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -1046,24 +1046,22 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
uart_object->rx = rx;
}
/* Set default parity and baud rate. */
/* Set default parity, baud rate, and callback handler. */
uart_object->parity = NRF_UART_PARITY_EXCLUDED;
uart_object->baudrate = NRF_UART_BAUDRATE_9600;
uart_object->cts = NRF_UART_PSEL_DISCONNECTED;
uart_object->rts = NRF_UART_PSEL_DISCONNECTED;
uart_object->hwfc = NRF_UART_HWFC_DISABLED;
uart_object->handler = 0;
/* The STDIO object is stored in this file. Set the flag once initialized. */
if (obj == &stdio_uart) {
stdio_uart_inited = 1;
}
/* Initializing the serial object does not make it the owner of an instance.
* Only when the serial object is being used will the object take ownership
* over the instance.
*/
/* Take ownership and configure UART. */
uart_object->update = true;
uart_object->handler = 0;
nordic_nrf5_serial_configure(obj);
}
/** Release the serial peripheral, not currently invoked. It requires further