mirror of https://github.com/ARMmbed/mbed-os.git
[EFM32] Use serial configuration from platform
mbed added configuration options for default serial baud rate and stdio baud rate, so we can get rid of the workaround in the HALpull/3122/head
parent
1f3003fb22
commit
6315147faf
|
@ -36,9 +36,6 @@
|
|||
/* USB */
|
||||
#define USB_TIMER USB_TIMER1
|
||||
|
||||
/* STDIO */
|
||||
#define STDIO_UART UART0
|
||||
|
||||
/* Clocks */
|
||||
|
||||
/* Clock definitions */
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
/* USB */
|
||||
#define USB_TIMER USB_TIMER2
|
||||
|
||||
/* STDIO */
|
||||
#define STDIO_UART USART1
|
||||
|
||||
/* Clocks */
|
||||
|
||||
/* Clock definitions */
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
/* USB */
|
||||
#define USB_TIMER USB_TIMER1
|
||||
|
||||
/* STDIO */
|
||||
#define STDIO_UART UART0
|
||||
|
||||
/* Clocks */
|
||||
|
||||
/* Clock definitions */
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
#define PWM_TIMER_CLOCK cmuClock_TIMER1
|
||||
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
|
||||
|
||||
/* STDIO */
|
||||
#define STDIO_UART USART0
|
||||
|
||||
/* Clocks */
|
||||
|
||||
/* Clock definitions */
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
/* USB */
|
||||
#define USB_TIMER USB_TIMER1
|
||||
|
||||
/* STDIO */
|
||||
#define STDIO_UART UART0
|
||||
|
||||
/* Clocks */
|
||||
|
||||
/* Clock definitions */
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
#define PWM_TIMER_CLOCK cmuClock_TIMER0
|
||||
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC0
|
||||
|
||||
/* STDIO */
|
||||
#define STDIO_UART LEUART0
|
||||
|
||||
/* Clocks */
|
||||
|
||||
/* Clock definitions */
|
||||
|
|
|
@ -567,9 +567,6 @@ static void serial_set_route(serial_t *obj)
|
|||
|
||||
void serial_init(serial_t *obj, PinName tx, PinName rx)
|
||||
{
|
||||
uint32_t baudrate;
|
||||
uint32_t uart_for_stdio = false;
|
||||
|
||||
serial_preinit(obj, tx, rx);
|
||||
|
||||
if(LEUART_REF_VALID(obj->serial.periph.leuart)) {
|
||||
|
@ -590,18 +587,8 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
|
|||
|
||||
CMU_ClockEnable(serial_get_clock(obj), true);
|
||||
|
||||
/* Limitations of board controller: CDC port only supports 115kbaud */
|
||||
if(((tx == STDIO_UART_TX) || (rx == STDIO_UART_RX))
|
||||
&& (obj->serial.periph.uart == (USART_TypeDef*)STDIO_UART )
|
||||
) {
|
||||
baudrate = 115200;
|
||||
uart_for_stdio = true;
|
||||
} else {
|
||||
baudrate = 9600;
|
||||
}
|
||||
|
||||
/* Configure UART for async operation */
|
||||
uart_init(obj, baudrate, ParityNone, 1);
|
||||
uart_init(obj, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE, ParityNone, 1);
|
||||
|
||||
/* Enable pins for UART at correct location */
|
||||
serial_set_route(obj);
|
||||
|
@ -615,7 +602,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
|
|||
}
|
||||
|
||||
/* If this is the UART to be used for stdio, copy it to the stdio_uart struct */
|
||||
if(uart_for_stdio) {
|
||||
if(obj == &stdio_uart) {
|
||||
stdio_uart_inited = 1;
|
||||
memcpy(&stdio_uart, obj, sizeof(serial_t));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue