Skip to content

Commit 6315147

Browse files
committed
[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 HAL
1 parent 1f3003f commit 6315147

File tree

7 files changed

+2
-33
lines changed

7 files changed

+2
-33
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/TARGET_EFM32GG_STK3700/device_peripherals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER1
3838

39-
/* STDIO */
40-
#define STDIO_UART UART0
41-
4239
/* Clocks */
4340

4441
/* Clock definitions */

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/TARGET_EFM32HG_STK3400/device_peripherals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER2
3838

39-
/* STDIO */
40-
#define STDIO_UART USART1
41-
4239
/* Clocks */
4340

4441
/* Clock definitions */

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/TARGET_EFM32LG_STK3600/device_peripherals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER1
3838

39-
/* STDIO */
40-
#define STDIO_UART UART0
41-
4239
/* Clocks */
4340

4441
/* Clock definitions */

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/TARGET_EFM32PG_STK3401/device_peripherals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#define PWM_TIMER_CLOCK cmuClock_TIMER1
3434
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
3535

36-
/* STDIO */
37-
#define STDIO_UART USART0
38-
3936
/* Clocks */
4037

4138
/* Clock definitions */

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/TARGET_EFM32WG_STK3800/device_peripherals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER1
3838

39-
/* STDIO */
40-
#define STDIO_UART UART0
41-
4239
/* Clocks */
4340

4441
/* Clock definitions */

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/TARGET_EFM32ZG_STK3200/device_peripherals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
#define PWM_TIMER_CLOCK cmuClock_TIMER0
3434
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC0
3535

36-
/* STDIO */
37-
#define STDIO_UART LEUART0
38-
3936
/* Clocks */
4037

4138
/* Clock definitions */

targets/TARGET_Silicon_Labs/TARGET_EFM32/serial_api.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,6 @@ static void serial_set_route(serial_t *obj)
567567

568568
void serial_init(serial_t *obj, PinName tx, PinName rx)
569569
{
570-
uint32_t baudrate;
571-
uint32_t uart_for_stdio = false;
572-
573570
serial_preinit(obj, tx, rx);
574571

575572
if(LEUART_REF_VALID(obj->serial.periph.leuart)) {
@@ -590,18 +587,8 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
590587

591588
CMU_ClockEnable(serial_get_clock(obj), true);
592589

593-
/* Limitations of board controller: CDC port only supports 115kbaud */
594-
if(((tx == STDIO_UART_TX) || (rx == STDIO_UART_RX))
595-
&& (obj->serial.periph.uart == (USART_TypeDef*)STDIO_UART )
596-
) {
597-
baudrate = 115200;
598-
uart_for_stdio = true;
599-
} else {
600-
baudrate = 9600;
601-
}
602-
603590
/* Configure UART for async operation */
604-
uart_init(obj, baudrate, ParityNone, 1);
591+
uart_init(obj, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE, ParityNone, 1);
605592

606593
/* Enable pins for UART at correct location */
607594
serial_set_route(obj);
@@ -615,7 +602,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
615602
}
616603

617604
/* If this is the UART to be used for stdio, copy it to the stdio_uart struct */
618-
if(uart_for_stdio) {
605+
if(obj == &stdio_uart) {
619606
stdio_uart_inited = 1;
620607
memcpy(&stdio_uart, obj, sizeof(serial_t));
621608
}

0 commit comments

Comments
 (0)