It should work like a normal keyboard does. However, the response time might be a bit slow compared to a normal keyboard. I haven't tried it though. It shouldn't be hard try out with the USB device libraries.
It should work like a normal keyboard does. However, the response time might be a bit slow compared to a normal keyboard. I haven't tried it though. It shouldn't be hard try out with the USB device libraries.
The library is simulating a full Key press including the release of the key. If you want your controller to act like a "normal" keyboard you have to send usb reports yourself with the timing your use case requires. So it is possible to do what you want with Mbed.
Posted just for the case someone ever comes here again.
and thats the reason why:
<<code title=port of USBKeyboard.cpp>>
bool USBKeyboard::keyCode(uint8_t key, uint8_t modifier) {
// Send a simulated keyboard keypress. Returns true if successful.
HID_REPORT report;
report.data[0] = REPORT_ID_KEYBOARD;
report.data[1] = modifier;
report.data[2] = 0;
report.data[3] = keymap[key].usage;
report.data[4] = 0;
report.data[5] = 0;
report.data[6] = 0;
report.data[7] = 0;
report.data[8] = 0;
report.length = 9;
if (!send(&report)) {
return false;
}
report.data[1] = 0;
report.data[3] = 0;
if (!send(&report)) {
return false;
}
return true;
}
<</code>>
The library is simulating a full Key press including the release of the key. If you want your controller to act like a "normal" keyboard you have to send usb reports yourself with the timing your use case requires. So it is possible to do what you want with Mbed.
Posted just for the case someone ever comes here again.
Important Information for this Arm website
This site uses cookies to store information on your computer.
By continuing to use our site, you consent to our cookies.
If you are not happy with the use of these cookies, please review our
Cookie Policy
to learn how they can be disabled.
By disabling cookies, some features of the site will not work.
Access Warning
You do not have the correct permissions to perform this operation.
Hello! Has anybody tried using mbed to emulate USB keyboard and tried it on games? Does it really work like how normal keyboard does? Share please!