Skip to content

Commit 1dcf154

Browse files
esp32s3 t-display-s3: emulate external pullups
Emulate the external pullup resistors on the GPIO0/GPIO14 buttons of the T-Display-S3. On the physical t-display-s3, this works: pin0 = Pin(0, Pin.IN) pin0.value() # returns 1 (as it should because it's pulled high by an external resistor) But on the emulator, the same code behaves differently: pin0 = Pin(0, Pin.IN) pin0.value() # returns 0 because external pullups weren't emulated Internal pullups have been implemented already in commit cbb15d7 at https://github.com/a159x36/qemu/pull/2/changes so this works: pin0 = Pin(0, Pin.IN, Pin.PULL_UP) pin0.value() # returns 1 when internal pullups are supported Obviously, the more the emulator mimicks the real hardware, the better, so this is another step in the right direction.
1 parent e8d201d commit 1dcf154

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

hw/gpio/esp32s3_gpio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,8 @@ static void ESP32S3_GPIO_reset(Object *dev, ResetType type) {
953953
if(reset_type==4) {
954954
if(i<32) s->gpio_enable=1<<i; else s->gpio_enable1=1<<(i-32);
955955
}
956+
// Emulate the external pullup resistors on the GPIO0/GPIO14 buttons of the T-Display-S3
957+
if (i == 0 || i == 14) v = FIELD_DP32(v, IO_MUX, FUN_WPU, 1);
956958
s->iomux_regs[i+1]=v;
957959
}
958960
}

0 commit comments

Comments
 (0)