The full firmware and downloads for the Slab keyboard project.
Downloads are in the releases section.
This project uses Nix, run nix develop for a development environment, and nix build to build the firmware.
Important
You must be in the nix develop shell for these tasks to work!
Directory: ./build Requires: build
Builds and uploads the firmware to the RP2040.
export PICO_DIR=`findmnt -S LABEL=RPI-RP2 -o TARGET -fn`
cp ./slab.uf2 $PICO_DIRDirectory: ./build Requires: build-dbg
Builds and uploads debug firmware to the RP2040.
export PICO_DIR=`findmnt -S LABEL=RPI-RP2 -o TARGET -fn`
cp ./slab.uf2 $PICO_DIRDirectory: ./build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j $(nproc)Directory: ./build
Builds the keyboard firmware with development outputs.
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . -j $(nproc)
cp compile_commands.json ../ # Copies the autocomplete information for ccls.Deletes the contents of the build directory.
rm -rf ./build
mkdir buildFetches submodules if not already present.
git submodule update --init --recursiveDevices communicate using I²C, but not in the typical way of all devices sharing the same bus.
For each device, I²C bus 1 is set to act as a master that controlls all on-board slaves (OLED screens, etc.), and can control another connected keyboard slave. I²C bus 2 is set to act as a slave, controlled by the bus 1 (master) of another board.
Boards are chained together, with each board's I²C bus 1 connected to the next board's I²C bus 2, in sequence.
Packets are made of 1 packet_type byte, followed by the appropriate amount of bytes for that packet_type.
COM_TYPE_ALIVEis 0 bytes, and is sent continuously to allow boards to know if the board that is controlling them is still alive.COM_TYPE_ACCUMULATION_PACKETis 11 bytes, and contains all the SQUIRREL data, to be accumulated as it travels through the keyboard from right to left.COM_TYPE_WANT_ACCUMULATION_STATUSis 0 bytes and is sent continuously untilCOM_TYPE_DONE_ACCUMULATINGis recieved as a response.COM_TYPE_NOT_DONE_ACCUMULATINGis 11 bytes, all ignored.COM_TYPE_DONE_ACCUMULATINGis 11 bytes, containing the SQUIRREL data, as accumulated, from the leftmost board.
sequenceDiagram
participant Board 1 (L)
participant Board 2
participant Board 3
participant Board 4
participant Board 5 (R)
# First communication.
activate Board 1 (L)
Board 5 (R) ->> Board 4: COM_TYPE_ACCUMULATION_PACKET
Board 4 ->> Board 3: COM_TYPE_ACCUMULATION_PACKET
Board 3 ->> Board 2: COM_TYPE_ACCUMULATION_PACKET
Board 2 ->> Board 1 (L): COM_TYPE_ACCUMULATION_PACKET
Board 5 (R) ->> Board 4: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 4 ->> Board 5 (R): COM_TYPE_NOT_DONE_ACCUMULATING
Board 4 ->> Board 3: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 3 ->> Board 4: COM_TYPE_NOT_DONE_ACCUMULATING
Board 3 ->> Board 2: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 2 ->> Board 3: COM_TYPE_NOT_DONE_ACCUMULATING
Board 2 ->> Board 1 (L): COM_TYPE_WANT_ACCUMULATION_STATUS
Board 1 (L) ->> Board 2: COM_TYPE_DONE_ACCUMULATING
activate Board 2
Board 3 ->> Board 2: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 2 ->> Board 3: COM_TYPE_DONE_ACCUMULATING
activate Board 3
Board 4 ->> Board 3: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 3 ->> Board 4: COM_TYPE_DONE_ACCUMULATING
activate Board 4
Board 5 (R) ->> Board 4: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 4 ->> Board 5 (R): COM_TYPE_DONE_ACCUMULATING
activate Board 5 (R)
# Second communication.
deactivate Board 5 (R)
Board 5 (R) ->> Board 4: COM_TYPE_ACCUMULATION_PACKET
deactivate Board 4
Board 4 ->> Board 3: COM_TYPE_ACCUMULATION_PACKET
deactivate Board 3
Board 3 ->> Board 2: COM_TYPE_ACCUMULATION_PACKET
deactivate Board 2
Board 2 ->> Board 1 (L): COM_TYPE_ACCUMULATION_PACKET
Board 5 (R) ->> Board 4: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 4 ->> Board 5 (R): COM_TYPE_NOT_DONE_ACCUMULATING
Board 4 ->> Board 3: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 3 ->> Board 4: COM_TYPE_NOT_DONE_ACCUMULATING
Board 3 ->> Board 2: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 2 ->> Board 3: COM_TYPE_NOT_DONE_ACCUMULATING
Board 2 ->> Board 1 (L): COM_TYPE_WANT_ACCUMULATION_STATUS
Board 1 (L) ->> Board 2: COM_TYPE_DONE_ACCUMULATING
activate Board 2
Board 3 ->> Board 2: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 2 ->> Board 3: COM_TYPE_DONE_ACCUMULATING
activate Board 3
Board 4 ->> Board 3: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 3 ->> Board 4: COM_TYPE_DONE_ACCUMULATING
activate Board 4
Board 5 (R) ->> Board 4: COM_TYPE_WANT_ACCUMULATION_STATUS
Board 4 ->> Board 5 (R): COM_TYPE_DONE_ACCUMULATING
activate Board 5 (R)
deactivate Board 2
deactivate Board 3
deactivate Board 4
deactivate Board 5 (R)
deactivate Board 1 (L)