1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00

PICO: Revert uartPinConfigure code (pending updates for PIO UART) (#14499)

This commit is contained in:
mjs1441 2025-07-02 17:27:49 +01:00 committed by GitHub
parent dd45f9a7fe
commit c390aba083
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -354,10 +354,54 @@ void uartReconfigure(uartPort_t *s)
#endif
}
// revert basic uartPinConfigure for PICO prior to updates for PIO UARTs
void uartPinConfigure(const serialPinConfig_t *pSerialPinConfig)
{
UNUSED(pSerialPinConfig);
// Nothing to do currently for PICO
bprintf("* uartPinConfigure");
for (const uartHardware_t* hardware = uartHardware; hardware < ARRAYEND(uartHardware); hardware++) {
const serialPortIdentifier_e identifier = hardware->identifier;
uartDevice_t* uartdev = uartDeviceFromIdentifier(identifier);
const int resourceIndex = serialResourceIndex(identifier);
if (uartdev == NULL || resourceIndex < 0) {
// malformed uartHardware
bprintf("* uartPinConfigure %p malformed, uartdev %p, resourceIndex %d",hardware, uartdev, resourceIndex);
continue;
}
const ioTag_t cfgRx = pSerialPinConfig->ioTagRx[resourceIndex];
const ioTag_t cfgTx = pSerialPinConfig->ioTagTx[resourceIndex];
bprintf("* uartPinConfigure hw = %p dev = %p, tags rx 0x%x, tx 0x%x", hardware, uartdev, cfgRx, cfgTx);
#if UART_TRAIT_PINSWAP
bool swap = false;
#endif
for (unsigned pindex = 0; pindex < UARTHARDWARE_MAX_PINS; pindex++) {
if (cfgRx && cfgRx == hardware->rxPins[pindex].pin) {
uartdev->rx = hardware->rxPins[pindex];
}
if (cfgTx && cfgTx == hardware->txPins[pindex].pin) {
uartdev->tx = hardware->txPins[pindex];
}
#if UART_TRAIT_PINSWAP
// Check for swapped pins
if (cfgTx && cfgTx == hardware->rxPins[pindex].pin) {
uartdev->tx = hardware->rxPins[pindex];
swap = true;
}
if (cfgRx && cfgRx == hardware->txPins[pindex].pin) {
uartdev->rx = hardware->txPins[pindex];
swap = true;
}
#endif
}
if (uartdev->rx.pin || uartdev->tx.pin ) {
uartdev->hardware = hardware;
#if UART_TRAIT_PINSWAP
uartdev->pinSwap = swap;
#endif
}
}
}
#endif /* USE_UART */