From 83299a93132d5a2cac9d0182ea5eeb581db01a9a Mon Sep 17 00:00:00 2001 From: jflyper Date: Fri, 16 Jun 2017 11:00:13 +0900 Subject: [PATCH] Use RESOURCE_INDEX when calling IOInit --- src/main/drivers/serial_uart_hal.c | 2 ++ src/main/drivers/serial_uart_stm32f30x.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/drivers/serial_uart_hal.c b/src/main/drivers/serial_uart_hal.c index a21ab9686..fa213eeab 100644 --- a/src/main/drivers/serial_uart_hal.c +++ b/src/main/drivers/serial_uart_hal.c @@ -58,6 +58,8 @@ static void usartConfigurePinInversion(uartPort_t *uartPort) { } } +// XXX uartReconfigure does not handle resource management properly. + void uartReconfigure(uartPort_t *uartPort) { /*RCC_PeriphCLKInitTypeDef RCC_PeriphClkInit; diff --git a/src/main/drivers/serial_uart_stm32f30x.c b/src/main/drivers/serial_uart_stm32f30x.c index 8dd877c94..881d63428 100644 --- a/src/main/drivers/serial_uart_stm32f30x.c +++ b/src/main/drivers/serial_uart_stm32f30x.c @@ -184,7 +184,7 @@ void serialUARTInitIO(IO_t txIO, IO_t rxIO, portMode_t mode, portOptions_t optio ((options & SERIAL_INVERTED) || (options & SERIAL_BIDIR_PP)) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP ); - IOInit(txIO, OWNER_SERIAL_TX, index); + IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(index)); IOConfigGPIOAF(txIO, ioCfg, af); if (!(options & SERIAL_INVERTED)) @@ -192,12 +192,12 @@ void serialUARTInitIO(IO_t txIO, IO_t rxIO, portMode_t mode, portOptions_t optio } else { ioConfig_t ioCfg = IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, (options & SERIAL_INVERTED) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP); if ((mode & MODE_TX) && txIO) { - IOInit(txIO, OWNER_SERIAL_TX, index); + IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(index)); IOConfigGPIOAF(txIO, ioCfg, af); } if ((mode & MODE_RX) && rxIO) { - IOInit(rxIO, OWNER_SERIAL_RX, index); + IOInit(rxIO, OWNER_SERIAL_RX, RESOURCE_INDEX(index)); IOConfigGPIOAF(rxIO, ioCfg, af); } }