mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
handle IDF breaking UART API
This commit is contained in:
1 parent
739d78a45a
commit
434f3f8415
1 file changed
+5
@@ -1,4 +1,5 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "esp_idf_version.h" // < 3.3 not supported, sadly
|
||||||
|
|
||||||
int uart_close(int no) {
|
int uart_close(int no) {
|
||||||
return uart_driver_delete(no);
|
return uart_driver_delete(no);
|
||||||
@@ -18,7 +19,11 @@ int uart_open(int no, int rx, int tx, int cts, int rts, int baud) {
|
|||||||
int e1 = uart_param_config(no, &uart_config);
|
int e1 = uart_param_config(no, &uart_config);
|
||||||
int e2 = uart_set_pin(no, tx, rx, rts, cts);
|
int e2 = uart_set_pin(no, tx, rx, rts, cts);
|
||||||
int e3 =
|
int e3 =
|
||||||
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 5)
|
||||||
|
uart_driver_install(no, UART_HW_FIFO_LEN(no) * 2, UART_HW_FIFO_LEN(no) * 2, 0, NULL, 0);
|
||||||
|
#else
|
||||||
uart_driver_install(no, UART_FIFO_LEN * 2, UART_FIFO_LEN * 2, 0, NULL, 0);
|
uart_driver_install(no, UART_FIFO_LEN * 2, UART_FIFO_LEN * 2, 0, NULL, 0);
|
||||||
|
#endif
|
||||||
MG_INFO(("%d: %d/%d/%d, %d %d %d", no, rx, tx, baud, e1, e2, e3));
|
MG_INFO(("%d: %d/%d/%d, %d %d %d", no, rx, tx, baud, e1, e2, e3));
|
||||||
if (e1 != ESP_OK || e2 != ESP_OK || e3 != ESP_OK) return -1;
|
if (e1 != ESP_OK || e2 != ESP_OK || e3 != ESP_OK) return -1;
|
||||||
return no;
|
return no;
|
||||||
|
|||||||
Reference in new issue
Block a user