Skip to content

Commit

Permalink
fix: serial power port handling (#5190)
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc authored and pfeerick committed Jun 19, 2024
1 parent 6d7017b commit a542f3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
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 @@ -81,6 +81,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

0 comments on commit a542f3c

Please sign in to comment.