beckus / qemu_stm32

QEMU with an STM32 microcontroller implementation
http://beckus.github.io/qemu_stm32/
Other
524 stars 144 forks source link

Emulating BluePill pins from Linux #34

Closed exebook closed 2 years ago

exebook commented 4 years ago

Hey, I want to develop a mechanical keyboard controller based on BluePill, but I want to develop on Qemu STM32. The question is how do I emulate contact on pins that will be connected to actual keyboard switches on the hardware? I already figured, thanks to someone on Stack Overflow I can do send-keys { b } to emulate the onboard button. But pins are probably GPIO but I am still learning this.

This is what I've been able to do so far with QMP:

sleep 0.1s
echo '{ "execute": "qmp_capabilities" }'
sleep 0.1s
echo '{"execute":"send-key","arguments":{"hold-time": 1000, "keys":[{ "type": "qcode", "data": "b" }]}}'
echo '{"execute":"qom-list","arguments":{"path":"/machine/stm32/gpio[c]"}}'
sleep 0.1s
echo '{"execute":"qom-get","arguments":{"path":"/machine/stm32/gpio[c]","property":"gpio[0]"}}'
sleep 0.1s
echo '{"execute":"qom-get","arguments":{"path":"/machine/stm32/gpio[c]","property":"periph"}}'
sleep 0.1s
echo '{"execute":"qom-get","arguments":{"path":"/machine/stm32/gpio[c]","property":"legacy-stm32_rcc"}}'
sleep 0.1s
echo '{"execute":"quit","arguments":{}}'
sleep 0.1s
beckus commented 2 years ago

Sorry I never responded @exebook, I hope you were able to figure this out. Given how much time has passed, I am going to close the issue...