
I've decided to use DPI to drive the screen and use 2 PWM pins to output audio, these take up almost all of the GPIO pins and left with only 4 for me to use. I've to figure out a way to control 12 buttons in total with only 4 GPIO pins, otherwise, I've to use teensy and sacrifice an USB port.

@kite linked me to this project call gamegirl: https://hackaday.io/project/10207-gameg ... done-right
They use a very clever way to achieve what I'm looking for, controlling 12 buttons with 4 I/O pins! After doing some research I found out the method they are using is call charliplexing.

How this work is, it will set one pin as output and the other three as input, and then loop through all the pins. Each time a output can only get maximum of 3 inputs. We can set total of 4 pins as output so we can get maximun of 3x4 = 12 inputs.
But, the schematics they provided have some problems, they use one diode for each 3 buttons. This means, if multiple buttons are pushed, it will create false input there for create something call "ghosting".
I improve the schem by adding diode to each button, and the next step will be testing the setup and create a scrip to drive the whole thing. I will post my progress here as well as my build log

