1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Use RESOURCE_INDEX when calling IOInit

This commit is contained in:
jflyper 2017-06-16 11:00:13 +09:00
parent e7a02c819c
commit 83299a9313
2 changed files with 5 additions and 3 deletions

View file

@ -58,6 +58,8 @@ static void usartConfigurePinInversion(uartPort_t *uartPort) {
} }
} }
// XXX uartReconfigure does not handle resource management properly.
void uartReconfigure(uartPort_t *uartPort) void uartReconfigure(uartPort_t *uartPort)
{ {
/*RCC_PeriphCLKInitTypeDef RCC_PeriphClkInit; /*RCC_PeriphCLKInitTypeDef RCC_PeriphClkInit;

View file

@ -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 ((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); IOConfigGPIOAF(txIO, ioCfg, af);
if (!(options & SERIAL_INVERTED)) if (!(options & SERIAL_INVERTED))
@ -192,12 +192,12 @@ void serialUARTInitIO(IO_t txIO, IO_t rxIO, portMode_t mode, portOptions_t optio
} else { } else {
ioConfig_t ioCfg = IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, (options & SERIAL_INVERTED) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP); 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) { if ((mode & MODE_TX) && txIO) {
IOInit(txIO, OWNER_SERIAL_TX, index); IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(index));
IOConfigGPIOAF(txIO, ioCfg, af); IOConfigGPIOAF(txIO, ioCfg, af);
} }
if ((mode & MODE_RX) && rxIO) { if ((mode & MODE_RX) && rxIO) {
IOInit(rxIO, OWNER_SERIAL_RX, index); IOInit(rxIO, OWNER_SERIAL_RX, RESOURCE_INDEX(index));
IOConfigGPIOAF(rxIO, ioCfg, af); IOConfigGPIOAF(rxIO, ioCfg, af);
} }
} }