Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: serial power port handling #5190

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions radio/src/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,13 @@ void serialInit(uint8_t port_nr, int mode)

serialSetupPort(mode, params);

if (mode == UART_MODE_NONE ||
!port || params.baudrate == 0 ||
if (mode == UART_MODE_NONE ) {
// Even if port has no mode, port power needs to be set
serialSetPowerState(port_nr);
return;
}

if (!port || params.baudrate == 0 ||
!port->uart || !port->uart->init)
return;

Expand Down
8 changes: 8 additions & 0 deletions radio/src/targets/common/arm/stm32/pwr_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ void pwrInit()

hardwareOptions.pcbrev = PCBREV_VALUE();
#endif

// Aux serial port power
#if defined(AUX_SERIAL_PWR_GPIO)
gpio_init(AUX_SERIAL_PWR_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
#endif
#if defined(AUX2_SERIAL_PWR_GPIO)
gpio_init(AUX2_SERIAL_PWR_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
#endif
}

void pwrOn()
Expand Down