Problems to build and solutions
Communication between computer and keyboard can be analyzed more than one side. One of the side is keyboard mode. If you need to simulate a keyboard
you need to have a microcontroller that have internal usb support or you can implement some virtual solutions like v-usb. In this project. I decided to choose microcontroller side but it can be expanded to other side too. Maybe in future virtual solutions can be added and overall cost might be decrased.
Second side is sending the key bindings. I solve this problem with a library called pyserial and all transmission works kind like a handshaking method. When a data comes to the microcontroller, it pushes a message that coming message.
2) Key listening
Key listening side solved with keyboard library in python; but there is a point to tell library has some limitations that described in GitHub page and this project build and tested on Windows operating system. It might not work properly on different operating systems. I could not test other operating systems so I can not give any guarantee about that.
3) Data storage
Key macros need to remember when device restart. This problem solved with using EEPROM inside of the microcontroller. EEPROM capacity changes controller by controller but in code you can change how many keys will be stored. I decided to give a upper limit at 30 keystrokes and if you push hotkeys like "ctrl+c" you need to add two more capacity except number of keystrokes because hotkeys has a start and end mark which value is two (not "2", ascii 2). All keys represent in a byte with "ISO 8859-9" encoding, and 16 keys with 30 bytes limit; you need to have 480 bytes space in your EEPROM to use this configration. You can change encoding, upper key limit, etc. too but if you post custom version do not forget to tag me ( :) ).
Warning: All of your applications at your own risk.
If you using this project for cheating you can be banned.