mbed library sources. Supersedes mbed-src.
Fork of mbed by
Diff: targets/hal/TARGET_STM/TARGET_STM32L0/serial_api.c
- Revision:
- 114:fe4fe5cfc3a3
- Parent:
- 0:9b334a45a8ff
- Child:
- 144:ef7eb2e8f9f7
--- a/targets/hal/TARGET_STM/TARGET_STM32L0/serial_api.c Tue Apr 19 11:15:15 2016 +0100 +++ b/targets/hal/TARGET_STM/TARGET_STM32L0/serial_api.c Tue Apr 26 17:15:11 2016 +0100 @@ -91,10 +91,12 @@ MBED_ASSERT(obj->uart != (UARTName)NC); // Enable UART clock +#if defined(USART1_BASE) if (obj->uart == UART_1) { __HAL_RCC_USART1_CLK_ENABLE(); obj->index = 0; } +#endif if (obj->uart == UART_2) { __HAL_RCC_USART2_CLK_ENABLE(); @@ -150,11 +152,13 @@ void serial_free(serial_t *obj) { // Reset UART and disable clock +#if defined(USART1_BASE) if (obj->uart == UART_1) { __HAL_RCC_USART1_FORCE_RESET(); __HAL_RCC_USART1_RELEASE_RESET(); __HAL_RCC_USART1_CLK_DISABLE(); } +#endif if (obj->uart == UART_2) { __HAL_RCC_USART2_FORCE_RESET(); @@ -247,10 +251,12 @@ } } +#if defined(USART1_BASE) static void uart1_irq(void) { uart_irq(UART_1, 0); } +#endif static void uart2_irq(void) { @@ -289,10 +295,12 @@ UartHandle.Instance = (USART_TypeDef *)(obj->uart); +#if defined(USART1_BASE) if (obj->uart == UART_1) { irq_n = USART1_IRQn; vector = (uint32_t)&uart1_irq; } +#endif if (obj->uart == UART_2) { irq_n = USART2_IRQn;