Skip to content

Commit

Permalink
Merge pull request #13862 from jeromecoutant/PR_RTS_FREE
Browse files Browse the repository at this point in the history
STM32 SERIAL: free RTS/CTS pins
  • Loading branch information
0xc0170 authored Nov 5, 2020
2 parents 61bed01 + 73d1c63 commit c877365
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions targets/TARGET_STM/TARGET_STM32L4/serial_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ static void _serial_set_flow_control_direct(serial_t *obj, FlowControl type, con
if (type == FlowControlRTS) {
// Enable RTS
MBED_ASSERT(pinmap->rx_flow_pin != NC);
obj_s->hw_flow_ctl = UART_HWCONTROL_RTS;
obj_s->pin_rts = pinmap->rx_flow_pin;
// Enable the pin for RTS function
pin_function(pinmap->rx_flow_pin, pinmap->rx_flow_function);
Expand Down
9 changes: 9 additions & 0 deletions targets/TARGET_STM/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ void serial_free(serial_t *obj)

pin_function(obj_s->pin_rx, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));

#if DEVICE_SERIAL_FC
if ( (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS) || (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS_CTS) ) {
pin_function(obj_s->pin_rts, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
}
if ( (obj_s->hw_flow_ctl == UART_HWCONTROL_CTS) || (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS_CTS) ) {
pin_function(obj_s->pin_cts, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
}
#endif

serial_irq_ids[obj_s->index] = 0;
}

Expand Down

0 comments on commit c877365

Please sign in to comment.