File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
ports/espressif/common-hal Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 38
38
#include "supervisor/shared/translate.h"
39
39
#include "supervisor/shared/tick.h"
40
40
41
+ uint8_t never_reset_uart_mask = 0 ;
42
+
41
43
void uart_reset (void ) {
42
44
for (uart_port_t num = 0 ; num < UART_NUM_MAX ; num ++ ) {
43
45
// Ignore the UART used by the IDF.
@@ -46,12 +48,20 @@ void uart_reset(void) {
46
48
continue ;
47
49
}
48
50
#endif
49
- if (uart_is_driver_installed (num )) {
51
+ if (uart_is_driver_installed (num ) && !( never_reset_uart_mask & 1 << num ) ) {
50
52
uart_driver_delete (num );
51
53
}
52
54
}
53
55
}
54
56
57
+ void common_hal_busio_uart_never_reset (busio_uart_obj_t * self ) {
58
+ common_hal_never_reset_pin (self -> rx_pin );
59
+ common_hal_never_reset_pin (self -> tx_pin );
60
+ common_hal_never_reset_pin (self -> rts_pin );
61
+ common_hal_never_reset_pin (self -> cts_pin );
62
+ never_reset_uart_mask |= 1 << self -> uart_num ;
63
+ }
64
+
55
65
void common_hal_busio_uart_construct (busio_uart_obj_t * self ,
56
66
const mcu_pin_obj_t * tx , const mcu_pin_obj_t * rx ,
57
67
const mcu_pin_obj_t * rts , const mcu_pin_obj_t * cts ,
Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ void never_reset_pin_number(gpio_num_t pin_number) {
58
58
}
59
59
60
60
void common_hal_never_reset_pin (const mcu_pin_obj_t * pin ) {
61
+ if (pin == NULL ) {
62
+ return ;
63
+ }
61
64
never_reset_pin_number (pin -> number );
62
65
}
63
66
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ void reset_all_pins(void);
36
36
// need to store a full pointer.
37
37
void reset_pin_number (gpio_num_t pin_number );
38
38
void common_hal_reset_pin (const mcu_pin_obj_t * pin );
39
+ void common_hal_never_reset_pin (const mcu_pin_obj_t * pin );
39
40
void claim_pin (const mcu_pin_obj_t * pin );
40
41
void claim_pin_number (gpio_num_t pin_number );
41
42
bool pin_number_is_free (gpio_num_t pin_number );
You can’t perform that action at this time.
0 commit comments