Skip to content

Commit 2148211

Browse files
authored
Merge pull request #337 from tannewt/fix_pin_reset
esp8266: Actually disable pins when reset on reload.
2 parents 5f6df7f + c216c28 commit 2148211

File tree

1 file changed

+5
-1
lines changed
  • esp8266/common-hal/microcontroller

1 file changed

+5
-1
lines changed

esp8266/common-hal/microcontroller/Pin.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "common-hal/microcontroller/Pin.h"
2929
#include "shared-bindings/microcontroller/Pin.h"
3030

31+
#include "py/mphal.h"
32+
3133
#include "eagle_soc.h"
3234

3335
extern volatile bool adc_in_use;
@@ -48,11 +50,13 @@ bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t* pin) {
4850
void reset_pins(void) {
4951
for (int i = 0; i < 17; i++) {
5052
// 5 is RXD, 6 is TXD
51-
if (i == 0 || (i > 4 && i < 13) || i == 12) {
53+
if ((i > 4 && i < 13) || i == 12) {
5254
continue;
5355
}
5456
uint32_t peripheral = PERIPHS_IO_MUX + i * 4;
5557
PIN_FUNC_SELECT(peripheral, 0);
5658
PIN_PULLUP_DIS(peripheral);
59+
// Disable the pin.
60+
gpio_output_set(0x0, 0x0, 0x0, 1 << i);
5761
}
5862
}

0 commit comments

Comments
 (0)