solderparty / i2c_puppet

MIT License
86 stars 46 forks source link

Cursor keys etc - you can do it yourself #23

Open davebugithub opened 1 year ago

davebugithub commented 1 year ago

Hi,

A lot of these requests are for additional keys to be available. Well, the source code is available here, and since everyone is going to have slightly different preferences, why not do it yourself. It's a challenge, but it's not that hard, as I've just found out.

It turns out grymoire has already done most of the work for us. I had trouble when I used his branch though, so I would suggest cloning the original firmware, then applying this commit: https://github.com/grymoire/i2c_puppet-Linux/commit/cb845dda93cf02760594b36fab6d18411720f584 - it only takes and min, and you can just apply it without understanding it, as I did.

The one thing he didn't get chance to do, was to add cursor keys. This turns out to be easier than expected. In keyboard.c, you can use KEY_JOY_LEFT, KEY_JOY_RIGHT, KEY_JOY_UP and KEY_JOY_DOWN to send the cursor keys, so this is what I've got for my first top row soft key: case KEY_BTN_LEFT1: if (alt) { key = '>'; } else if (shift) { key = '<'; } else if (control) { key =0x1B; // ESC } else { key = KEY_JOY_LEFT; }

When you're happy, change to the i2c_puppet/build directory and do... cmake -DPICO_BOARD=bbq20kbd_breakout -DCMAKE_BUILD_TYPE=Debug .. ...then... make

This will have generated a file called i2c_puppet.uf2 in the app subdirectory of the build directory. Then, you just need to hold down the fourth top row soft key on keyboard, plug it in, and you will see that a RPI-RP2 filesystem appears, and you just copy i2c_puppet.uf2 to the top level. The keyboard will 'reboot' itself, and you'll then have you changes available.

You don't even need a Linux machine to do this. I did it all by installing WSL on Windows 10, which again, is pretty simple.

Good luck