Skip to content

Commit

Permalink
Merge pull request #12186 from mprse/fix_for_issue_12172_stm_serial
Browse files Browse the repository at this point in the history
STM serial init: Set pin function only if pin is defined (not NC)
  • Loading branch information
0xc0170 authored Jan 7, 2020
2 parents 7d8eec4 + 79d16ae commit 5d71e69
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit 5d71e69

Please sign in to comment.