在 qemu-stm32 中模拟按钮

Emulate button in qemu-stm32

我 运行 button 演示来自 https://github.com/beckus/stm32_p103_demos on qemu-stm32 https://github.com/beckus/qemu_stm32

我可以在 led_blink 演示中看到 LED 在控制台中以文本 "Led ON" 的形式闪烁,但如何模拟按钮按下?

尝试使用 button_int demo

来自https://github.com/beckus/stm32_p103_demos/blob/master/README

button_int -
    Example of external interrupts.  Toggles the LED every time the
    button is pressed.  Note that in QEMU, the button press is simulated
    by pressing the b key.  You will need to do this from the QEMU monitor,
    by typing the command "sendkey b".

根据自述文件,button 演示并不总是有效:

button -
    Example of using the button in non-interrupt mode.  Continuously polls
    the button and toggles the LED when the button is pressed.  Note that this
    example does not seem to work well in QEMU.  When using "sendkey b"
    (see the button_int demo below), the LED does not toggle.  Perhaps
    this is a timing issue?