File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
ports/esp32s2/common-hal/microcontroller Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,20 @@ STATIC uint32_t in_use[2];
44
44
bool apa102_mosi_in_use ;
45
45
bool apa102_sck_in_use ;
46
46
47
+ STATIC void floating_gpio_reset (gpio_num_t pin_number ) {
48
+ // This is the same as gpio_reset_pin(), but without the pullup.
49
+ // Note that gpio_config resets the iomatrix to GPIO_FUNC as well.
50
+ gpio_config_t cfg = {
51
+ .pin_bit_mask = BIT64 (pin_number ),
52
+ .mode = GPIO_MODE_DISABLE ,
53
+ .pull_up_en = false,
54
+ .pull_down_en = false,
55
+ .intr_type = GPIO_INTR_DISABLE ,
56
+ };
57
+ gpio_config (& cfg );
58
+ PIN_FUNC_SELECT (GPIO_PIN_MUX_REG [pin_number ], 0 );
59
+ }
60
+
47
61
void never_reset_pin_number (gpio_num_t pin_number ) {
48
62
if (pin_number == -1 ) {
49
63
return ;
@@ -63,6 +77,8 @@ void reset_pin_number(gpio_num_t pin_number) {
63
77
never_reset_pins [pin_number / 32 ] &= ~(1 << pin_number % 32 );
64
78
in_use [pin_number / 32 ] &= ~(1 << pin_number % 32 );
65
79
80
+ floating_gpio_reset (pin_number );
81
+
66
82
#ifdef MICROPY_HW_NEOPIXEL
67
83
if (pin_number == MICROPY_HW_NEOPIXEL -> number ) {
68
84
neopixel_in_use = false;
@@ -83,9 +99,7 @@ void reset_all_pins(void) {
83
99
(never_reset_pins [i / 32 ] & (1 << i % 32 )) != 0 ) {
84
100
continue ;
85
101
}
86
- gpio_set_direction (i , GPIO_MODE_DEF_INPUT );
87
- gpio_pullup_dis (i );
88
- gpio_pulldown_dis (i );
102
+ floating_gpio_reset (i );
89
103
}
90
104
in_use [0 ] = 0 ;
91
105
in_use [1 ] = 0 ;
You can’t perform that action at this time.
0 commit comments