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

STM serial init: Set pin function only if pin is defined (not NC) #12186

Merged
merged 1 commit into from
Jan 7, 2020
Merged
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
5 changes: 2 additions & 3 deletions targets/TARGET_STM/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ static void _serial_init_direct(serial_t *obj, const serial_pinmap_t *pinmap)
MBED_ASSERT(obj_s->index >= 0);

// Configure UART pins
pin_function(pinmap->tx_pin, pinmap->tx_function);
pin_function(pinmap->rx_pin, pinmap->rx_function);

if (pinmap->tx_pin != NC) {
pin_function(pinmap->tx_pin, pinmap->tx_function);
pin_mode(pinmap->tx_pin, PullUp);
}
if (pinmap->rx_pin != NC) {
pin_function(pinmap->rx_pin, pinmap->rx_function);
pin_mode(pinmap->rx_pin, PullUp);
}

Expand Down