I decided to change the buttons layout of my cpi, from XY AB to AB XY because I felt more confortable that way and the thumb is in a better resting position, also I am really used to a Gameboy Color position
And found out that there is a bit of lack of information at plain sight (There is information, but you need to check the schematics) so I decided to make this guide to save you time for such a straightforward task that took me longer than I expected.
First things first.
If we don´t have it already, we need arduino ide. There is a portable version but I recommend you to install it.
As many arduino clones, they don´t come with the same usb chip as the genuine arduino uno, they come with its chinese counterpart CH340 we need to install the driver in order to use USB to serial and get to see the COM port on Arduino IDE.
We can download it from the manufacturer website: http://www.wch.cn/download/CH341SER_EXE.html
- Windows: http://www.wch.cn/downloads/CH341SER_ZIP.html
- Mac OS: http://www.wch.cn/downloads/CH341SER_MAC_ZIP.html
- Linux: http://www.wch.cn/downloads/CH341SER_LINUX_ZIP.html
Now we need to download the UsbKeyboard library from github and the code of the keypad from here
After we got the UsbKeyboard folder, we need to zip it and include it to our Arduino IDE from Sketch -> Include library -> Add .zip library
Note: You can also install the library by pasting the uncompressed folder in Documents/Arduino/libraries but for the sake of simplicity I explained the other way around.
Now we are ready for the fun part
Connect the keypad via usb to your computer and check on Arduino IDE if it recognises the COM port.
Now that we are here lets configure our board.
Board: Arduino Nano
Port: Chose the arduino comp port, it should be set automatically when recognised.
Programmer: leave it default, should be AVRISP mkII
Now we are set
You can open now the code on the IDE and change what we want. We can hit Upload and watch the flashy lights on our board while we wait.
A succesful upload should look like this: