I am writing a USB to PS/2 converter in Arduino and I have a data structure that I would implement like a dictionary if I were using another higher level language. The entries would be something like:
{ 0x29: { name: "esc", make: [0x76], break: [0xfe, 0x76] } }
Here, 0x29 is the USB code for the key, so that's the key for this dictionary lookup. Then, I would use entry.name
for debugging purposes, entry.make
is the array of bytes I need to send when the key is pressed (keyDown) and entry.break
when the key is released (keyUp).
What would be a a way to achieve this in C++?