The linked github repository now has a very early version of the firmware. It should be compiled with ch55xduino, just like the other code snippets in the other logs. It is not possible yet to configure which keys are send, it his hardcoded (but straightforward to change) like this:
- Left key: '1'
- Middle key: '2'
- Right key: '3'
- Press knob: 's'
- Turn knob clockwise: 'r'
- Turn knob counterclockwise: 'l'
Next up is to make this easily configurable, without reprogramming the firmware. I'm planning to have the values on the internal eeprom, with an easy way to change them.
A couple things that came up when creating this:
- The USB HID code disables the automatic jump-to-bootloader in ch55xduino, so every time you want to reflash the ch552, you'll have to open up the keypad and connect the testpads connected to P3.6.
- The ch55xduino IDE changed the bootloader access method from P1.5 to GND, to P3.6 to 3v3. This is unfortunate, because programming the chip using P1.5 would be possible without opening up the pad since the right key is connected to the pin adjacent to P1.5, and pulls that to GND when pressed.
- Ch55xduino has examples where you can use both USB CDC and USB HID together (comport + keyboard), but that does not seem to work on my ch552. Only the HID shows up when I connect it to my linux machine.
- The jump-to-bootloader function does not seem to work, which is odd because I use exactly the same code as the USB CDC of ch55xduino, which does work properly also on my chip. So more research is needed here.
- Bootloader access is also needed to write to the EEPROM, which will be used to reconfigure which characters are returned on keypress.
- Debounce is not yet implemented, although I did not notice any bouncing yet.
Concluded, there are some loose ends still in need of wrapup, but the code in https://github.com/biemster/3keys_1knob is already quite usable.
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.