Skip to content

Commit 121833a

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 6d6142f commit 121833a

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
@@ -992,6 +992,8 @@ static void ESP32S3_GPIO_reset(Object *dev, ResetType type) {
992992
if(reset_type==4) {
993993
if(i<32) s->gpio_enable=1<<i; else s->gpio_enable1=1<<(i-32);
994994
}
995+
// Emulate the external pullup resistors on the GPIO0/GPIO14 buttons of the T-Display-S3
996+
if (i == 0 || i == 14) v = FIELD_DP32(v, IO_MUX, FUN_WPU, 1);
995997
s->iomux_regs[i+1]=v;
996998
}
997999
for (int i = 0; i < N_GPIOS; i++) {

0 commit comments

Comments
 (0)