Skip to content

Commit 29bc945

Browse files
authored
Merge pull request #85 from espressif/master
Fixes UART pin setting + adds CTS/RTS HW Flow Control (espressif#6272)
2 parents 81f27f4 + 50e9772 commit 29bc945

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cores/esp32/esp32-hal-uart.h

+14-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ extern "C" {
4848
#define SERIAL_7O2 0x800003b
4949
#define SERIAL_8O2 0x800003f
5050

51+
// These are Hardware Flow Contol possible usage
52+
// equivalent to UDF enum uart_hw_flowcontrol_t from
53+
// https://github.com/espressif/esp-idf/blob/master/components/hal/include/hal/uart_types.h#L75-L81
54+
#define HW_FLOWCTRL_DISABLE 0x0 // disable HW Flow Control
55+
#define HW_FLOWCTRL_RTS 0x1 // use only RTS PIN for HW Flow Control
56+
#define HW_FLOWCTRL_CTS 0x2 // use only CTS PIN for HW Flow Control
57+
#define HW_FLOWCTRL_CTS_RTS 0x3 // use both CTS and RTS PIN for HW Flow Control
58+
5159
struct uart_struct_t;
5260
typedef struct uart_struct_t uart_t;
5361

@@ -76,7 +84,12 @@ void uartSetDebug(uart_t* uart);
7684
int uartGetDebug();
7785

7886
bool uartIsDriverInstalled(uart_t* uart);
79-
void uartSetPins(uart_t* uart, uint8_t rxPin, uint8_t txPin);
87+
88+
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
89+
void uartSetPins(uart_t* uart, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin);
90+
91+
// Enables or disables HW Flow Control function -- needs also to set CTS and/or RTS pins
92+
void uartSetHwFlowCtrlMode(uart_t *uart, uint8_t mode, uint8_t threshold);
8093

8194
void uartStartDetectBaudrate(uart_t *uart);
8295
unsigned long uartDetectBaudrate(uart_t *uart);

0 commit comments

Comments
 (0)