pimoroni / keybow-firmware

Keybow Firmware for the Raspberry Pi Zero
Other
182 stars 67 forks source link

Adding keybow-mini example layout for switching 'layers' on the fly #90

Open boatplugs opened 4 months ago

boatplugs commented 4 months ago

I've added an example layout that allows you to define 'layers' that you can swap to on the fly by double pressing a key. There is a new folder called layers where you can place your layer files that will be required when configuring your layout. At the top of the layout file you can require the different layers that you would like to use and then add them to the layers table. The logic for switching is mostly in the layer_changer function and allows setting the delay as a parameter and is designed to cycle through the layers table sequentially and then wrap. There are a few 'global' variables used to keep track of the layer state and time between button presses.

I have included two examples of layers, one of which is for programmers that will facilitate coding workflows and the other has some i3 linux shortcuts. The layers are effectively layouts themselves however they are packed into a table and referenced programmatically in the main layout file so the big difference is the normal functions need to be encapsulated.

Feel free to make or request any changes!