Leonardo - emulated Tastatur - multiple Keys

Hallo an alle,

ich bin grad an einem Projekt für einen MAME-Arcadeautomaten.
Der Leonardo oder ev. Arduino Due sollte die diversen Taster (bis zu 25 Stück) einlesen und an den MAME-PC als Tastatureingabe weitergeben.
Dafür ist DIE Grundvoraussetzung, daß mehrere gleichzeitig gedrückte Tasten möglich sind.
Bei 2 Spielern sind 6 gedrückte Tasten gleichzeitig ganz normal.
Bei diversen Spielen (Street Fighter) können auch locker 10 Tasten gleichzeitig gedrückte sein!!!
Aus der Beschreibung der Keyboard-Library Keyboard - Arduino-Referenz kann ich leider nicht herauslesen, welche Limitierungen vorhanden sind, bzw. was da möglich ist.
Deshalb wäre ich Euch dankbar, wenn jemand genaueres weiß beziehungsweise so etwas schon umgesetzt hat.

thx Reinhard

Hallo,

zu den original Arduinos kenne ich die Details zur Tastaturimplementierung nicht.

Die Doku zu den Teensy Boards deutet aber darauf hin, dass es da allgemeine Begrenzungen beim USB Hid Protokoll gibt.

Auszüge aus
https://www.pjrc.com/teensy/td_keyboard.html

the "Micro Manager Way" allows you to exactly control the 6 possible key slots used by the USB communication sent to your PC

The USB keyboard can have up to 6 normal keys and 4 modifier keys pressed at the same time. To micro manage the keyboard, you use functions to set which combination of keys you want pressed (and zero for the ones you want not pressed), and then use Keyboard.send_now() to send each combination.

USB Keyboard speed is limited to 500 keystrokes per second, and some operating systems may limit the speed to only 62.5 keystrokes per second. There is nothing you can do about these limits. Reading the rest of this section will only help you understand why they exist.

Zumindest die zeitlichen Beschränkungen sind allgemein. Ob diese Slots eine feste Eigenschaft des HID Protokolls sind oder in der Implementierung der Library begründet sind, weiß ich nicht. Die Teensy Tastatur Lib ist etwas anders als die von Arduino. Mehr Tasten gleichzeitig sendet man offenbar in dem man das in Pakete aufteilt.

Ok, habs gefunden. Beim Leonardo ist die Beschränkung auch 6 Tasten plus Modifier:

//  Low level key report: up to 6 keys and shift, ctrl etc at once
typedef struct
{
  uint8_t modifiers;
  uint8_t reserved;
  uint8_t keys[6];
} KeyReport;

class Keyboard_ : public Print
{
private:
  KeyReport _keyReport;
  void sendReport(KeyReport* keys);

Hier wurde vor sechs Jahren darüber diskutiert:

Interessant dabei

The input issue is because of the way that USB keyboard protocol is defined.
[...]
BIOS expects to receive USB keyboard reports in exactly this format.
[...]
Computer OS's however do usually load a full USB processing stack, and there are a few alternative USB keyboard report modes that are part of the normal USB HID protocol
[...]

Mehr Tasten sind möglich. Einfach ist das aber nicht.