├── firmware └── VaKeyboard │ ├── sdkconfig.defaults │ ├── .gitignore │ ├── lib │ ├── KeyboardSDK │ │ ├── src │ │ │ ├── Features │ │ │ │ ├── BaseFeature.cpp │ │ │ │ ├── BluetoothFeature.h │ │ │ │ ├── RGBLedFeature.h │ │ │ │ ├── BluetoothFeature.cpp │ │ │ │ ├── BaseFeature.h │ │ │ │ └── RGBLedFeature.cpp │ │ │ ├── HAL │ │ │ │ ├── IBatteryDriver.h │ │ │ │ ├── MCUs │ │ │ │ │ ├── FullBatteryDriver.cpp │ │ │ │ │ ├── TinyS2 │ │ │ │ │ │ ├── BluetoothKeyboardDriver.h │ │ │ │ │ │ ├── config.h │ │ │ │ │ │ ├── UsbHidKeyboardDriver.h │ │ │ │ │ │ └── UsbHidKeyboardDriver.cpp │ │ │ │ │ ├── Micro │ │ │ │ │ │ ├── BluetoothKeyboardDriver.h │ │ │ │ │ │ ├── config.h │ │ │ │ │ │ ├── UsbHidKeyboardDriver.h │ │ │ │ │ │ └── UsbHidKeyboardDriver.cpp │ │ │ │ │ ├── FullBatteryDriver.h │ │ │ │ │ ├── Feather32u4 │ │ │ │ │ │ ├── BatteryDriver.h │ │ │ │ │ │ ├── config.h │ │ │ │ │ │ ├── BatteryDriver.cpp │ │ │ │ │ │ ├── UsbHidKeyboardDriver.h │ │ │ │ │ │ ├── BluetoothKeyboardDriver.h │ │ │ │ │ │ └── UsbHidKeyboardDriver.cpp │ │ │ │ │ ├── TinyS3 │ │ │ │ │ │ ├── config.h │ │ │ │ │ │ ├── UsbHidKeyboardDriver.h │ │ │ │ │ │ ├── BluetoothKeyboardDriver.h │ │ │ │ │ │ └── UsbHidKeyboardDriver.cpp │ │ │ │ │ ├── PortentaH7 │ │ │ │ │ │ ├── config.h │ │ │ │ │ │ ├── UsbHidKeyboardDriver.h │ │ │ │ │ │ ├── BluetoothKeyboardDriver.h │ │ │ │ │ │ └── UsbHidKeyboardDriver.cpp │ │ │ │ │ ├── Feather_ESP32_S3_NOPSRAM │ │ │ │ │ │ ├── config.h │ │ │ │ │ │ ├── UsbHidKeyboardDriver.h │ │ │ │ │ │ ├── UsbHidKeyboardDriver.cpp │ │ │ │ │ │ └── BluetoothKeyboardDriver.h │ │ │ │ │ ├── EmptyBluetoothKeyboardDriver.h │ │ │ │ │ └── EmptyBluetoothKeyboardDriver.cpp │ │ │ │ ├── IPinDriver.h │ │ │ │ ├── IKeyboardDriver.h │ │ │ │ ├── Chips │ │ │ │ │ ├── Tca9548a.cpp │ │ │ │ │ ├── Tca9548a.h │ │ │ │ │ ├── Max7301.h │ │ │ │ │ ├── Is31fl3743a.h │ │ │ │ │ ├── Max7301.cpp │ │ │ │ │ └── Is31fl3743a.cpp │ │ │ │ ├── IRGBLedDriver.h │ │ │ │ ├── SelectiveKeyboardDriver.h │ │ │ │ ├── SelectiveKeyboardDriver.cpp │ │ │ │ └── MCU.h │ │ │ ├── Matrix │ │ │ │ ├── Convertors.h │ │ │ │ ├── MatrixDebouncer.h │ │ │ │ ├── MatrixScanner.h │ │ │ │ ├── MatrixEvaluator.h │ │ │ │ ├── Convertors.cpp │ │ │ │ ├── Matrix.h │ │ │ │ ├── MatrixDebouncer.cpp │ │ │ │ ├── MatrixScanner.cpp │ │ │ │ └── MatrixEvaluator.cpp │ │ │ ├── Logger │ │ │ │ ├── NullLogger.h │ │ │ │ ├── NullLogger.cpp │ │ │ │ └── ILogger.h │ │ │ ├── KeyPressProcessor.h │ │ │ ├── MacroEvaluator.h │ │ │ ├── IKeyboardSDK.h │ │ │ ├── BaseKeyboardDescriptor.h │ │ │ ├── KeyPressProcessor.cpp │ │ │ ├── BaseKeyboardDescriptor.cpp │ │ │ ├── MacroEvaluator.cpp │ │ │ └── KeyCodes.h │ │ ├── library.properties │ │ └── readme.txt │ └── README │ ├── .vscode │ ├── arduino.json │ ├── extensions.json │ └── settings.json │ ├── src │ ├── Drivers │ │ ├── DisplayDriver.cpp │ │ ├── TKL │ │ │ ├── KeyboardDescriptor.h │ │ │ ├── V1 │ │ │ │ ├── KeyboardSDK.h │ │ │ │ ├── PinDriver.h │ │ │ │ ├── RgbLedDriver.h │ │ │ │ ├── KeyboardSDK.cpp │ │ │ │ ├── PinDriver.cpp │ │ │ │ └── RgbLedDriver.cpp │ │ │ ├── V2 │ │ │ │ ├── KeyboardSDK.h │ │ │ │ ├── PinDriver.h │ │ │ │ ├── RgbLedDriver.h │ │ │ │ ├── KeyboardSDK.cpp │ │ │ │ ├── PinDriver.cpp │ │ │ │ └── RgbLedDriver.cpp │ │ │ └── KeyboardDescriptor.cpp │ │ ├── Numpad │ │ │ ├── KeyboardDescriptor.h │ │ │ ├── V2 │ │ │ │ ├── KeyboardSDK.h │ │ │ │ ├── PinDriver.h │ │ │ │ ├── RgbLedDriver.h │ │ │ │ ├── PinDriver.cpp │ │ │ │ ├── KeyboardSDK.cpp │ │ │ │ └── RgbLedDriver.cpp │ │ │ └── KeyboardDescriptor.cpp │ │ └── DisplayDriver.h │ ├── Logger.h │ ├── Logger.cpp │ └── main.cpp │ ├── test │ └── README │ └── include │ └── README ├── pcb ├── TKL Keyboard │ ├── Output │ │ ├── Assembly │ │ │ └── JLCPCB │ │ │ │ ├── vakeyboard-bottom-pos.csv │ │ │ │ └── vakeyboard.csv │ │ └── PCB │ │ │ └── JLCPCB │ │ │ └── vakeyboard-Edge_Cuts.gm1 │ ├── fp-lib-table │ ├── sym-lib-table │ ├── Footprints │ │ ├── MountingHole_M3.kicad_mod │ │ ├── 19-237.kicad_mod │ │ ├── C_0402_1005Metric.kicad_mod │ │ ├── R_0402_1005Metric.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_1u.kicad_mod │ │ ├── D_SOD-523.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_1.5u.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_1.25u.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_1.75u.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_2u.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_2u_90deg.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_2.75u.kicad_mod │ │ ├── CherryMX_PlateMount_HotSwap_2.25u.kicad_mod │ │ └── CherryMX_PlateMount_HotSwap_6.25u.kicad_mod │ └── vakeyboard.kicad_prl └── Numpad Keyboard │ ├── fp-lib-table │ ├── sym-lib-table │ ├── Output │ ├── PCB │ │ └── JLCPCB │ │ │ ├── Numpad-Edge_Cuts.gm1 │ │ │ ├── Numpad-B_Paste.gbp │ │ │ ├── Numpad-NPTH.drl │ │ │ └── Numpad-job.gbrjob │ └── Assembly │ │ └── JLCPCB │ │ ├── Numpad-bottom-pos.csv │ │ ├── Numpad.csv │ │ └── Numpad-top-pos.csv │ └── Numpad.kicad_prl ├── docs ├── build.md ├── images │ ├── pcb_rev1.png │ ├── plate_rev1.png │ ├── plate_tkl.jpg │ ├── case_back.jpeg │ ├── joltfly_rev_1.png │ ├── numpad_angled.jpg │ ├── numpad_pcb.jpg │ ├── numpad_top.jpg │ ├── tkl_rev_2_top.jpg │ ├── case_render_full.png │ ├── keyboard_rev1.png │ ├── pcb_real_back_rev0.png │ ├── tkl_rev_2_detail.jpg │ ├── case_back_connector.jpeg │ ├── case_render_without_pcb.png │ ├── case_top_white_leds.jpeg │ ├── case_top_with_cover.jpeg │ ├── pcb_real_front_rev0.png │ ├── pcb_real_front_rev1.png │ ├── pcb_render_back_rev1.png │ ├── pcb_render_front_rev1.png │ ├── case_render_without_cover.png │ ├── case_render_without_plate.png │ ├── case_top_colorfull_leds.jpeg │ └── pcb_real_front_rev1_colors.png ├── future.md ├── gallery.md ├── manual.md └── revisions │ └── rev1.md ├── .gitattributes ├── .gitignore ├── frame ├── Numpad.json └── TKL.json ├── LICENSE ├── changelog.md └── readme.md /firmware/VaKeyboard/sdkconfig.defaults: -------------------------------------------------------------------------------- 1 | CONFIG_BT_ENABLED=y 2 | CONFIG_BT_CLASSIC_ENABLED=y 3 | CONFIG_BT_SPP_ENABLED=y -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Output/Assembly/JLCPCB/vakeyboard-bottom-pos.csv: -------------------------------------------------------------------------------- 1 | Designator,Val,Package,Mid X,Mid Y,Rotation,Layer -------------------------------------------------------------------------------- /docs/build.md: -------------------------------------------------------------------------------- 1 | # Revisions 2 | 3 | - [Revision 1](./revisions/rev1.md) 4 | - [Revision 2](./revisions/rev2.md) (Work in progress) 5 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Features/BaseFeature.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseFeature.h" 2 | 3 | BaseFeature::BaseFeature() 4 | { 5 | 6 | } -------------------------------------------------------------------------------- /pcb/TKL Keyboard/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name Footprints)(type KiCad)(uri ${KIPRJMOD}/Footprints)(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.png filter=lfs diff=lfs merge=lfs -text 2 | *.jpeg filter=lfs diff=lfs merge=lfs -text 3 | *.jpg filter=lfs diff=lfs merge=lfs -text 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | .vs 3 | **/debug/ 4 | /firmware/Custom/DotnetKeyboard/DotnetKeyboard/DotnetKeyboard/obj 5 | *.zip 6 | *.xml 7 | **/*-backups/** -------------------------------------------------------------------------------- /pcb/TKL Keyboard/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name "vakeyboard")(type "KiCad")(uri "${KIPRJMOD}/vakeyboard.kicad_sym")(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /docs/images/pcb_rev1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:dde648c8c2c0420eea7c03cd8ac45806ca2246e70fc3c817cfc744117f926aad 3 | size 324086 4 | -------------------------------------------------------------------------------- /docs/images/plate_rev1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a5ee42d95afbbc7b0ac0d5a2e02893813cf086043b1648f985fb4f690d10f08e 3 | size 65216 4 | -------------------------------------------------------------------------------- /docs/images/plate_tkl.jpg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:99c859d26f171b60f070801bd79ac841388b1514a34256801fd74dfedf181a45 3 | size 521990 4 | -------------------------------------------------------------------------------- /docs/images/case_back.jpeg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:9600ef0971c5fede0c5c7e7c8b94635ecaff98779526d934a8e9e8a089c921fb 3 | size 2440529 4 | -------------------------------------------------------------------------------- /docs/images/joltfly_rev_1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:cc61f3654f51a32601320374ac1820c11751ac1025b016bd049c31e3224efb85 3 | size 157757 4 | -------------------------------------------------------------------------------- /docs/images/numpad_angled.jpg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e2496e7059deca13399c9803d3eda279bc7d79c32719586c9cb65d69cc02fcd6 3 | size 2619181 4 | -------------------------------------------------------------------------------- /docs/images/numpad_pcb.jpg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:69a3eca5c329aee847c2c65c0b0ed0d7525c473a89c719b593f4d9ce4d950164 3 | size 2937886 4 | -------------------------------------------------------------------------------- /docs/images/numpad_top.jpg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e3bea287e92045b55c25b0b9c2e787f6264377cf51df83e5ba5a5e46689c306d 3 | size 2031186 4 | -------------------------------------------------------------------------------- /docs/images/tkl_rev_2_top.jpg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e863fff5bdd9df8f81163c6470666a34e1544b06cf4b52a7b7464d13661fc2c6 3 | size 2333398 4 | -------------------------------------------------------------------------------- /docs/images/case_render_full.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:908ef41959cad056bbb2f3e3996e177bb0fd3c65623a710ec3a24725069161c6 3 | size 595773 4 | -------------------------------------------------------------------------------- /docs/images/keyboard_rev1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:05fe935c779649283ef0c7da45583ed5b5d0ed9ec1523ddc24ddd2c2816f0a99 3 | size 15008950 4 | -------------------------------------------------------------------------------- /docs/images/pcb_real_back_rev0.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e3262de7be4514692d7be121fe4d501f16281ea50c3d50bec7387a36a83e8f7e 3 | size 5067457 4 | -------------------------------------------------------------------------------- /docs/images/tkl_rev_2_detail.jpg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:3eabd7e2ffbf80e010dd7c72f12f447274b3a4ed5ae3be4a5576896cec23b11d 3 | size 5067585 4 | -------------------------------------------------------------------------------- /docs/images/case_back_connector.jpeg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c4d398ca9835396236bbeabf8f78745bda98523910568a2718f64a8d2e4f7da4 3 | size 2443539 4 | -------------------------------------------------------------------------------- /docs/images/case_render_without_pcb.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c198e525a8d7907b45b0766bf6046e735e24c678abf54eab7d96c6a5cfbc6f19 3 | size 324309 4 | -------------------------------------------------------------------------------- /docs/images/case_top_white_leds.jpeg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:4b803a15b57b6245c814743855387c586323a8f5055081cf731853ab37a49b0d 3 | size 2571420 4 | -------------------------------------------------------------------------------- /docs/images/case_top_with_cover.jpeg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:ee3fadd065ae1ff4a1361d4a9397c16d790a8d033a2849d522e971cca0e51fbd 3 | size 2280772 4 | -------------------------------------------------------------------------------- /docs/images/pcb_real_front_rev0.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:b1efb8817641fe2461acb59beee2ead9f5d1e491c3171462941c0ba18f39d174 3 | size 4736536 4 | -------------------------------------------------------------------------------- /docs/images/pcb_real_front_rev1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5377ce0008d81427999742a46a18dfee3de1a0a5b37fffc41a9f8ab7ef2d8b8a 3 | size 16424188 4 | -------------------------------------------------------------------------------- /docs/images/pcb_render_back_rev1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:2ba62d7e0cb0e3aad429ecabc185df4d7a25bdd8d8c3fdd6f9c90bda0279baba 3 | size 3405146 4 | -------------------------------------------------------------------------------- /docs/images/pcb_render_front_rev1.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:773169f8ce0717581972b4d4bd4063f75db04f92b6ff151d6f7fee5f6fff4d9b 3 | size 5044899 4 | -------------------------------------------------------------------------------- /docs/images/case_render_without_cover.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:fbea0f180ffc01406143b268d8dbc15c16b0e4ad205a37476d95f749bb7bbef8 3 | size 241541 4 | -------------------------------------------------------------------------------- /docs/images/case_render_without_plate.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:64b4472d2208772a3624dda1a6773746514e7189df72d00a275ba3909ffa3d0e 3 | size 279667 4 | -------------------------------------------------------------------------------- /docs/images/case_top_colorfull_leds.jpeg: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:e9bc89f267e9d32df4479ae24cb81ef990c3d16fb82c9dcccf1df8d928a8ab9b 3 | size 2537314 4 | -------------------------------------------------------------------------------- /docs/images/pcb_real_front_rev1_colors.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:6d86cef3bc9c354a685a032e83233a7b8ece7f26b9115f581cd958d19996eca0 3 | size 17139888 4 | -------------------------------------------------------------------------------- /frame/Numpad.json: -------------------------------------------------------------------------------- 1 | {"name":"VaKeyboard Numpad"},["Numlock","Slash","Star","Minus"],["Seven","Eight","Nine",{h:2},"Plus"],["Four","Five","Six"],["One","Two","Three",{h:2},"Enter"],[{w:2},"Zero","Dot"] 2 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/IBatteryDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class IBatteryDriver 6 | { 7 | public: 8 | virtual uint8_t readBatteryLevel() = 0; 9 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/Convertors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Matrix.h" 4 | 5 | class Convertors 6 | { 7 | public: 8 | static char* toString(Matrix* matrix); 9 | }; 10 | -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name "Footprints")(type "KiCad")(uri "C:/Users/vladi/source/repos/vladimir-aubrecht/Keyboard/pcb/TKL Keyboard/Footprints")(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name "vakeyboard")(type "KiCad")(uri "C:/Users/vladi/source/repos/vladimir-aubrecht/Keyboard/pcb/TKL Keyboard/vakeyboard.kicad_sym")(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/FullBatteryDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "FullBatteryDriver.h" 2 | 3 | BatteryDriver::BatteryDriver() 4 | { 5 | } 6 | 7 | uint8_t BatteryDriver::readBatteryLevel() 8 | { 9 | return 100; 10 | } 11 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/library.properties: -------------------------------------------------------------------------------- 1 | name=KeyboardSDK 2 | version=1.0.0 3 | author=vlaub 4 | maintainer=vlaub 5 | sentence=KeyboardSDK Library 6 | paragraph= 7 | category=Uncategorized 8 | url=https://github/KeyboardSDK 9 | architectures=* -------------------------------------------------------------------------------- /firmware/VaKeyboard/.vscode/arduino.json: -------------------------------------------------------------------------------- 1 | { 2 | "port": "/dev/cu.usbserial-0001", 3 | "configuration": "PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none", 4 | "board": "esp32:esp32:esp32" 5 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS2/BluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef TINYS2 4 | 5 | #include "HAL/MCUs/EmptyBluetoothKeyboardDriver.h" 6 | 7 | class BluetoothKeyboardDriver : public EmptyBluetoothKeyboardDriver 8 | { 9 | }; 10 | 11 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Micro/BluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef ARDUINO_MICRO 4 | 5 | #include "HAL/MCUs/EmptyBluetoothKeyboardDriver.h" 6 | 7 | class BluetoothKeyboardDriver : public EmptyBluetoothKeyboardDriver 8 | { 9 | }; 10 | 11 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/IPinDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class IPinDriver 5 | { 6 | public: 7 | virtual uint8_t readPin(uint8_t pinNumber) = 0; 8 | virtual void writePin(uint8_t pinNumber, uint8_t value) = 0; 9 | virtual void refreshCache() = 0; 10 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/FullBatteryDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "HAL/IBatteryDriver.h" 5 | 6 | class BatteryDriver : public IBatteryDriver 7 | { 8 | public: 9 | BatteryDriver(); 10 | 11 | virtual uint8_t readBatteryLevel(); 12 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | - Copyright Vladimír Aubrecht 2021 2 | - No limitations for non-commercial usage. 3 | - Commercial usage is prohibited for every commit commit younger 2 years (commits older 2 years are with no limitations for commercial usage). 4 | - No warranty or guarantees of any kind are provided by contributors, contributors are not responsible for any kind of damage. -------------------------------------------------------------------------------- /firmware/VaKeyboard/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather32u4/BatteryDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER32U4 4 | 5 | #include 6 | #include "HAL/IBatteryDriver.h" 7 | 8 | class BatteryDriver : public IBatteryDriver 9 | { 10 | public: 11 | BatteryDriver(); 12 | 13 | virtual uint8_t readBatteryLevel(); 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/IKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Matrix/Matrix.h" 5 | #include "KeyCodes.h" 6 | 7 | class IKeyboardDriver 8 | { 9 | public: 10 | virtual void ResetPairing() = 0; 11 | virtual void ResetState() = 0; 12 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) = 0; 13 | }; 14 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS2/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef TINYS2 4 | 5 | #include "Arduino.h" 6 | 7 | class McuConfig 8 | { 9 | public: 10 | static const uint8_t csPin = 14; 11 | static const uint8_t mosiPin = 38; 12 | static const uint8_t sclkPin = 36; 13 | static const uint8_t misoPin = 37; 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS3/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef TINYS3 4 | 5 | #include "Arduino.h" 6 | 7 | class McuConfig 8 | { 9 | public: 10 | static const uint8_t csPin = 34; 11 | static const uint8_t mosiPin = 7; 12 | static const uint8_t sclkPin = 36; 13 | static const uint8_t misoPin = 37; 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Micro/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef ARDUINO_MICRO 4 | 5 | #include "Arduino.h" 6 | 7 | class McuConfig 8 | { 9 | public: 10 | static const uint8_t csPin = 11; 11 | static const uint8_t mosiPin = 10; 12 | static const uint8_t sclkPin = 9; 13 | static const uint8_t misoPin = 13; 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather32u4/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER32U4 4 | 5 | #include "Arduino.h" 6 | 7 | class McuConfig 8 | { 9 | public: 10 | static const uint8_t csPin = 11; 11 | static const uint8_t mosiPin = 10; 12 | static const uint8_t sclkPin = 9; 13 | static const uint8_t misoPin = 13; 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/PortentaH7/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef PORTENTA_H7 4 | 5 | #include "Arduino.h" 6 | 7 | class McuConfig 8 | { 9 | public: 10 | static const uint8_t csPin = 11; 11 | static const uint8_t mosiPin = 10; 12 | static const uint8_t sclkPin = 9; 13 | static const uint8_t misoPin = 13; 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/Chips/Tca9548a.cpp: -------------------------------------------------------------------------------- 1 | #include "Tca9548a.h" 2 | 3 | Tca9548a::Tca9548a(uint8_t i2c_addr, TwoWire *wire, ILogger *logger) 4 | { 5 | this->i2c_addr = i2c_addr; 6 | this->wire = wire; 7 | } 8 | 9 | void Tca9548a::selectChannel(uint8_t channelId) 10 | { 11 | wire->beginTransmission(this->i2c_addr); 12 | wire->write(1 << channelId); 13 | wire->endTransmission(); 14 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather_ESP32_S3_NOPSRAM/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER_ESP32_S3_NOPSRAM 4 | 5 | #include "Arduino.h" 6 | 7 | class McuConfig 8 | { 9 | public: 10 | static const uint8_t csPin = 9; 11 | static const uint8_t mosiPin = 6; 12 | static const uint8_t sclkPin = 5; 13 | static const uint8_t misoPin = 10; 14 | }; 15 | 16 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/MatrixDebouncer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "BaseKeyboardDescriptor.h" 4 | 5 | class MatrixDebouncer 6 | { 7 | private: 8 | uint8_t debounceTimeInMs = 2; 9 | uint8_t** lastDebounceTimes; 10 | 11 | public: 12 | MatrixDebouncer(BaseKeyboardDescriptor *keymapProvider, uint8_t debounceTimeInMs); 13 | 14 | bool isDebounced(uint8_t row, uint8_t column); 15 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/DisplayDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "DisplayDriver.h" 2 | 3 | 4 | DisplayDriver::DisplayDriver(SPIClass* spi) 5 | { 6 | this->display = new Adafruit_SSD1331(spi, 7, 6, 8); 7 | display->begin(); 8 | display->fillScreen(BLACK); 9 | display->setTextSize(1); 10 | display->setTextColor(WHITE); 11 | display->setCursor(0, 0); 12 | } 13 | 14 | void DisplayDriver::setText(char* text) 15 | { 16 | display->setCursor(0, 0); 17 | display->print(text); 18 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/Chips/Tca9548a.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include "Logger/ILogger.h" 7 | 8 | class Tca9548a 9 | { 10 | private: 11 | uint8_t i2c_addr = 0; 12 | TwoWire *wire = NULL; 13 | Adafruit_I2CDevice *i2c_dev = NULL; 14 | ILogger *logger = NULL; 15 | 16 | public: 17 | Tca9548a(uint8_t i2c_addr, TwoWire *wire, ILogger *logger); 18 | 19 | void selectChannel(uint8_t channelId); 20 | }; 21 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Logger/ILogger.h" 4 | 5 | class Logger : public ILogger 6 | { 7 | public: 8 | virtual void logDebug(const char *message); 9 | virtual void logWarning(const char *message); 10 | virtual void logError(const char *message); 11 | 12 | virtual void logDebug(const __FlashStringHelper *message); 13 | virtual void logWarning(const __FlashStringHelper *message); 14 | virtual void logError(const __FlashStringHelper *message); 15 | 16 | virtual bool isEnabled(); 17 | }; 18 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/IRGBLedDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Arduino.h" 3 | 4 | class IRGBLedDriver 5 | { 6 | public: 7 | virtual void turnOn() = 0; 8 | virtual void turnOff() = 0; 9 | virtual bool toggle() = 0; 10 | virtual void blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color) = 0; 11 | virtual void randomizeColors() = 0; 12 | virtual void setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity) = 0; 13 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/KeyboardDescriptor.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) 2 | 3 | #pragma once 4 | 5 | 6 | #include "Arduino.h" 7 | #include "BaseKeyboardDescriptor.h" 8 | 9 | class KeyboardDescriptor : public BaseKeyboardDescriptor 10 | { 11 | public: 12 | KeyboardDescriptor(uint8_t numberOfRows, uint8_t numberOfColumns); 13 | 14 | uint8_t getSelectedLayer(Matrix *pressedKeysMatrix); 15 | virtual uint8_t getLayersCount(); 16 | virtual KeyCode *** createKeyMap(); 17 | virtual FeatureMacro** createFeatureMacros(); 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/KeyboardDescriptor.h: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) 2 | 3 | #pragma once 4 | 5 | 6 | #include "Arduino.h" 7 | #include "BaseKeyboardDescriptor.h" 8 | 9 | class KeyboardDescriptor : public BaseKeyboardDescriptor 10 | { 11 | public: 12 | KeyboardDescriptor(uint8_t numberOfRows, uint8_t numberOfColumns); 13 | 14 | uint8_t getSelectedLayer(Matrix *pressedKeysMatrix); 15 | virtual uint8_t getLayersCount(); 16 | virtual KeyCode *** createKeyMap(); 17 | virtual FeatureMacro** createFeatureMacros(); 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/MatrixScanner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HAL/IPinDriver.h" 4 | #include "Matrix.h" 5 | #include "Logger/ILogger.h" 6 | #include "Logger/NullLogger.h" 7 | #include "BaseKeyboardDescriptor.h" 8 | 9 | class MatrixScanner 10 | { 11 | private: 12 | //ILogger *logger; 13 | IPinDriver *pinDriver = NULL; 14 | uint8_t rowCount = 0; 15 | uint8_t columnCount = 0; 16 | 17 | public: 18 | MatrixScanner(IPinDriver *pinDriver, uint8_t rowCount, uint8_t columnCount, ILogger *logger); 19 | Matrix *scanKeyPressMatrix(); 20 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/V2/KeyboardSDK.h: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) && defined(V2) 2 | #pragma once 3 | 4 | #include "Wire.h" 5 | #include "IKeyboardSDK.h" 6 | #include "HAL/IRGBLedDriver.h" 7 | #include "Logger/ILogger.h" 8 | #include "KeyPressProcessor.h" 9 | 10 | class KeyboardSDK : public IKeyboardSDK 11 | { 12 | private: 13 | const uint8_t numberOfRows = 5; 14 | const uint8_t numberOfColumns = 4; 15 | 16 | public: 17 | KeyboardSDK(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin, TwoWire *wire); 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Logger/NullLogger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ILogger.h" 4 | 5 | class NullLogger : public ILogger 6 | { 7 | public: 8 | virtual void logDebug(const char *message); 9 | virtual void logWarning(const char *message); 10 | virtual void logError(const char *message); 11 | 12 | virtual void logDebug(const __FlashStringHelper *message); 13 | virtual void logWarning(const __FlashStringHelper *message); 14 | virtual void logError(const __FlashStringHelper *message); 15 | 16 | virtual bool isEnabled(); 17 | 18 | NullLogger(); 19 | }; 20 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/MatrixEvaluator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Matrix.h" 5 | #include "MatrixDebouncer.h" 6 | 7 | class MatrixEvaluator 8 | { 9 | private: 10 | MatrixDebouncer* matrixDebouncer = NULL; 11 | Matrix* getStateChangeMatrix(Matrix* oldMatrix, Matrix* newMatrix, uint8_t expectedState); 12 | 13 | public: 14 | MatrixEvaluator(MatrixDebouncer* matrixDebouncer); 15 | 16 | Matrix* getPressedKeysMatrix(Matrix* oldMatrix, Matrix* newMatrix); 17 | Matrix* getReleasedKeysMatrix(Matrix* oldMatrix, Matrix* newMatrix); 18 | }; 19 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V1/KeyboardSDK.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V1) 2 | #pragma once 3 | 4 | #include "Wire.h" 5 | #include "IKeyboardSDK.h" 6 | #include "HAL/IRGBLedDriver.h" 7 | #include "Logger/ILogger.h" 8 | #include "KeyPressProcessor.h" 9 | 10 | class KeyboardSDK : public IKeyboardSDK 11 | { 12 | private: 13 | const uint8_t numberOfRows = 6; 14 | const uint8_t numberOfColumns = 17; 15 | 16 | public: 17 | KeyboardSDK(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin, TwoWire *wire, ILogger* logger); 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V2/KeyboardSDK.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V2) 2 | #pragma once 3 | 4 | #include "Wire.h" 5 | #include "IKeyboardSDK.h" 6 | #include "HAL/IRGBLedDriver.h" 7 | #include "Logger/ILogger.h" 8 | #include "KeyPressProcessor.h" 9 | 10 | class KeyboardSDK : public IKeyboardSDK 11 | { 12 | private: 13 | const uint8_t numberOfRows = 6; 14 | const uint8_t numberOfColumns = 17; 15 | 16 | public: 17 | KeyboardSDK(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin, TwoWire *wire, ILogger* logger); 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/Chips/Max7301.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | class Max7301 5 | { 6 | private: 7 | uint8_t csPin = 11; 8 | uint8_t mosiPin = 10; 9 | uint8_t sclkPin = 9; 10 | uint8_t misoPin = 13; 11 | byte transferByte(byte data_out); 12 | uint8_t transferWord(uint8_t higherByte, uint8_t lowerByte); 13 | 14 | public: 15 | Max7301(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin); 16 | void begin(); 17 | uint8_t read(uint8_t address); 18 | void write(uint8_t address, uint8_t value); 19 | void enable(); 20 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Features/BluetoothFeature.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IKeyboardSDK.h" 3 | #include "BaseFeature.h" 4 | #include "RGBLedFeature.h" 5 | 6 | enum BluetoothFeatures : uint8_t 7 | { 8 | BluetoothToggle = 1, 9 | BluetoothReset = 2 10 | }; 11 | 12 | class BluetoothFeature : public BaseFeature 13 | { 14 | private: 15 | IKeyboardSDK* keyboardSDK = NULL; 16 | 17 | void toggleConnection(); 18 | void triggerReset(); 19 | 20 | public: 21 | BluetoothFeature(IKeyboardSDK* keyboardSDK); 22 | 23 | virtual void evaluate(uint8_t featureId); 24 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V2/PinDriver.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V2) 2 | 3 | #pragma once 4 | 5 | #include 6 | #include "HAL/Chips/Max7301.h" 7 | 8 | #include "HAL/IPinDriver.h" 9 | #include "Logger/ILogger.h" 10 | 11 | class PinDriver : public IPinDriver 12 | { 13 | private: 14 | Max7301* max7301; 15 | ILogger *logger = NULL; 16 | uint32_t cache = 0; 17 | 18 | public: 19 | virtual uint8_t readPin(uint8_t pinNumber); 20 | virtual void writePin(uint8_t pinNumber, uint8_t value); 21 | virtual void refreshCache(); 22 | 23 | PinDriver(Max7301* max7301, ILogger *logger); 24 | }; 25 | 26 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/V2/PinDriver.h: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) && defined(V2) 2 | 3 | #pragma once 4 | 5 | #include 6 | #include "HAL/Chips/Max7301.h" 7 | 8 | #include "HAL/IPinDriver.h" 9 | #include "Logger/ILogger.h" 10 | 11 | class PinDriver : public IPinDriver 12 | { 13 | private: 14 | Max7301* max7301; 15 | ILogger *logger = NULL; 16 | uint32_t cache = 0; 17 | 18 | public: 19 | virtual uint8_t readPin(uint8_t pinNumber); 20 | virtual void writePin(uint8_t pinNumber, uint8_t value); 21 | virtual void refreshCache(); 22 | 23 | PinDriver(Max7301* max7301, ILogger *logger); 24 | }; 25 | 26 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/SelectiveKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IKeyboardDriver.h" 3 | 4 | class SelectiveKeyboardDriver : public IKeyboardDriver 5 | { 6 | private: 7 | IKeyboardDriver *keyboard1; 8 | IKeyboardDriver *keyboard2; 9 | IKeyboardDriver *currentKeyboard; 10 | 11 | public: 12 | SelectiveKeyboardDriver(IKeyboardDriver *keyboard1, IKeyboardDriver *keyboard2); 13 | 14 | virtual void ResetPairing(); 15 | virtual void ResetState(); 16 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 17 | virtual IKeyboardDriver *SwapKeyboards(); 18 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS2/UsbHidKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef TINYS2 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "BaseKeyboardDescriptor.h" 7 | #include "USB.h" 8 | #include "USBHIDKeyboard.h" 9 | 10 | class UsbHidKeyboardDriver : public IKeyboardDriver 11 | { 12 | private: 13 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 14 | 15 | public: 16 | UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor); 17 | 18 | virtual void ResetPairing(); 19 | virtual void ResetState(); 20 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 21 | }; 22 | 23 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/DisplayDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define BLACK 0x0000 10 | #define BLUE 0x001F 11 | #define RED 0xF800 12 | #define GREEN 0x07E0 13 | #define CYAN 0x07FF 14 | #define MAGENTA 0xF81F 15 | #define YELLOW 0xFFE0 16 | #define WHITE 0xFFFF 17 | 18 | class DisplayDriver 19 | { 20 | private: 21 | Adafruit_SSD1331* display = NULL; 22 | 23 | public: 24 | DisplayDriver(SPIClass* spi); 25 | void setText(char* text); 26 | }; 27 | -------------------------------------------------------------------------------- /docs/future.md: -------------------------------------------------------------------------------- 1 | # Future plans 2 | 3 | ## Short term 4 | ### QMK 5 | - Rev 1 keyboard is working now with QMK firmware, but bluetooth is not functional as when BT is enabled, keyboard scanning stop to work for some reason (will follow up on it). 6 | - Rev 2 firmware in progress. 7 | 8 | ## Long term 9 | - adding status LEDs or tiny colorful display (if I find some which fits into existing space, this is preferable solution). 10 | - switch for turning keyboard on and off 11 | - better microcontroller with USB-C and more program storage 12 | - gyroscope / accelerometer for movement detection for optimizing wake up experience 13 | - fingerprint sensor 14 | 15 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Logger/NullLogger.cpp: -------------------------------------------------------------------------------- 1 | #include "NullLogger.h" 2 | 3 | NullLogger::NullLogger() 4 | { 5 | } 6 | 7 | void NullLogger::logDebug(const char *message) 8 | { 9 | } 10 | 11 | void NullLogger::logWarning(const char *message) 12 | { 13 | } 14 | 15 | void NullLogger::logError(const char *message) 16 | { 17 | } 18 | 19 | void NullLogger::logDebug(const __FlashStringHelper *message) 20 | { 21 | } 22 | void NullLogger::logWarning(const __FlashStringHelper *message) 23 | { 24 | } 25 | void NullLogger::logError(const __FlashStringHelper *message) 26 | { 27 | } 28 | 29 | bool NullLogger::isEnabled() 30 | { 31 | return false; 32 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather_ESP32_S3_NOPSRAM/UsbHidKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER_ESP32_S3_NOPSRAM 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "BaseKeyboardDescriptor.h" 7 | 8 | #include "USB.h" 9 | #include "USBHIDKeyboard.h" 10 | 11 | class UsbHidKeyboardDriver : public IKeyboardDriver 12 | { 13 | private: 14 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 15 | 16 | public: 17 | UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor); 18 | 19 | virtual void ResetPairing(); 20 | virtual void ResetState(); 21 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 22 | }; 23 | 24 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather32u4/BatteryDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef FEATHER32U4 2 | 3 | #include "BatteryDriver.h" 4 | 5 | BatteryDriver::BatteryDriver() 6 | { 7 | } 8 | 9 | uint8_t BatteryDriver::readBatteryLevel() 10 | { 11 | /* 12 | Following code is simplified code below to save some space in final binary: 13 | 14 | measuredvbat *= 2; // we divided by 2, so multiply back 15 | measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage 16 | measuredvbat /= 1024; // convert to voltage, gives 3.6 - 4.2V 17 | 18 | return (uint8_t)(100 * (measuredvbat - 3.6) / 0.6); 19 | */ 20 | 21 | return (uint8_t)(1.07421875 * analogRead(9) - 600); 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V1/PinDriver.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V1) 2 | 3 | #pragma once 4 | 5 | 6 | #include 7 | #include 8 | 9 | #include "HAL/IPinDriver.h" 10 | #include "Logger/ILogger.h" 11 | 12 | class PinDriver : public IPinDriver 13 | { 14 | private: 15 | Adafruit_MCP23X17 *mcp0 = new Adafruit_MCP23X17(); 16 | Adafruit_MCP23X17 *mcp1 = new Adafruit_MCP23X17(); 17 | //ILogger *logger = NULL; 18 | uint32_t cache = 0; 19 | 20 | public: 21 | virtual uint8_t readPin(uint8_t pinNumber); 22 | virtual void writePin(uint8_t pinNumber, uint8_t value); 23 | virtual void refreshCache(); 24 | 25 | PinDriver(TwoWire *wire, ILogger *logger); 26 | }; 27 | 28 | #endif -------------------------------------------------------------------------------- /frame/TKL.json: -------------------------------------------------------------------------------- 1 | {"name":"VaKeyboard"},["Esc",{x:1},"F1","F2","F3","F4",{x:0.5},"F5","F6","F7","F8",{x:0.5},"F9","F10","F11","F12",{x:0.25},"PrtSc","Scroll Lock","Pause\nBreak"],[{y:0.5},"~\n`","!\n1","@\n2","#\n3","$\n4","%\n5","^\n6","&\n7","*\n8","(\n9",")\n0","_\n-","+\n=",{w:2},"Backspace",{x:0.25},"Insert","Home","PgUp"],[{w:1.5},"Tab","Q","W","E","R","T","Y","U","I","O","P","{\n[","}\n]",{w:1.5},"|\n\\",{x:0.25},"Delete","End","PgDn"],[{w:1.75},"Caps Lock","A","S","D","F","G","H","J","K","L",":\n;","\"\n'",{w:2.25},"Enter"],[{w:2.25},"Shift","Z","X","C","V","B","N","M","<\n,",">\n.","?\n/",{w:2.75},"Shift",{x:1.25},"↑"],[{w:1.25},"Ctrl",{w:1.25},"Win",{w:1.25},"Alt",{a:7,w:6.25},"",{a:4,w:1.25},"Alt",{w:1.25},"Win",{w:1.25},"Menu",{w:1.25},"Ctrl",{x:0.25},"←","↓","→"] 2 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather32u4/UsbHidKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER32U4 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "BaseKeyboardDescriptor.h" 7 | 8 | class UsbHidKeyboardDriver : public IKeyboardDriver 9 | { 10 | private: 11 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 12 | bool isKeyMenuHold = false; // Temporary hack, will be replaced by status matrix extracted from bluetooth keyboard one layer upper (matrix after debouncing is needed...) 13 | 14 | public: 15 | UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor); 16 | 17 | virtual void ResetPairing(); 18 | virtual void ResetState(); 19 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 20 | }; 21 | 22 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Micro/UsbHidKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef ARDUINO_MICRO 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "BaseKeyboardDescriptor.h" 7 | 8 | class UsbHidKeyboardDriver : public IKeyboardDriver 9 | { 10 | private: 11 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 12 | bool isKeyMenuHold = false; // Temporary hack, will be replaced by status matrix extracted from bluetooth keyboard one layer upper (matrix after debouncing is needed...) 13 | 14 | public: 15 | UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor); 16 | 17 | virtual void ResetPairing(); 18 | virtual void ResetState(); 19 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 20 | }; 21 | 22 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "Logger.h" 2 | 3 | inline void Logger::logDebug(const char *message) 4 | { 5 | Serial.println(message); 6 | } 7 | 8 | inline void Logger::logWarning(const char *message) 9 | { 10 | Serial.println(message); 11 | } 12 | 13 | inline void Logger::logError(const char *message) 14 | { 15 | Serial.println(message); 16 | } 17 | 18 | inline void Logger::logDebug(const __FlashStringHelper *message) 19 | { 20 | Serial.println(message); 21 | } 22 | inline void Logger::logWarning(const __FlashStringHelper *message) 23 | { 24 | Serial.println(message); 25 | } 26 | inline void Logger::logError(const __FlashStringHelper *message) 27 | { 28 | Serial.println(message); 29 | } 30 | 31 | inline bool Logger::isEnabled() 32 | { 33 | return true; 34 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/PortentaH7/UsbHidKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef PORTENTA_H7 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "BaseKeyboardDescriptor.h" 7 | 8 | 9 | #include "PluggableUSBHID.h" 10 | #include "USBKeyboard.h" 11 | 12 | class UsbHidKeyboardDriver : public IKeyboardDriver 13 | { 14 | private: 15 | USBKeyboard Keyboard; 16 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 17 | 18 | private: 19 | uint8_t ScanForModificators(Matrix *matrix, KeyCode **keymapProvider); 20 | 21 | public: 22 | UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor); 23 | 24 | virtual void ResetPairing(); 25 | virtual void ResetState(); 26 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 27 | }; 28 | 29 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/EmptyBluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HAL/IKeyboardDriver.h" 4 | #include "Logger/ILogger.h" 5 | #include "Logger/NullLogger.h" 6 | 7 | #include "HAL/IBatteryDriver.h" 8 | #include "BaseKeyboardDescriptor.h" 9 | 10 | 11 | class EmptyBluetoothKeyboardDriver : public IKeyboardDriver 12 | { 13 | 14 | public: 15 | EmptyBluetoothKeyboardDriver(); 16 | 17 | virtual void Init(); 18 | virtual void ResetPairing(); 19 | virtual void ResetState(); 20 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 21 | 22 | static EmptyBluetoothKeyboardDriver* Create(IBatteryDriver* batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 23 | static EmptyBluetoothKeyboardDriver* GetInstance(); 24 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS3/UsbHidKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef TINYS3 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "BaseKeyboardDescriptor.h" 7 | #include "USB.h" 8 | #include "USBHIDKeyboard.h" 9 | 10 | class UsbHidKeyboardDriver : public IKeyboardDriver 11 | { 12 | private: 13 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 14 | bool isKeyMenuHold = false; // Temporary hack, will be replaced by status matrix extracted from bluetooth keyboard one layer upper (matrix after debouncing is needed...) 15 | 16 | public: 17 | UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor); 18 | 19 | virtual void ResetPairing(); 20 | virtual void ResetState(); 21 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 22 | }; 23 | 24 | #endif -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/MountingHole_M3.kicad_mod: -------------------------------------------------------------------------------- 1 | (module MountingHole_M3 (layer F.Cu) (tedit 604D81D5) 2 | (descr "Mounting Hole 2.2mm, no annular, M2, ISO7380") 3 | (tags "mounting hole 2.2mm no annular m2 iso7380") 4 | (attr virtual) 5 | (fp_text reference REF** (at 0 -2.75) (layer F.SilkS) hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | ) 8 | (fp_text value MountingHole_M3 (at 0 2.75) (layer F.Fab) hide 9 | (effects (font (size 1 1) (thickness 0.15))) 10 | ) 11 | (fp_circle (center 0 0) (end 2 0) (layer F.CrtYd) (width 0.05)) 12 | (fp_circle (center 0 0) (end 1.75 0) (layer Cmts.User) (width 0.15)) 13 | (fp_text user %R (at 0.3 0) (layer F.Fab) 14 | (effects (font (size 1 1) (thickness 0.15))) 15 | ) 16 | (pad "" np_thru_hole circle (at 0 0) (size 3 3) (drill 3) (layers *.Cu *.Mask)) 17 | ) 18 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/V2/RgbLedDriver.h: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) && defined(V2) 2 | 3 | #pragma once 4 | 5 | 6 | #include "HAL/Chips/Is31fl3743a.h" 7 | #include "HAL/IRGBLedDriver.h" 8 | 9 | class RgbLedDriver : public IRGBLedDriver 10 | { 11 | private: 12 | Is31fl3743a *controller1 = NULL; 13 | Is31fl3743a *controller2 = NULL; 14 | ILogger *logger = NULL; 15 | uint8_t rowsCount = 0; 16 | uint8_t columnCount = 0; 17 | 18 | public: 19 | RgbLedDriver(ILogger *logger, uint8_t rowsCount, uint8_t columnCount); 20 | virtual void turnOn(); 21 | virtual void turnOff(); 22 | virtual bool toggle(); 23 | virtual void blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color); 24 | virtual void randomizeColors(); 25 | virtual void setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity); 26 | }; 27 | 28 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V1/RgbLedDriver.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V1) 2 | 3 | #pragma once 4 | 5 | 6 | #include "HAL/Chips/Is31fl3743a.h" 7 | #include "HAL/IRGBLedDriver.h" 8 | 9 | class RgbLedDriver : public IRGBLedDriver 10 | { 11 | private: 12 | Is31fl3743a *controller1 = NULL; 13 | Is31fl3743a *controller2 = NULL; 14 | //ILogger *logger = NULL; 15 | uint8_t rowsCount = 0; 16 | uint8_t columnCount = 0; 17 | 18 | public: 19 | RgbLedDriver(ILogger *logger, uint8_t rowsCount, uint8_t columnCount); 20 | virtual void turnOn(); 21 | virtual void turnOff(); 22 | virtual bool toggle(); 23 | virtual void blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color); 24 | virtual void randomizeColors(); 25 | virtual void setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity); 26 | }; 27 | 28 | 29 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/EmptyBluetoothKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "EmptyBluetoothKeyboardDriver.h" 2 | 3 | EmptyBluetoothKeyboardDriver::EmptyBluetoothKeyboardDriver() 4 | { 5 | } 6 | 7 | void EmptyBluetoothKeyboardDriver::ResetPairing() 8 | { 9 | 10 | } 11 | 12 | void EmptyBluetoothKeyboardDriver::Init() 13 | { 14 | 15 | } 16 | 17 | bool EmptyBluetoothKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 18 | { 19 | return false; 20 | } 21 | 22 | void EmptyBluetoothKeyboardDriver::ResetState() 23 | { 24 | 25 | } 26 | 27 | EmptyBluetoothKeyboardDriver* EmptyBluetoothKeyboardDriver::Create(IBatteryDriver* batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger) 28 | { 29 | return NULL; 30 | } 31 | 32 | EmptyBluetoothKeyboardDriver* EmptyBluetoothKeyboardDriver::GetInstance() 33 | { 34 | return NULL; 35 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/Convertors.cpp: -------------------------------------------------------------------------------- 1 | #include "Convertors.h" 2 | 3 | char *Convertors::toString(Matrix *matrix) 4 | { 5 | uint8_t stringRowLength = matrix->numberOfColumns + 1; 6 | uint8_t stringLength = matrix->numberOfRows * stringRowLength + 1; 7 | char *matrixString = new char[stringLength]; 8 | 9 | for (uint8_t rowIndex = 0; rowIndex < matrix->numberOfRows; rowIndex++) 10 | { 11 | uint32_t row = matrix->matrixData[rowIndex]; 12 | 13 | for (uint8_t columnIndex = 0; columnIndex < matrix->numberOfColumns; columnIndex++) 14 | { 15 | char bit = ((row >> columnIndex) & 1) == 1 ? '1' : '0'; 16 | matrixString[rowIndex * stringRowLength + columnIndex] = bit; 17 | } 18 | 19 | matrixString[rowIndex * stringRowLength + matrix->numberOfColumns] = '\n'; 20 | } 21 | 22 | matrixString[stringLength - 1] = '\0'; 23 | 24 | return matrixString; 25 | } 26 | -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/PCB/JLCPCB/Numpad-Edge_Cuts.gm1: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(6.0.5)* 2 | G04 #@! TF.CreationDate,2022-07-11T19:37:47+02:00* 3 | G04 #@! TF.ProjectId,Numpad,4e756d70-6164-42e6-9b69-6361645f7063,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Profile,NP* 6 | %FSLAX46Y46*% 7 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 8 | G04 Created by KiCad (PCBNEW (6.0.5)) date 2022-07-11 19:37:47* 9 | %MOMM*% 10 | %LPD*% 11 | G01* 12 | G04 APERTURE LIST* 13 | G04 #@! TA.AperFunction,Profile* 14 | %ADD10C,0.200000*% 15 | G04 #@! TD* 16 | G04 APERTURE END LIST* 17 | D10* 18 | X104294000Y-22860000D02* 19 | X21844000Y-22860000D01* 20 | X21844000Y-150860000D02* 21 | X104294000Y-150860000D01* 22 | X104294000Y-150860000D02* 23 | X104294000Y-22860000D01* 24 | X21844000Y-22860000D02* 25 | X21844000Y-150860000D01* 26 | M02* 27 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Features/RGBLedFeature.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IKeyboardSDK.h" 3 | #include "BaseFeature.h" 4 | 5 | enum RGBLedFeatures : uint8_t 6 | { 7 | RGBLedTurnOn = 3, 8 | RGBLedTurnOff = 4, 9 | RGBLedSuspend = 5, 10 | RGBLedRandomColors = 6, 11 | RGBLedBatteryLevel = 7, 12 | RGBLedToggle = 8, 13 | RGBLedWake = 9 14 | }; 15 | 16 | class RGBLedFeature : public BaseFeature 17 | { 18 | private: 19 | IKeyboardSDK* keyboardSDK = NULL; 20 | 21 | void turnOff(); 22 | void turnOn(); 23 | void randomizeColors(); 24 | void toggle(); 25 | void showBatteryLevel(); 26 | 27 | RGBLedFeatures currentState; 28 | RGBLedFeatures stateAtSuspend; 29 | 30 | public: 31 | RGBLedFeature(IKeyboardSDK* keyboardSDK); 32 | 33 | virtual void evaluate(uint8_t featureId); 34 | }; -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Output/PCB/JLCPCB/vakeyboard-Edge_Cuts.gm1: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(6.0.5)* 2 | G04 #@! TF.CreationDate,2022-10-12T22:06:10+02:00* 3 | G04 #@! TF.ProjectId,vakeyboard,76616b65-7962-46f6-9172-642e6b696361,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Profile,NP* 6 | %FSLAX46Y46*% 7 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 8 | G04 Created by KiCad (PCBNEW (6.0.5)) date 2022-10-12 22:06:10* 9 | %MOMM*% 10 | %LPD*% 11 | G01* 12 | G04 APERTURE LIST* 13 | G04 #@! TA.AperFunction,Profile* 14 | %ADD10C,0.050000*% 15 | G04 #@! TD* 16 | G04 APERTURE END LIST* 17 | D10* 18 | X26690000Y-85000000D02* 19 | X375690000Y-85000000D01* 20 | X375690000Y-85000000D02* 21 | X375690000Y-213000000D01* 22 | X26690000Y-213000000D02* 23 | X26690000Y-85000000D01* 24 | X26690000Y-213000000D02* 25 | X375690000Y-213000000D01* 26 | M02* 27 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V2/RgbLedDriver.h: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V2) 2 | 3 | #pragma once 4 | 5 | #include "HAL/Chips/Is31fl3743a.h" 6 | #include "HAL/Chips/Tca9548a.h" 7 | #include "HAL/IRGBLedDriver.h" 8 | 9 | class RgbLedDriver : public IRGBLedDriver 10 | { 11 | private: 12 | Is31fl3743a **controllers = NULL; 13 | uint8_t controllersCount = 9; 14 | Tca9548a* tca = NULL; 15 | ILogger *logger = NULL; 16 | uint8_t rowsCount = 0; 17 | uint8_t columnCount = 0; 18 | 19 | public: 20 | RgbLedDriver(ILogger *logger, uint8_t rowsCount, uint8_t columnCount, Tca9548a* tca); 21 | virtual void turnOn(); 22 | virtual void turnOff(); 23 | virtual bool toggle(); 24 | virtual void blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color); 25 | virtual void randomizeColors(); 26 | virtual void setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity); 27 | }; 28 | 29 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/KeyPressProcessor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "HAL/IKeyboardDriver.h" 4 | #include "Matrix/MatrixEvaluator.h" 5 | #include "Matrix/Convertors.h" 6 | #include "Matrix/MatrixScanner.h" 7 | #include "Matrix/MatrixEvaluator.h" 8 | #include "BaseKeyboardDescriptor.h" 9 | #include "Logger/ILogger.h" 10 | #include "Logger/NullLogger.h" 11 | #include "MacroEvaluator.h" 12 | 13 | class KeyPressProcessor 14 | { 15 | private: 16 | MatrixScanner *matrixScanner; 17 | MatrixEvaluator *matrixEvaluator; 18 | IKeyboardDriver *keyboardDriver; 19 | BaseKeyboardDescriptor *keyboardDescriptor; 20 | MacroEvaluator* macroEvaluator; 21 | //ILogger *logger; 22 | 23 | Matrix *previousMatrix = NULL; 24 | 25 | public: 26 | KeyPressProcessor(MatrixScanner *matrixScanner, MatrixEvaluator *matrixEvaluator, IKeyboardDriver *keyboardDriver, BaseKeyboardDescriptor *keyboardDescriptor, MacroEvaluator* macroEvaluator, ILogger *logger); 27 | void scan(); 28 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/Matrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct Matrix 5 | { 6 | public: 7 | uint32_t *matrixData; 8 | uint8_t numberOfRows; 9 | uint8_t numberOfColumns; 10 | 11 | Matrix(uint8_t numberOfRows, uint8_t numberOfColumns) 12 | { 13 | this->matrixData = new uint32_t[numberOfRows]; 14 | 15 | for (uint8_t row = 0; row < numberOfRows; row++) 16 | { 17 | this->matrixData[row] = 0; 18 | } 19 | 20 | this->numberOfRows = numberOfRows; 21 | this->numberOfColumns = numberOfColumns; 22 | } 23 | 24 | Matrix(uint32_t *matrixData, uint8_t numberOfRows, uint8_t numberOfColumns) 25 | { 26 | this->matrixData = matrixData; 27 | this->numberOfRows = numberOfRows; 28 | this->numberOfColumns = numberOfColumns; 29 | } 30 | 31 | ~Matrix() 32 | { 33 | delete[] matrixData; 34 | } 35 | 36 | uint8_t getBit(uint8_t row, uint8_t column) 37 | { 38 | return (this->matrixData[row] >> column) & 1; 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Logger/ILogger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class ILogger 6 | { 7 | public: 8 | virtual void logDebug(const char *message) = 0; 9 | virtual void logWarning(const char *message) = 0; 10 | virtual void logError(const char *message) = 0; 11 | 12 | virtual void logDebug(const __FlashStringHelper *message) = 0; 13 | virtual void logWarning(const __FlashStringHelper *message) = 0; 14 | virtual void logError(const __FlashStringHelper *message) = 0; 15 | 16 | void logDebug(uint8_t argument) 17 | { 18 | char buffer[3]; 19 | sprintf(buffer, "%x", argument); 20 | 21 | logDebug(buffer); 22 | } 23 | 24 | void logWarning(uint8_t argument) 25 | { 26 | char buffer[3]; 27 | sprintf(buffer, "%x", argument); 28 | 29 | logWarning(buffer); 30 | } 31 | 32 | void logError(uint8_t argument) 33 | { 34 | char buffer[3]; 35 | sprintf(buffer, "%x", argument); 36 | 37 | logError(buffer); 38 | } 39 | 40 | virtual bool isEnabled() = 0; 41 | }; 42 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/MacroEvaluator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Matrix/Matrix.h" 3 | #include "BaseKeyboardDescriptor.h" 4 | #include "Features/BaseFeature.h" 5 | 6 | class MacroEvaluator 7 | { 8 | private: 9 | BaseKeyboardDescriptor* keyboardDescriptor; 10 | BaseFeature** registeredFeatures = NULL; 11 | uint8_t registeredFeatureCount = 0; 12 | 13 | void evaluateAllFeatures(uint8_t featureId); 14 | 15 | public: 16 | struct MacroEvaluatorContext 17 | { 18 | public: 19 | unsigned long LastKeyPressTime; 20 | 21 | MacroEvaluatorContext() 22 | { 23 | LastKeyPressTime = millis(); 24 | } 25 | 26 | }; 27 | 28 | MacroEvaluator(BaseKeyboardDescriptor* keyboardDescriptor); 29 | 30 | bool evaluate(Matrix *matrix); 31 | void registerFeature(BaseFeature* feature); 32 | 33 | private: 34 | MacroEvaluatorContext* context; 35 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Features/BluetoothFeature.cpp: -------------------------------------------------------------------------------- 1 | #include "BluetoothFeature.h" 2 | 3 | BluetoothFeature::BluetoothFeature(IKeyboardSDK* keyboardSDK) 4 | { 5 | this->keyboardSDK = keyboardSDK; 6 | } 7 | 8 | void BluetoothFeature::toggleConnection() 9 | { 10 | SelectiveKeyboardDriver* kb = ((SelectiveKeyboardDriver*)this->keyboardSDK->GetActiveKeyboardDriver()); 11 | kb->ResetState(); 12 | kb->SwapKeyboards(); 13 | } 14 | 15 | void BluetoothFeature::triggerReset() 16 | { 17 | this->keyboardSDK->GetActiveKeyboardDriver()->ResetPairing(); 18 | } 19 | 20 | void BluetoothFeature::evaluate(uint8_t featureId) 21 | { 22 | if (BluetoothKeyboardDriver::GetInstance() != NULL) 23 | { 24 | switch (featureId) 25 | { 26 | case BluetoothFeatures::BluetoothToggle: 27 | this->toggleConnection(); 28 | break; 29 | 30 | case BluetoothFeatures::BluetoothReset: 31 | this->triggerReset(); 32 | break; 33 | 34 | default: 35 | break; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/Chips/Is31fl3743a.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include "Logger/ILogger.h" 7 | 8 | class Is31fl3743a 9 | { 10 | private: 11 | uint8_t i2c_addr = 0; 12 | TwoWire *wire = NULL; 13 | Adafruit_I2CDevice *i2c_dev = NULL; 14 | ILogger *logger = NULL; 15 | uint8_t columnMask = 0; 16 | uint8_t rowCount = 0; 17 | uint8_t columnCount = 0; 18 | 19 | uint8_t currentGlobalIntensity = 0; 20 | 21 | // Factors are taking luminosity from datasheet of 19-237-R6GHBHC-A04-2T RGB LED and transforming them to same base. Blue is reference value. 22 | float redFactor = 2.0; 23 | float greenFactor = 3.93; 24 | float blueFactor = 1.0; 25 | 26 | 27 | public: 28 | Is31fl3743a(uint8_t i2c_addr, TwoWire *wire, ILogger *logger, uint8_t columnMask, uint8_t rowCount, uint8_t columnCount, uint8_t maxCurrent); 29 | void setLedIntensities(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity); 30 | void setGlobalIntensity(uint8_t intensity); 31 | uint8_t getGlobalIntensity(); 32 | }; 33 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/SelectiveKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #include "SelectiveKeyboardDriver.h" 2 | 3 | SelectiveKeyboardDriver::SelectiveKeyboardDriver(IKeyboardDriver *keyboard1, IKeyboardDriver *keyboard2) 4 | { 5 | this->keyboard1 = keyboard1; 6 | this->keyboard2 = keyboard2; 7 | this->currentKeyboard = this->keyboard1; 8 | } 9 | 10 | void SelectiveKeyboardDriver::ResetPairing() 11 | { 12 | this->currentKeyboard->ResetPairing(); 13 | } 14 | bool SelectiveKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 15 | { 16 | return this->currentKeyboard->SendKeys(pressedKeysMatrix, releasedKeysMatrix); 17 | } 18 | 19 | IKeyboardDriver *SelectiveKeyboardDriver::SwapKeyboards() 20 | { 21 | if (this->currentKeyboard == this->keyboard1) 22 | { 23 | this->currentKeyboard = this->keyboard2; 24 | } 25 | else 26 | { 27 | this->currentKeyboard = this->keyboard1; 28 | } 29 | 30 | this->ResetState(); 31 | 32 | return this->currentKeyboard; 33 | } 34 | 35 | void SelectiveKeyboardDriver::ResetState() 36 | { 37 | this->currentKeyboard->ResetState(); 38 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/MatrixDebouncer.cpp: -------------------------------------------------------------------------------- 1 | #include "MatrixDebouncer.h" 2 | 3 | MatrixDebouncer::MatrixDebouncer(BaseKeyboardDescriptor *keyboardDescriptor, uint8_t debounceTimeInMs) 4 | { 5 | this->debounceTimeInMs = debounceTimeInMs; 6 | uint8_t rowsCount = keyboardDescriptor->getRowCount(); 7 | uint8_t columnCount = keyboardDescriptor->getColumnCount(); 8 | 9 | this->lastDebounceTimes = new uint8_t*[rowsCount]; 10 | 11 | for (uint8_t row = 0; row < rowsCount; row++) 12 | { 13 | this->lastDebounceTimes[row] = new uint8_t[columnCount]; 14 | 15 | for (uint8_t column = 0; column < columnCount; column++) 16 | { 17 | this->lastDebounceTimes[row][column] = 0; 18 | } 19 | } 20 | } 21 | 22 | bool MatrixDebouncer::isDebounced(uint8_t row, uint8_t column) 23 | { 24 | uint8_t currentTime = millis(); 25 | if (this->lastDebounceTimes[row][column] == 0) 26 | { 27 | this->lastDebounceTimes[row][column] = currentTime - this->debounceTimeInMs; 28 | return true; 29 | } 30 | 31 | if (currentTime - this->lastDebounceTimes[row][column] >= this->debounceTimeInMs) 32 | { 33 | this->lastDebounceTimes[row][column] += this->debounceTimeInMs; 34 | return true; 35 | } 36 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/V2/PinDriver.cpp: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) && defined(V2) 2 | 3 | #include "PinDriver.h" 4 | 5 | void PinDriver::refreshCache() 6 | { 7 | uint32_t banks = 0; 8 | 9 | /* 10 | Ports 19 - 26: 0x53 11 | */ 12 | 13 | banks |= this->max7301->read(0x53); 14 | 15 | cache = banks >> 4; 16 | } 17 | 18 | uint8_t PinDriver::readPin(uint8_t pinNumber) 19 | { 20 | uint32_t mask = (1 << (3 - pinNumber)); 21 | uint8_t result = ((cache & mask) >> (3 - pinNumber)); 22 | 23 | return (~result) & 0b00000001; 24 | } 25 | 26 | void PinDriver::writePin(uint8_t pinNumber, uint8_t value) 27 | { 28 | /* 29 | 27: 0x3B 30 | 28: 0x3C 31 | 29: 0x3D 32 | 30: 0x3E 33 | 31: 0x3F 34 | */ 35 | 36 | this->max7301->write(0x3B + pinNumber, value); 37 | } 38 | 39 | PinDriver::PinDriver(Max7301* max7301, ILogger *logger) 40 | { 41 | this->max7301 = max7301; 42 | this->max7301->begin(); 43 | this->max7301->enable(); 44 | 45 | //00 is forbidden, 01 is output port, 10 is input without pull up, 11 is output with pull up 46 | this->max7301->write(0x0C,0b11111111); // ports 19 - 16 47 | this->max7301->write(0x0D,0b11111111); // ports 23 - 20 48 | this->max7301->write(0x0E,0b01111111); // ports 27 - 24 49 | this->max7301->write(0x0F,0b01010101); // ports 31 - 28 50 | } 51 | 52 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/MatrixScanner.cpp: -------------------------------------------------------------------------------- 1 | #include "MatrixScanner.h" 2 | #include "Convertors.h" 3 | 4 | MatrixScanner::MatrixScanner(IPinDriver *pinDriver, uint8_t rowCount, uint8_t columnCount, ILogger *logger) 5 | { 6 | //this->logger = logger; 7 | this->pinDriver = pinDriver; 8 | this->rowCount = rowCount; 9 | this->columnCount = columnCount; 10 | 11 | } 12 | 13 | Matrix *MatrixScanner::scanKeyPressMatrix() 14 | { 15 | Matrix *matrix = new Matrix(rowCount, columnCount); 16 | uint32_t *matrixData = matrix->matrixData; 17 | 18 | unsigned long startTime = micros(); 19 | 20 | for (uint8_t row = 0; row < rowCount; row++) 21 | { 22 | matrixData[row] = 0; 23 | 24 | this->pinDriver->writePin(row, LOW); 25 | this->pinDriver->refreshCache(); 26 | 27 | for (uint8_t column = 0; column < columnCount; column++) 28 | { 29 | uint32_t pin = this->pinDriver->readPin(column); 30 | 31 | matrixData[row] |= (pin << column); 32 | } 33 | 34 | this->pinDriver->writePin(row, HIGH); 35 | } 36 | 37 | unsigned long endTime = micros(); 38 | //Serial.println(endTime - startTime); 39 | //delay(800); 40 | 41 | // if (this->logger->isEnabled()) 42 | //{ 43 | // char *sm = Convertors::toString(matrix); 44 | // this->logger->logDebug(sm); 45 | // delete sm; 46 | //} 47 | 48 | return matrix; 49 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Features/BaseFeature.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Arduino.h" 3 | #include "KeyCodes.h" 4 | 5 | enum BaseFeatures : uint8_t 6 | { 7 | }; 8 | 9 | struct FeatureMacro 10 | { 11 | public: 12 | uint8_t featureId; 13 | uint8_t otherwiseFeatureId; 14 | uint8_t keyCodesCount; 15 | uint8_t* keyCodes; 16 | long activationTimeSinceLastKeyPress; 17 | 18 | FeatureMacro(uint8_t featureId, uint8_t keyCodesCount, uint8_t* keyCodes) 19 | { 20 | this->featureId = featureId; 21 | this->otherwiseFeatureId = featureId; 22 | this->keyCodesCount = keyCodesCount; 23 | this->keyCodes = keyCodes; 24 | this->activationTimeSinceLastKeyPress = 0; 25 | } 26 | 27 | FeatureMacro(uint8_t featureId, uint8_t otherwiseFeatureId, long activationTimeSinceLastKeyPress) 28 | { 29 | this->featureId = featureId; 30 | this->otherwiseFeatureId = otherwiseFeatureId; 31 | this->keyCodesCount = 0; 32 | this->keyCodes = keyCodes; 33 | this->activationTimeSinceLastKeyPress = activationTimeSinceLastKeyPress; 34 | } 35 | }; 36 | 37 | 38 | class BaseFeature 39 | { 40 | private: 41 | 42 | protected: 43 | BaseFeature(); 44 | 45 | public: 46 | virtual void evaluate(uint8_t featureId) = 0; 47 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS2/UsbHidKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef TINYS2 2 | 3 | #include "UsbHidKeyboardDriver.h" 4 | 5 | USBHIDKeyboard keyboard; 6 | 7 | UsbHidKeyboardDriver::UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor) 8 | { 9 | this->keyboardDescriptor = keyboardDescriptor; 10 | 11 | keyboard.begin(); 12 | USB.begin(); 13 | } 14 | 15 | bool UsbHidKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 16 | { 17 | auto keymap = this->keyboardDescriptor->getKeyMap()[0]; 18 | 19 | bool isPress = false; 20 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 21 | { 22 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 23 | { 24 | auto currentKey = keymap[row][column]; 25 | 26 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 27 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 28 | 29 | if (isPressed) 30 | { 31 | isPress = true; 32 | keyboard.pressRaw((uint8_t)currentKey); 33 | } 34 | else if (isReleased) 35 | { 36 | keyboard.releaseRaw((uint8_t)currentKey); 37 | } 38 | } 39 | } 40 | 41 | return isPress; 42 | } 43 | 44 | void UsbHidKeyboardDriver::ResetPairing() 45 | { 46 | } 47 | 48 | void UsbHidKeyboardDriver::ResetState() 49 | { 50 | keyboard.releaseAll(); 51 | } 52 | 53 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Logger.h" 3 | 4 | #if defined(NUMPAD) && defined(V2) 5 | #include "Drivers/Numpad/V2/KeyboardSDK.h" 6 | #endif 7 | 8 | #if defined(TKL) && defined(V1) 9 | #include "Drivers/TKL/V1/KeyboardSDK.h" 10 | #endif 11 | 12 | #if defined(TKL) && defined(V2) 13 | #include "Drivers/TKL/V2/KeyboardSDK.h" 14 | #endif 15 | 16 | #include "Features/BluetoothFeature.h" 17 | #include "Features/RGBLedFeature.h" 18 | 19 | KeyboardSDK* keyboardSDK = NULL; 20 | 21 | void setup() 22 | { 23 | delay(2000); // Keep the delay. It's useful when program crashes during the setup as you can reflash program without the need of pressing RESET button. 24 | 25 | Serial.begin(115200); 26 | Wire.begin(); 27 | 28 | keyboardSDK = new KeyboardSDK(McuConfig::csPin, McuConfig::mosiPin, McuConfig::sclkPin, McuConfig::misoPin, &Wire, new Logger()); 29 | auto rgbLedFeature = new RGBLedFeature(keyboardSDK); 30 | auto bluetoothFeature = new BluetoothFeature(keyboardSDK); 31 | 32 | auto macroEvaluator = keyboardSDK->GetMacroEvaluator(); 33 | macroEvaluator->registerFeature(rgbLedFeature); 34 | macroEvaluator->registerFeature(bluetoothFeature); 35 | } 36 | 37 | void loop() 38 | { 39 | keyboardSDK->GetKeyPressProcessor()->scan(); 40 | 41 | uint8_t batteryLevel = keyboardSDK->GetBatteryDriver()->readBatteryLevel(); 42 | 43 | if (batteryLevel < 15) 44 | { 45 | keyboardSDK->GetRGBLedDriver()->setColor(0, 0, 0xff, 0, 0); 46 | } 47 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather_ESP32_S3_NOPSRAM/UsbHidKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef FEATHER_ESP32_S3_NOPSRAM 2 | 3 | #include "UsbHidKeyboardDriver.h" 4 | 5 | UsbHidKeyboardDriver::UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor) 6 | { 7 | this->keyboardDescriptor = keyboardDescriptor; 8 | USB.begin(); 9 | } 10 | 11 | bool UsbHidKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 12 | { 13 | USBHIDKeyboard keyboard; 14 | keyboard.begin(); 15 | auto keymap = this->keyboardDescriptor->getKeyMap()[0]; 16 | 17 | bool isPress = false; 18 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 19 | { 20 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 21 | { 22 | auto currentKey = keymap[row][column]; 23 | 24 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 25 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 26 | 27 | if (isPressed) 28 | { 29 | isPress = true; 30 | 31 | keyboard.pressRaw(currentKey); 32 | } 33 | else if (isReleased) 34 | { 35 | keyboard.releaseRaw(currentKey); 36 | } 37 | } 38 | } 39 | keyboard.end(); 40 | return isPress; 41 | } 42 | 43 | void UsbHidKeyboardDriver::ResetPairing() 44 | { 45 | } 46 | 47 | void UsbHidKeyboardDriver::ResetState() 48 | { 49 | USBHIDKeyboard keyboard; 50 | keyboard.begin(); 51 | keyboard.releaseAll(); 52 | keyboard.end(); 53 | } 54 | 55 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Matrix/MatrixEvaluator.cpp: -------------------------------------------------------------------------------- 1 | #include "MatrixEvaluator.h" 2 | 3 | 4 | MatrixEvaluator::MatrixEvaluator(MatrixDebouncer* matrixDebouncer) 5 | { 6 | this->matrixDebouncer = matrixDebouncer; 7 | } 8 | 9 | Matrix* MatrixEvaluator::getStateChangeMatrix(Matrix* previousMatrix, Matrix* currentMatrix, uint8_t expectedState) 10 | { 11 | uint32_t* matrixData = new uint32_t[previousMatrix->numberOfRows]; 12 | 13 | for (uint8_t row = 0; row < previousMatrix->numberOfRows; row++) 14 | { 15 | matrixData[row] = 0; 16 | 17 | for (uint8_t column = 0; column < previousMatrix->numberOfColumns; column++) 18 | { 19 | uint8_t oldBit = previousMatrix->getBit(row, column); 20 | uint8_t newBit = currentMatrix->getBit(row, column); 21 | 22 | if (oldBit != newBit && newBit == expectedState) 23 | { 24 | if (this->matrixDebouncer->isDebounced(row, column)) 25 | { 26 | //key was newly pressed 27 | matrixData[row] |= ((uint32_t)1) << column; 28 | } 29 | } 30 | } 31 | } 32 | 33 | return new Matrix(matrixData, previousMatrix->numberOfRows, previousMatrix->numberOfColumns); 34 | } 35 | 36 | Matrix* MatrixEvaluator::getPressedKeysMatrix(Matrix* previousMatrix, Matrix* currentMatrix) 37 | { 38 | return this->getStateChangeMatrix(previousMatrix, currentMatrix, 1); 39 | } 40 | 41 | Matrix* MatrixEvaluator::getReleasedKeysMatrix(Matrix* previousMatrix, Matrix* currentMatrix) 42 | { 43 | return this->getStateChangeMatrix(previousMatrix, currentMatrix, 0); 44 | } -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Numpad.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 0, 4 | "active_layer_preset": "All Layers", 5 | "auto_track_width": true, 6 | "hidden_nets": [], 7 | "high_contrast_mode": 0, 8 | "net_color_mode": 1, 9 | "opacity": { 10 | "pads": 1.0, 11 | "tracks": 1.0, 12 | "vias": 1.0, 13 | "zones": 0.6 14 | }, 15 | "ratsnest_display_mode": 0, 16 | "selection_filter": { 17 | "dimensions": true, 18 | "footprints": true, 19 | "graphics": true, 20 | "keepouts": true, 21 | "lockedItems": true, 22 | "otherItems": true, 23 | "pads": true, 24 | "text": true, 25 | "tracks": true, 26 | "vias": true, 27 | "zones": true 28 | }, 29 | "visible_items": [ 30 | 0, 31 | 1, 32 | 2, 33 | 3, 34 | 4, 35 | 5, 36 | 8, 37 | 9, 38 | 10, 39 | 11, 40 | 12, 41 | 13, 42 | 14, 43 | 15, 44 | 16, 45 | 17, 46 | 18, 47 | 19, 48 | 20, 49 | 21, 50 | 22, 51 | 23, 52 | 24, 53 | 25, 54 | 26, 55 | 27, 56 | 28, 57 | 29, 58 | 30, 59 | 32, 60 | 33, 61 | 34, 62 | 35, 63 | 36 64 | ], 65 | "visible_layers": "fffffff_ffffffff", 66 | "zone_display_mode": 0 67 | }, 68 | "meta": { 69 | "filename": "Numpad.kicad_prl", 70 | "version": 3 71 | }, 72 | "project": { 73 | "files": [] 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCU.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef ARDUINO_MICRO 4 | #include "HAL/MCUs/Micro/config.h" 5 | #include "HAL/MCUs/Micro/UsbHidKeyboardDriver.h" 6 | #include "HAL/MCUs/Micro/BluetoothKeyboardDriver.h" 7 | #include "HAL/MCUs/FullBatteryDriver.h" 8 | #endif 9 | 10 | #ifdef FEATHER_ESP32_S3_NOPSRAM 11 | #include "HAL/MCUs/Feather_ESP32_S3_NOPSRAM/config.h" 12 | #include "HAL/MCUs/Feather_ESP32_S3_NOPSRAM/UsbHidKeyboardDriver.h" 13 | #include "HAL/MCUs/Feather_ESP32_S3_NOPSRAM/BluetoothKeyboardDriver.h" 14 | #include "HAL/MCUs/FullBatteryDriver.h" 15 | #endif 16 | 17 | #ifdef FEATHER32U4 18 | #include "HAL/MCUs/Feather32u4/config.h" 19 | #include "HAL/MCUs/Feather32u4/BatteryDriver.h" 20 | #include "HAL/MCUs/Feather32u4/UsbHidKeyboardDriver.h" 21 | #include "HAL/MCUs/Feather32u4/BluetoothKeyboardDriver.h" 22 | #endif 23 | 24 | #ifdef TINYS2 25 | #include "HAL/MCUs/TinyS2/config.h" 26 | #include "HAL/MCUs/TinyS2/UsbHidKeyboardDriver.h" 27 | #include "HAL/MCUs/TinyS2/BluetoothKeyboardDriver.h" 28 | #include "HAL/MCUs/FullBatteryDriver.h" 29 | #endif 30 | 31 | #ifdef TINYS3 32 | #include "HAL/MCUs/TinyS3/config.h" 33 | #include "HAL/MCUs/TinyS3/UsbHidKeyboardDriver.h" 34 | #include "HAL/MCUs/TinyS3/BluetoothKeyboardDriver.h" 35 | #include "HAL/MCUs/FullBatteryDriver.h" 36 | #endif 37 | 38 | #ifdef PORTENTA_H7 39 | #include "HAL/MCUs/PortentaH7/config.h" 40 | #include "HAL/MCUs/PortentaH7/UsbHidKeyboardDriver.h" 41 | #include "HAL/MCUs/PortentaH7/BluetoothKeyboardDriver.h" 42 | #include "HAL/MCUs/FullBatteryDriver.h" 43 | #endif -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/Assembly/JLCPCB/Numpad-bottom-pos.csv: -------------------------------------------------------------------------------- 1 | Designator,Val,Package,Mid X,Mid Y,Rotation,Layer 2 | "K_DOT1",".","CherryMX_PlateMount_HotSwap_1u",72.594000,-137.960000,0.000000,top 3 | "K_EIGHT1","8","CherryMX_PlateMount_HotSwap_1u",53.544000,-80.810000,0.000000,top 4 | "K_ENTER1","ENTER","CherryMX_PlateMount_HotSwap_2u_90deg",91.644000,-128.435000,90.000000,top 5 | "K_FIVE1","5","CherryMX_PlateMount_HotSwap_1u",53.544000,-99.860000,0.000000,top 6 | "K_FOUR1","4","CherryMX_PlateMount_HotSwap_1u",34.494000,-99.860000,0.000000,top 7 | "K_MINUS1","-","CherryMX_PlateMount_HotSwap_1u",91.644000,-61.760000,0.000000,top 8 | "K_NINE1","9","CherryMX_PlateMount_HotSwap_1u",72.594000,-80.810000,0.000000,top 9 | "K_NUMPAD1","NUMPAD","CherryMX_PlateMount_HotSwap_1u",34.494000,-61.760000,0.000000,top 10 | "K_ONE1","1","CherryMX_PlateMount_HotSwap_1u",34.494000,-118.910000,0.000000,top 11 | "K_PLUS1","+","CherryMX_PlateMount_HotSwap_2u_90deg",91.644000,-90.335000,90.000000,top 12 | "K_SEVEN1","7","CherryMX_PlateMount_HotSwap_1u",34.494000,-80.810000,0.000000,top 13 | "K_SIX1","6","CherryMX_PlateMount_HotSwap_1u",72.594000,-99.860000,0.000000,top 14 | "K_SLASH1","/","CherryMX_PlateMount_HotSwap_1u",53.544000,-61.760000,0.000000,top 15 | "K_STAR1","*","CherryMX_PlateMount_HotSwap_1u",72.594000,-61.760000,0.000000,top 16 | "K_THREE1","3","CherryMX_PlateMount_HotSwap_1u",72.594000,-118.910000,0.000000,top 17 | "K_TWO1","2","CherryMX_PlateMount_HotSwap_1u",53.544000,-118.910000,0.000000,top 18 | "K_ZERO1","0","CherryMX_PlateMount_HotSwap_2u",44.019000,-137.960000,0.000000,top -------------------------------------------------------------------------------- /firmware/VaKeyboard/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS3/BluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef TINYS3 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "Logger/ILogger.h" 7 | #include "Logger/NullLogger.h" 8 | 9 | #include "HAL/IBatteryDriver.h" 10 | #include "BaseKeyboardDescriptor.h" 11 | 12 | #include 13 | 14 | class BluetoothKeyboardDriver : public IKeyboardDriver 15 | { 16 | private: 17 | ILogger *logger; 18 | static BluetoothKeyboardDriver* instance; 19 | Matrix *currentStateMatrix = NULL; 20 | IBatteryDriver *batteryDriver = NULL; 21 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 22 | const uint8_t maxKeyCountInReport = 6; 23 | BleKeyboard* bleKeyboard = NULL; 24 | 25 | void SplitToArrayOf(uint8_t *array, uint8_t arrayLength, uint8_t **outputArray, uint8_t innerArrayLength); 26 | uint8_t ScanForPressedKeys(Matrix *matrix, KeyCode **keymapProvider, uint8_t *foundKeys, uint8_t *modificators); 27 | Matrix *UpdateStateMatrix(Matrix *stateMatrix, Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 28 | 29 | public: 30 | BluetoothKeyboardDriver(BleKeyboard* bleKeyboard, IBatteryDriver *batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 31 | 32 | virtual void ResetPairing(); 33 | virtual void ResetState(); 34 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 35 | 36 | static BluetoothKeyboardDriver* Create(IBatteryDriver* batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 37 | static BluetoothKeyboardDriver* GetInstance(); 38 | }; 39 | 40 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "pins_arduino.h": "c", 4 | "*.tcc": "cpp", 5 | "array": "cpp", 6 | "atomic": "cpp", 7 | "cctype": "cpp", 8 | "clocale": "cpp", 9 | "cmath": "cpp", 10 | "cstdarg": "cpp", 11 | "cstddef": "cpp", 12 | "cstdint": "cpp", 13 | "cstdio": "cpp", 14 | "cstdlib": "cpp", 15 | "cstring": "cpp", 16 | "ctime": "cpp", 17 | "cwchar": "cpp", 18 | "cwctype": "cpp", 19 | "deque": "cpp", 20 | "unordered_map": "cpp", 21 | "unordered_set": "cpp", 22 | "vector": "cpp", 23 | "exception": "cpp", 24 | "algorithm": "cpp", 25 | "functional": "cpp", 26 | "iterator": "cpp", 27 | "map": "cpp", 28 | "memory": "cpp", 29 | "memory_resource": "cpp", 30 | "numeric": "cpp", 31 | "optional": "cpp", 32 | "random": "cpp", 33 | "string": "cpp", 34 | "string_view": "cpp", 35 | "system_error": "cpp", 36 | "tuple": "cpp", 37 | "type_traits": "cpp", 38 | "utility": "cpp", 39 | "fstream": "cpp", 40 | "initializer_list": "cpp", 41 | "iomanip": "cpp", 42 | "iosfwd": "cpp", 43 | "istream": "cpp", 44 | "limits": "cpp", 45 | "new": "cpp", 46 | "ostream": "cpp", 47 | "sstream": "cpp", 48 | "stdexcept": "cpp", 49 | "streambuf": "cpp", 50 | "cinttypes": "cpp", 51 | "typeinfo": "cpp" 52 | } 53 | } -------------------------------------------------------------------------------- /pcb/TKL Keyboard/vakeyboard.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 0, 4 | "active_layer_preset": "All Layers", 5 | "auto_track_width": false, 6 | "hidden_netclasses": [], 7 | "hidden_nets": [], 8 | "high_contrast_mode": 0, 9 | "net_color_mode": 1, 10 | "opacity": { 11 | "images": 0.6, 12 | "pads": 1.0, 13 | "tracks": 1.0, 14 | "vias": 1.0, 15 | "zones": 1.0 16 | }, 17 | "ratsnest_display_mode": 0, 18 | "selection_filter": { 19 | "dimensions": true, 20 | "footprints": true, 21 | "graphics": true, 22 | "keepouts": true, 23 | "lockedItems": false, 24 | "otherItems": true, 25 | "pads": true, 26 | "text": true, 27 | "tracks": true, 28 | "vias": true, 29 | "zones": true 30 | }, 31 | "visible_items": [ 32 | 0, 33 | 1, 34 | 2, 35 | 3, 36 | 4, 37 | 5, 38 | 8, 39 | 9, 40 | 10, 41 | 11, 42 | 12, 43 | 13, 44 | 15, 45 | 16, 46 | 17, 47 | 18, 48 | 19, 49 | 20, 50 | 21, 51 | 22, 52 | 23, 53 | 24, 54 | 25, 55 | 26, 56 | 27, 57 | 28, 58 | 29, 59 | 30, 60 | 32, 61 | 33, 62 | 34, 63 | 35, 64 | 36, 65 | 39, 66 | 40 67 | ], 68 | "visible_layers": "fffffff_ffffffff", 69 | "zone_display_mode": 0 70 | }, 71 | "meta": { 72 | "filename": "vakeyboard.kicad_prl", 73 | "version": 3 74 | }, 75 | "project": { 76 | "files": [] 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V1/KeyboardSDK.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V1) 2 | #include "KeyboardSDK.h" 3 | #include "../KeyboardDescriptor.h" 4 | #include "PinDriver.h" 5 | #include "RgbLedDriver.h" 6 | 7 | KeyboardSDK::KeyboardSDK(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin, TwoWire *wire, ILogger* logger) 8 | { 9 | this->logger = logger; 10 | this->batteryDriver = new BatteryDriver(); 11 | 12 | this->rgbLedDriver = new RgbLedDriver(logger, this->numberOfRows, this->numberOfColumns); 13 | 14 | BaseKeyboardDescriptor* keyboardDescriptor = new KeyboardDescriptor(numberOfRows, numberOfColumns); 15 | 16 | this->macroEvaluator = new MacroEvaluator(keyboardDescriptor); 17 | this->primaryKeyboardDriver = new UsbHidKeyboardDriver(keyboardDescriptor); 18 | this->activeKeyboardDriver = this->primaryKeyboardDriver; 19 | 20 | IKeyboardDriver* btKeyboardDriver = BluetoothKeyboardDriver::Create(batteryDriver, keyboardDescriptor, this->logger); 21 | 22 | if (btKeyboardDriver != NULL) 23 | { 24 | this->activeKeyboardDriver = new SelectiveKeyboardDriver(this->activeKeyboardDriver, btKeyboardDriver); 25 | } 26 | 27 | IPinDriver* pinDriver = new PinDriver(wire, logger); 28 | 29 | this->keypressProcessor = new KeyPressProcessor( 30 | new MatrixScanner(pinDriver, numberOfRows, numberOfColumns, logger), 31 | new MatrixEvaluator(new MatrixDebouncer(keyboardDescriptor, 2)), 32 | this->activeKeyboardDriver, 33 | keyboardDescriptor, 34 | this->macroEvaluator, 35 | this->logger); 36 | 37 | } 38 | 39 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/IKeyboardSDK.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "KeyPressProcessor.h" 3 | #include "MacroEvaluator.h" 4 | #include "HAL/IRGBLedDriver.h" 5 | #include "HAL/IBatteryDriver.h" 6 | 7 | #include "HAL/SelectiveKeyboardDriver.h" 8 | #include "HAL/MCU.h" 9 | 10 | class IKeyboardSDK 11 | { 12 | protected: 13 | ILogger *logger = NULL; 14 | IBatteryDriver* batteryDriver = NULL; 15 | IKeyboardDriver* primaryKeyboardDriver = NULL; 16 | IKeyboardDriver* activeKeyboardDriver = NULL; 17 | IRGBLedDriver* rgbLedDriver = NULL; 18 | KeyPressProcessor* keypressProcessor = NULL; 19 | MacroEvaluator* macroEvaluator = NULL; 20 | 21 | public: 22 | MacroEvaluator* GetMacroEvaluator() 23 | { 24 | return this->macroEvaluator; 25 | } 26 | 27 | KeyPressProcessor* GetKeyPressProcessor() 28 | { 29 | return this->keypressProcessor; 30 | } 31 | 32 | IKeyboardDriver* GetPrimaryKeyboardDriver() 33 | { 34 | return this->primaryKeyboardDriver; 35 | } 36 | 37 | IKeyboardDriver* GetActiveKeyboardDriver() 38 | { 39 | return this->activeKeyboardDriver; 40 | } 41 | 42 | IRGBLedDriver* GetRGBLedDriver() 43 | { 44 | return this->rgbLedDriver; 45 | } 46 | 47 | IBatteryDriver* GetBatteryDriver() 48 | { 49 | return this->batteryDriver; 50 | } 51 | 52 | ILogger* GetLogger() 53 | { 54 | return this->logger; 55 | } 56 | }; -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/PCB/JLCPCB/Numpad-B_Paste.gbp: -------------------------------------------------------------------------------- 1 | G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(6.0.5)* 2 | G04 #@! TF.CreationDate,2022-07-11T19:37:47+02:00* 3 | G04 #@! TF.ProjectId,Numpad,4e756d70-6164-42e6-9b69-6361645f7063,rev?* 4 | G04 #@! TF.SameCoordinates,Original* 5 | G04 #@! TF.FileFunction,Paste,Bot* 6 | G04 #@! TF.FilePolarity,Positive* 7 | %FSLAX46Y46*% 8 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 9 | G04 Created by KiCad (PCBNEW (6.0.5)) date 2022-07-11 19:37:47* 10 | %MOMM*% 11 | %LPD*% 12 | G01* 13 | G04 APERTURE LIST* 14 | %ADD10R,2.550000X2.500000*% 15 | G04 APERTURE END LIST* 16 | D10* 17 | X51104000Y-140500000D03* 18 | X38177000Y-143040000D03* 19 | X60624000Y-121455000D03* 20 | X47697000Y-123995000D03* 21 | X79674000Y-140505000D03* 22 | X66747000Y-143045000D03* 23 | X60624000Y-64305000D03* 24 | X47697000Y-66845000D03* 25 | X98729000Y-130975000D03* 26 | X85802000Y-133515000D03* 27 | X98724000Y-64305000D03* 28 | X85797000Y-66845000D03* 29 | X98729000Y-92875000D03* 30 | X85802000Y-95415000D03* 31 | X79674000Y-121455000D03* 32 | X66747000Y-123995000D03* 33 | X41574000Y-83355000D03* 34 | X28647000Y-85895000D03* 35 | X41574000Y-102405000D03* 36 | X28647000Y-104945000D03* 37 | X41574000Y-121455000D03* 38 | X28647000Y-123995000D03* 39 | X60624000Y-102405000D03* 40 | X47697000Y-104945000D03* 41 | X79674000Y-102405000D03* 42 | X66747000Y-104945000D03* 43 | X79674000Y-64305000D03* 44 | X66747000Y-66845000D03* 45 | X60624000Y-83355000D03* 46 | X47697000Y-85895000D03* 47 | X41574000Y-64305000D03* 48 | X28647000Y-66845000D03* 49 | X79674000Y-83355000D03* 50 | X66747000Y-85895000D03* 51 | M02* 52 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/BaseKeyboardDescriptor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "KeyCodes.h" 5 | #include "Matrix/Matrix.h" 6 | #include "Features/BaseFeature.h" 7 | 8 | class BaseKeyboardDescriptor 9 | { 10 | public: 11 | struct Coordinates 12 | { 13 | private: 14 | uint8_t encodedCoords; 15 | 16 | public: 17 | Coordinates(uint8_t row, uint8_t column) 18 | { 19 | // This assumes that nobody has more than 17 columns. 20 | this->encodedCoords = 0; 21 | this->encodedCoords |= (row << 5); 22 | this->encodedCoords |= column; 23 | } 24 | 25 | uint8_t getRow() 26 | { 27 | return (this->encodedCoords & 0b11100000) >> 5; 28 | } 29 | 30 | uint8_t getColumn() 31 | { 32 | return this->encodedCoords & 0b00011111; 33 | } 34 | }; 35 | 36 | virtual KeyCode *** createKeyMap() = 0; 37 | virtual FeatureMacro** createFeatureMacros() = 0; 38 | virtual uint8_t getLayersCount() = 0; 39 | virtual uint8_t getSelectedLayer(Matrix *pressedKeysMatrix) = 0; 40 | 41 | uint8_t getRowCount(); 42 | uint8_t getColumnCount(); 43 | uint8_t getFeatureMacroCount(); 44 | Coordinates **getCoordinatesMap(); 45 | KeyCode ***getKeyMap(); 46 | FeatureMacro** getFeatureMacros(); 47 | KeyType getKeyType(uint8_t layer, uint8_t row, uint8_t column); 48 | 49 | protected: 50 | uint8_t numberOfRows; 51 | uint8_t numberOfColumns; 52 | uint8_t featureMacroCount; 53 | 54 | KeyCode ***keymaps; 55 | Coordinates ** coordMap; 56 | FeatureMacro** featureMacros; 57 | 58 | BaseKeyboardDescriptor(uint8_t numberOfRows, uint8_t numberOfColumns); 59 | Coordinates ** createCoordinatesMap(KeyCode ***keymaps); 60 | }; -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/V2/KeyboardSDK.cpp: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) && defined(V2) 2 | #include "KeyboardSDK.h" 3 | #include "PinDriver.h" 4 | #include "RgbLedDriver.h" 5 | #include "HAL/Chips/Tca9548a.h" 6 | #include "../KeyboardDescriptor.h" 7 | 8 | KeyboardSDK::KeyboardSDK(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin, TwoWire *wire) 9 | { 10 | this->logger = logger; 11 | 12 | this->logger = NULL; 13 | this->batteryDriver = new BatteryDriver(); 14 | this->rgbLedDriver = new RgbLedDriver(logger, numberOfRows, numberOfColumns); 15 | 16 | BaseKeyboardDescriptor* keyboardDescriptor = new KeyboardDescriptor(numberOfRows, numberOfColumns); 17 | 18 | this->macroEvaluator = new MacroEvaluator(keyboardDescriptor); 19 | this->primaryKeyboardDriver = new UsbHidKeyboardDriver(keyboardDescriptor); 20 | this->activeKeyboardDriver = this->primaryKeyboardDriver; 21 | 22 | IKeyboardDriver* btKeyboardDriver = BluetoothKeyboardDriver::Create(batteryDriver, keyboardDescriptor, this->logger); 23 | 24 | if (btKeyboardDriver != NULL) 25 | { 26 | this->activeKeyboardDriver = new SelectiveKeyboardDriver(this->activeKeyboardDriver, btKeyboardDriver); 27 | } 28 | 29 | IPinDriver* pinDriver = new PinDriver(new Max7301(csPin, mosiPin, sclkPin, misoPin), logger); 30 | 31 | this->keypressProcessor = new KeyPressProcessor( 32 | new MatrixScanner(pinDriver, numberOfRows, numberOfColumns, logger), 33 | new MatrixEvaluator(new MatrixDebouncer(keyboardDescriptor, 2)), 34 | this->activeKeyboardDriver, 35 | keyboardDescriptor, 36 | this->macroEvaluator, 37 | this->logger); 38 | } 39 | 40 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V2/KeyboardSDK.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V2) 2 | #include "KeyboardSDK.h" 3 | #include "HAL/Chips/Tca9548a.h" 4 | #include "../KeyboardDescriptor.h" 5 | #include "PinDriver.h" 6 | #include "RgbLedDriver.h" 7 | 8 | KeyboardSDK::KeyboardSDK(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin, TwoWire *wire, ILogger* logger) 9 | { 10 | this->logger = logger; 11 | this->batteryDriver = new BatteryDriver(); 12 | 13 | Tca9548a* tca = new Tca9548a(0x70, wire, this->logger); 14 | this->rgbLedDriver = new RgbLedDriver(logger, this->numberOfRows, this->numberOfColumns, tca); 15 | 16 | BaseKeyboardDescriptor* keyboardDescriptor = new KeyboardDescriptor(numberOfRows, numberOfColumns); 17 | this->macroEvaluator = new MacroEvaluator(keyboardDescriptor); 18 | this->primaryKeyboardDriver = new UsbHidKeyboardDriver(keyboardDescriptor); 19 | this->activeKeyboardDriver = this->primaryKeyboardDriver; 20 | 21 | IKeyboardDriver* btKeyboardDriver = BluetoothKeyboardDriver::Create(batteryDriver, keyboardDescriptor, this->logger); 22 | 23 | if (btKeyboardDriver != NULL) 24 | { 25 | this->activeKeyboardDriver = new SelectiveKeyboardDriver(this->activeKeyboardDriver, btKeyboardDriver); 26 | } 27 | 28 | IPinDriver* pinDriver = new PinDriver(new Max7301(csPin, mosiPin, sclkPin, misoPin), logger); 29 | 30 | this->keypressProcessor = new KeyPressProcessor( 31 | new MatrixScanner(pinDriver, numberOfRows, numberOfColumns, logger), 32 | new MatrixEvaluator(new MatrixDebouncer(keyboardDescriptor, 2)), 33 | this->activeKeyboardDriver, 34 | keyboardDescriptor, 35 | this->macroEvaluator, 36 | this->logger); 37 | } 38 | 39 | #endif -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/19-237.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "19-237" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 601EC580) 4 | (attr smd) 5 | (fp_text reference "REF**" (at 0 1.905) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp fe3030b0-8ffb-4533-ae49-59aef900c0e2) 8 | ) 9 | (fp_text value "19-237" (at 0 -1.905) (layer "F.Fab") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 2365561e-408d-4186-94fe-d898f0885309) 12 | ) 13 | (fp_line (start 0.8 -0.8) (end 0.8 0.8) (layer "F.SilkS") (width 0.12) (tstamp 0cd34cba-19da-4864-a229-6d3d25788922)) 14 | (fp_line (start 0.8 0.8) (end 0.8 -0.8) (layer "F.SilkS") (width 0.12) (tstamp 21026971-39ec-48a8-ad15-b07a8dc14a0d)) 15 | (fp_line (start -0.8 0.8) (end -0.8 -0.8) (layer "F.SilkS") (width 0.12) (tstamp 5089ef04-3f49-4959-84fa-9d2ac6d6c2a7)) 16 | (fp_line (start 0.8 0.8) (end -0.8 0.8) (layer "F.SilkS") (width 0.12) (tstamp 795aafb3-392c-436f-8655-d328bca4582e)) 17 | (fp_line (start -0.8 -0.8) (end 0.8 -0.8) (layer "F.SilkS") (width 0.12) (tstamp 89c0c8b1-00e7-4604-a0e1-6341889928db)) 18 | (pad "1" smd rect (at -0.4 -0.7 90) (size 0.6 0.65) (layers "F.Cu" "F.Paste" "F.Mask") 19 | (clearance 0.07) (tstamp 8c996b91-b064-4074-be66-3d70a05cd3a7)) 20 | (pad "2" smd rect (at -0.4 0.7 90) (size 0.6 0.65) (layers "F.Cu" "F.Paste" "F.Mask") 21 | (clearance 0.07) (tstamp cb783d9d-f862-42f2-a6f2-3080fd68d574)) 22 | (pad "3" smd rect (at 0.4 -0.7 90) (size 0.6 0.65) (layers "F.Cu" "F.Paste" "F.Mask") 23 | (clearance 0.07) (tstamp bd1fd5aa-89f4-4bd3-af95-f0453c46e28e)) 24 | (pad "4" smd rect (at 0.4 0.7 90) (size 0.6 0.65) (layers "F.Cu" "F.Paste" "F.Mask") 25 | (clearance 0.07) (tstamp d2a34591-c196-4c5c-b4db-9bfd36fc2a1a)) 26 | ) 27 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/readme.txt: -------------------------------------------------------------------------------- 1 | Arduino Compatible Cross Platform C++ Library Project : For more information see http://www.visualmicro.com 2 | 3 | This project works exactly the same way as an Arduino library. Code should be in the src folder, code in sub folders below the \src folder are also supported. 4 | 5 | The \src folder, if it exists, will be added as a compiler -I include path, otherwise the library folder will be a compiler -I include path. 6 | 7 | Older Arduino libraries support code in the library folder and private code in the \utility sub folder. 8 | 9 | Add this project to any solution that contains an Arduino project and #include in code as you would any normal Arduino library headers. 10 | 11 | To enable intellisense and to support live build discovery outside of the "standard" Arduino library locations, ensure that the library is added as a shared project reference to the master Arduino project. To do this, right click the master project "References" node and then click "Add Reference". A window will open and the library will appear on the "Shared Projects" tab. Click the checkbox next to the library name to add the reference. If this library is moved the shared referencemust be removed and re-added. 12 | 13 | VS2017 has a bug, workround: After moving existing source code within a "library or shared project", close and re-open the solution. 14 | 15 | Visual Studio will display intellisense for libraries based on the platform/board that has been specified for the currently active "Startup Project" of the current solution. 16 | 17 | 18 | IMPORTANT: The arduino.cc Library Rules must be followed when adding code or restructing libraries. 19 | 20 | 21 | 22 | 23 | blog: http://www.visualmicro.com/post/2017/01/16/Arduino-Cross-Platform-Library-Development.aspx -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather_ESP32_S3_NOPSRAM/BluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER_ESP32_S3_NOPSRAM 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "Logger/ILogger.h" 7 | #include "Logger/NullLogger.h" 8 | 9 | #include "HAL/IBatteryDriver.h" 10 | #include "BaseKeyboardDescriptor.h" 11 | 12 | //#include "services/HIDKeyboardService.h" 13 | 14 | 15 | class BluetoothKeyboardDriver : public IKeyboardDriver 16 | { 17 | private: 18 | //ILogger *logger; 19 | static BluetoothKeyboardDriver* instance; 20 | Matrix *currentStateMatrix = NULL; 21 | IBatteryDriver *batteryDriver = NULL; 22 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 23 | const uint8_t maxKeyCountInReport = 6; 24 | 25 | String ConvertToHexCode(uint8_t code); 26 | void SplitToArrayOf(uint8_t *array, uint8_t arrayLength, uint8_t **outputArray, uint8_t innerArrayLength); 27 | bool SendKeypresses(uint8_t modificators, uint8_t *keys); 28 | bool SendRelease(); 29 | uint8_t ScanForModificators(Matrix *matrix, KeyCode **keymapProvider); 30 | uint8_t ScanForPressedRegularKeys(Matrix *matrix, KeyCode **keymapProvider, uint8_t *foundKeys); 31 | Matrix *UpdateStateMatrix(Matrix *stateMatrix, Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 32 | 33 | public: 34 | BluetoothKeyboardDriver(IBatteryDriver *batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 35 | 36 | virtual void Init(); 37 | virtual void ResetPairing(); 38 | virtual void ResetState(); 39 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 40 | 41 | static BluetoothKeyboardDriver* Create(IBatteryDriver* batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 42 | static BluetoothKeyboardDriver* GetInstance(); 43 | }; 44 | 45 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/PortentaH7/BluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef PORTENTA_H7 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "Logger/ILogger.h" 7 | #include "Logger/NullLogger.h" 8 | 9 | #include "HAL/IBatteryDriver.h" 10 | #include "BaseKeyboardDescriptor.h" 11 | 12 | #include "Mbed_BLE_HID.h" 13 | //#include "services/HIDKeyboardService.h" 14 | 15 | 16 | class BluetoothKeyboardDriver : public IKeyboardDriver 17 | { 18 | private: 19 | static BluetoothKeyboardDriver* instance; 20 | //ILogger *logger; 21 | Matrix *currentStateMatrix = NULL; 22 | IBatteryDriver *batteryDriver = NULL; 23 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 24 | const uint8_t maxKeyCountInReport = 6; 25 | 26 | String ConvertToHexCode(uint8_t code); 27 | void SplitToArrayOf(uint8_t *array, uint8_t arrayLength, uint8_t **outputArray, uint8_t innerArrayLength); 28 | bool SendKeypresses(uint8_t modificators, uint8_t *keys); 29 | bool SendRelease(); 30 | uint8_t ScanForModificators(Matrix *matrix, KeyCode **keymapProvider); 31 | uint8_t ScanForPressedRegularKeys(Matrix *matrix, KeyCode **keymapProvider, uint8_t *foundKeys); 32 | Matrix *UpdateStateMatrix(Matrix *stateMatrix, Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 33 | 34 | public: 35 | BluetoothKeyboardDriver(IBatteryDriver *batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 36 | 37 | virtual void Init(); 38 | virtual void ResetPairing(); 39 | virtual void ResetState(); 40 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 41 | 42 | static BluetoothKeyboardDriver* Create(IBatteryDriver* batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 43 | static BluetoothKeyboardDriver* GetInstance(); 44 | }; 45 | 46 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V1/PinDriver.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V1) 2 | 3 | #include "PinDriver.h" 4 | 5 | void PinDriver::refreshCache() 6 | { 7 | uint32_t banks = 0; 8 | banks |= ((uint16_t)(~mcp0->readGPIOB())) << 8; 9 | banks |= ((uint32_t)~mcp1->readGPIOAB()) << 16; 10 | cache = banks; 11 | } 12 | 13 | uint8_t PinDriver::readPin(uint8_t pinNumber) 14 | { 15 | if (pinNumber < 8) 16 | { 17 | uint32_t mask = (1 << (7 - pinNumber)); 18 | return (((cache << 16) >> 24) & mask) >> (7 - pinNumber); 19 | } 20 | else if (pinNumber < 16) 21 | { 22 | uint32_t mask = (1 << (15 - pinNumber)); 23 | return ((cache >> 16) & mask) >> (15 - pinNumber ); 24 | } 25 | else 26 | { 27 | uint32_t mask = (1 << (31 - pinNumber)); 28 | return ((cache >> 16) & mask) >> (31 - pinNumber); 29 | } 30 | } 31 | 32 | void PinDriver::writePin(uint8_t pinNumber, uint8_t value) 33 | { 34 | mcp0->digitalWrite(pinNumber, value); 35 | } 36 | 37 | PinDriver::PinDriver(TwoWire *wire, ILogger *logger) 38 | { 39 | //this->logger = logger; 40 | uint8_t mcp0Status = mcp0->begin_I2C((uint8_t)MCP23XXX_ADDR, wire); 41 | 42 | // if (!mcp0Status) 43 | // { 44 | // // this->logger->logError(F("Failed to initialise first MCP23017.")); 45 | // return; 46 | // } 47 | 48 | for (uint8_t i = 0; i < 8; i++) 49 | { 50 | mcp0->pinMode(i, OUTPUT); 51 | mcp0->pinMode(i + 8, INPUT_PULLUP); 52 | } 53 | 54 | uint8_t mcp1Status = mcp1->begin_I2C((uint8_t)MCP23XXX_ADDR + 7, wire); // outside chip next to keyboard edge 55 | 56 | // if (!mcp1Status) 57 | // { 58 | // // this->logger->logError(F("Failed to initialise second MCP23017.")); 59 | // return; 60 | // } 61 | 62 | for (uint8_t i = 0; i < 8; i++) 63 | { 64 | mcp1->pinMode(i, INPUT_PULLUP); 65 | mcp1->pinMode(i + 8, INPUT_PULLUP); 66 | } 67 | } 68 | 69 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/PortentaH7/UsbHidKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef PORTENTA_H7 2 | 3 | #include "UsbHidKeyboardDriver.h" 4 | 5 | UsbHidKeyboardDriver::UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor) 6 | { 7 | this->keyboardDescriptor = keyboardDescriptor; 8 | } 9 | 10 | bool UsbHidKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 11 | { 12 | auto keymap = this->keyboardDescriptor->getKeyMap()[0]; 13 | uint8_t modifiers = this->ScanForModificators(pressedKeysMatrix, keymap); 14 | 15 | bool isPress = false; 16 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 17 | { 18 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 19 | { 20 | auto currentKey = keymap[row][column]; 21 | 22 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 23 | 24 | if (isPressed && currentKey < 0xE0) // without modificator keys, 0xE0 starts modificator key 25 | { 26 | isPress = true; 27 | 28 | this->Keyboard.key_code(currentKey, modifiers); 29 | } 30 | } 31 | } 32 | 33 | return isPress; 34 | } 35 | 36 | void UsbHidKeyboardDriver::ResetPairing() 37 | { 38 | } 39 | 40 | void UsbHidKeyboardDriver::ResetState() 41 | { 42 | } 43 | 44 | uint8_t UsbHidKeyboardDriver::ScanForModificators(Matrix *matrix, KeyCode **keymapProvider) 45 | { 46 | uint8_t modificators = 0; 47 | 48 | for (uint8_t row = 0; row < matrix->numberOfRows; row++) 49 | { 50 | for (uint8_t column = 0; column < matrix->numberOfColumns; column++) 51 | { 52 | auto currentKey = keymapProvider[row][column]; 53 | 54 | uint8_t isScannedPress = matrix->getBit(row, column); 55 | 56 | if (isScannedPress) 57 | { 58 | if (currentKey >= 0xE0) // modificator keys 59 | { 60 | uint8_t bit = (1 << (currentKey - 0xE0)); 61 | modificators |= bit; 62 | } 63 | } 64 | } 65 | } 66 | } 67 | 68 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather32u4/BluetoothKeyboardDriver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef FEATHER32U4 4 | 5 | #include "HAL/IKeyboardDriver.h" 6 | #include "Logger/ILogger.h" 7 | #include "Logger/NullLogger.h" 8 | #include "BaseKeyboardDescriptor.h" 9 | 10 | #include "Adafruit_BLE.h" 11 | #include "Adafruit_BluefruitLE_SPI.h" 12 | 13 | #include "HAL/IBatteryDriver.h" 14 | 15 | class BluetoothKeyboardDriver : public IKeyboardDriver 16 | { 17 | private: 18 | const char* AT_KEYBOARD_CODE = "AT+BLEKEYBOARDCODE="; 19 | 20 | static BluetoothKeyboardDriver* instance; 21 | 22 | Adafruit_BluefruitLE_SPI *ble; 23 | //ILogger *logger; 24 | Matrix *currentStateMatrix = NULL; 25 | IBatteryDriver *batteryDriver = NULL; 26 | BaseKeyboardDescriptor *keyboardDescriptor = NULL; 27 | const uint8_t maxKeyCountInReport = 6; 28 | 29 | char* GenerateCommandBytes(uint8_t modifier, uint8_t* keys); 30 | void SplitToArrayOf(uint8_t *array, uint8_t arrayLength, uint8_t **outputArray, uint8_t innerArrayLength); 31 | bool SendKeypresses(uint8_t modificators, uint8_t *keys); 32 | bool SendRelease(); 33 | uint8_t ScanForModificators(Matrix *matrix); 34 | uint8_t ScanForPressedRegularKeys(Matrix *matrix, KeyCode **keymap, uint8_t *foundKeys); 35 | Matrix *UpdateStateMatrix(Matrix *stateMatrix, Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 36 | 37 | public: 38 | BluetoothKeyboardDriver(Adafruit_BluefruitLE_SPI *ble, IBatteryDriver *batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 39 | 40 | virtual void Init(); 41 | virtual void ResetPairing(); 42 | virtual void ResetState(); 43 | virtual bool SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix); 44 | 45 | static BluetoothKeyboardDriver* Create(IBatteryDriver* batteryDriver, BaseKeyboardDescriptor *keyboardDescriptor, ILogger *logger); 46 | static BluetoothKeyboardDriver* GetInstance(); 47 | }; 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V2/PinDriver.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V2) 2 | 3 | #include "PinDriver.h" 4 | 5 | void PinDriver::refreshCache() 6 | { 7 | uint32_t banks = 0; 8 | 9 | /* 10 | Columns on TKL 11 | Ports 15 - 22: 0x4F, last block of columns 12 | Ports 23 - 30: 0x57, middle block of columns 13 | Port 31: 0x5F, first column 14 | */ 15 | 16 | uint32_t firstColumn = this->max7301->read(0x5F); 17 | uint16_t middleBlock = this->max7301->read(0x57); 18 | uint16_t lastBlock = this->max7301->read(0x4F); 19 | 20 | banks |= (firstColumn << 16); 21 | banks |= (middleBlock << 8); 22 | banks |= lastBlock; 23 | 24 | cache = banks; 25 | } 26 | 27 | uint8_t PinDriver::readPin(uint8_t pinNumber) 28 | { 29 | uint32_t mask = (((uint32_t)1) << (16 - pinNumber)); 30 | uint8_t result = ((cache & mask) >> (16 - pinNumber)); 31 | 32 | return (~result) & 0b00000001; 33 | } 34 | 35 | void PinDriver::writePin(uint8_t pinNumber, uint8_t value) 36 | { 37 | /* 38 | Rows on TKL 39 | 4: 0x24 40 | 5: 0x25 41 | 6: 0x26 42 | 7: 0x27 43 | 8: 0x28 44 | 9: 0x29 45 | */ 46 | 47 | this->max7301->write(0x29 - pinNumber, value); 48 | } 49 | 50 | PinDriver::PinDriver(Max7301* max7301, ILogger *logger) 51 | { 52 | this->max7301 = max7301; 53 | this->max7301->begin(); 54 | 55 | this->max7301->write(0x06, 0xff); 56 | 57 | //00 is forbidden, 01 is output port, 10 is input without pull up, 11 is output with pull up 58 | 59 | this->max7301->write(0x09, 0b01010101); // ports 7 - 4, rows 60 | this->max7301->write(0x0A, 0b01010101); // ports 11 - 8, rows 61 | 62 | this->max7301->write(0x0B, 0b11111111); // ports 15 - 12, columns 63 | this->max7301->write(0x0C, 0b11111111); // ports 19 - 16, columns 64 | this->max7301->write(0x0D, 0b11111111); // ports 23 - 20, columns 65 | this->max7301->write(0x0E, 0b11111111); // ports 27 - 24, columns 66 | this->max7301->write(0x0F, 0b11111111); // ports 31 - 28, columns 67 | 68 | this->max7301->enable(); 69 | } 70 | 71 | #endif -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/PCB/JLCPCB/Numpad-NPTH.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ; DRILL file {KiCad (6.0.5)} date Mon Jul 11 19:38:58 2022 3 | ; FORMAT={-:-/ absolute / metric / decimal} 4 | ; #@! TF.CreationDate,2022-07-11T19:38:58+02:00 5 | ; #@! TF.GenerationSoftware,Kicad,Pcbnew,(6.0.5) 6 | ; #@! TF.FileFunction,NonPlated,1,2,NPTH 7 | FMAT,2 8 | METRIC 9 | ; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill 10 | T1C3.000 11 | ; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill 12 | T2C3.048 13 | ; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill 14 | T3C3.988 15 | ; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill 16 | T4C4.000 17 | % 18 | G90 19 | G05 20 | T1 21 | X31.949Y-66.845 22 | X31.949Y-85.895 23 | X31.949Y-104.945 24 | X31.949Y-123.995 25 | X38.299Y-64.305 26 | X38.299Y-83.355 27 | X38.299Y-102.405 28 | X38.299Y-121.455 29 | X41.479Y-143.04 30 | X47.829Y-140.5 31 | X50.999Y-66.845 32 | X50.999Y-85.895 33 | X50.999Y-104.945 34 | X50.999Y-123.995 35 | X57.349Y-64.305 36 | X57.349Y-83.355 37 | X57.349Y-102.405 38 | X57.349Y-121.455 39 | X70.049Y-66.845 40 | X70.049Y-85.895 41 | X70.049Y-104.945 42 | X70.049Y-123.995 43 | X70.049Y-143.045 44 | X76.399Y-64.305 45 | X76.399Y-83.355 46 | X76.399Y-102.405 47 | X76.399Y-121.455 48 | X76.399Y-140.505 49 | X89.099Y-66.845 50 | X89.104Y-95.415 51 | X89.104Y-133.515 52 | X95.449Y-64.305 53 | X95.454Y-92.875 54 | X95.454Y-130.975 55 | T2 56 | X32.081Y-130.975 57 | X55.957Y-130.975 58 | X84.659Y-78.397 59 | X84.659Y-102.273 60 | X84.659Y-116.497 61 | X84.659Y-140.373 62 | T3 63 | X32.081Y-146.215 64 | X55.957Y-146.215 65 | X99.899Y-78.397 66 | X99.899Y-102.273 67 | X99.899Y-116.497 68 | X99.899Y-140.373 69 | T4 70 | X34.489Y-61.765 71 | X34.489Y-80.815 72 | X34.489Y-99.865 73 | X34.489Y-118.915 74 | X44.019Y-137.96 75 | X53.539Y-61.765 76 | X53.539Y-80.815 77 | X53.539Y-99.865 78 | X53.539Y-118.915 79 | X72.589Y-61.765 80 | X72.589Y-80.815 81 | X72.589Y-99.865 82 | X72.589Y-118.915 83 | X72.589Y-137.965 84 | X91.639Y-61.765 85 | X91.644Y-90.335 86 | X91.644Y-128.435 87 | T0 88 | M30 89 | -------------------------------------------------------------------------------- /docs/gallery.md: -------------------------------------------------------------------------------- 1 | # Galery 2 | 3 | ## Revision 2 4 | Keyboard Top 5 | ![TKL from top](./images/tkl_rev_2_top.jpg) 6 | 7 | Keyboard detail 8 | ![TKL from detail](./images/tkl_rev_2_detail.jpg) 9 | 10 | Numpad from angle 11 | ![Numpad from angle](./images/numpad_angled.jpg) 12 | 13 | Numpad from top 14 | ![Numpad from top](./images/numpad_top.jpg) 15 | 16 | ## Revision 1 17 | Reality top cover 18 | ![Case top cover](./images/case_top_with_cover.jpeg) 19 | 20 | Reality top white LEDs 21 | ![Case top white LEDs](./images/case_top_white_leds.jpeg) 22 | 23 | Reality top colorfull LEDs 24 | ![Case top colorfull LEDs](./images/case_top_colorfull_leds.jpeg) 25 | 26 | Reality back 27 | ![Case back](./images/case_back.jpeg) 28 | 29 | Reality back connector 30 | ![Case back connector](./images/case_back_connector.jpeg) 31 | 32 | Keyboard 33 | ![Keyboard](./images/keyboard_rev1.png) 34 | 35 | Reality front random colors 36 | ![PCB reality front random colors](./images/pcb_real_front_rev1_colors.png) 37 | 38 | Reality front 39 | ![PCB reality front](./images/pcb_real_front_rev1.png) 40 | 41 | Render 42 | ![Case render](./images/case_render_full.png) 43 | 44 | Render no plate 45 | ![case render no plate](./images/case_render_without_plate.png) 46 | 47 | Render no pcb 48 | ![case render no pcb](./images/case_render_without_pcb.png) 49 | 50 | Render no cover 51 | ![case render no cover](./images/case_render_without_cover.png) 52 | 53 | Render front 54 | ![PCB render front](./images/pcb_render_front_rev1.png) 55 | 56 | Render back 57 | ![PCB render back](./images/pcb_render_back_rev1.png) 58 | 59 | Reality Plate 60 | ![Plate reality](./images/plate_tkl.jpg) 61 | 62 | Render 63 | ![Plate render](./images/plate_rev1.png) 64 | 65 | Scheme 66 | ![PCB scheme](./images/pcb_rev1.png) 67 | 68 | Reality front 69 | ![PCB reality front](./images/pcb_real_front_rev0.png) 70 | 71 | Reality back 72 | ![PCB reality back](./images/pcb_real_back_rev0.png) 73 | 74 | Reality numpad with LEDs on 75 | ![PCB reality LEDs](./images/numpad_pcb.jpg) -------------------------------------------------------------------------------- /docs/manual.md: -------------------------------------------------------------------------------- 1 | # Manual 2 | 3 | ## Bluetooth 4 | For pairing the keyboard first [reset original pairing](#shortcuts), pair it with the device and then [switch to Bluetooth](#shortcuts). 5 | 6 | Keyboard will be named as XBoard during the pairing. 7 | 8 | When switching between USB and Bluetooth, you'll see which input channel is selected by blinking key. 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Selected channel
USB
Bluetooth
KeyF1F2
22 | 23 | ## Battery 24 | Battery charge is visualised on Fkey line after pressing the [shortcut](#Shortcuts). Data will be shown as follow: 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
Key
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
Battery [%]102030405060708090100Keyboard is powered by USB
56 | 57 | When battery drops under 15%, then keyboard turns red. 58 | 59 | ## Shortcuts 60 | 61 | | **Action** | **Shortcut** | 62 | | :----------------------------: | :--------------: | 63 | | Bluetooth Pairing Reset | Ctrl + Win + Esc | 64 | | Toggle LED on/off | Ctrl + Win + F1 | 65 | | Switch between USB / Bluetooth | Ctrl + Win + F2 | 66 | | Randomize LEDs colors | Ctrl + Win + F3 | 67 | | Show battery status | Ctrl + Win + F4 | 68 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/Features/RGBLedFeature.cpp: -------------------------------------------------------------------------------- 1 | #include "RGBLedFeature.h" 2 | 3 | RGBLedFeature::RGBLedFeature(IKeyboardSDK* keyboardSDK) 4 | { 5 | this->keyboardSDK = keyboardSDK; 6 | this->currentState = RGBLedFeatures::RGBLedTurnOn; 7 | } 8 | 9 | void RGBLedFeature::turnOff() 10 | { 11 | this->keyboardSDK->GetRGBLedDriver()->turnOff(); 12 | } 13 | 14 | void RGBLedFeature::turnOn() 15 | { 16 | this->keyboardSDK->GetRGBLedDriver()->turnOn(); 17 | } 18 | 19 | void RGBLedFeature::randomizeColors() 20 | { 21 | this->keyboardSDK->GetRGBLedDriver()->randomizeColors(); 22 | } 23 | 24 | void RGBLedFeature::toggle() 25 | { 26 | this->keyboardSDK->GetRGBLedDriver()->toggle(); 27 | } 28 | 29 | void RGBLedFeature::showBatteryLevel() 30 | { 31 | this->turnOff(); 32 | keyboardSDK->GetRGBLedDriver()->blink(0xff, 0, ( keyboardSDK->GetBatteryDriver()->readBatteryLevel() / 10) + 1, 0x00ffffff); 33 | } 34 | 35 | void RGBLedFeature::evaluate(uint8_t featureId) 36 | { 37 | switch (featureId) 38 | { 39 | case RGBLedFeatures::RGBLedTurnOn: 40 | this->turnOn(); 41 | break; 42 | 43 | case RGBLedFeatures::RGBLedTurnOff: 44 | this->turnOff(); 45 | break; 46 | 47 | case RGBLedFeatures::RGBLedRandomColors: 48 | this->randomizeColors(); 49 | break; 50 | 51 | case RGBLedFeatures::RGBLedBatteryLevel: 52 | this->showBatteryLevel(); 53 | break; 54 | 55 | case RGBLedFeatures::RGBLedToggle: 56 | this->toggle(); 57 | break; 58 | 59 | case RGBLedFeatures::RGBLedSuspend: 60 | if (this->currentState != RGBLedFeatures::RGBLedSuspend) 61 | { 62 | this->stateAtSuspend = this->currentState; 63 | this->turnOff(); 64 | } 65 | break; 66 | 67 | case RGBLedFeatures::RGBLedWake: 68 | if (this->currentState == RGBLedFeatures::RGBLedSuspend) 69 | { 70 | this->evaluate(this->stateAtSuspend); 71 | return; 72 | } 73 | break; 74 | 75 | default: 76 | break; 77 | } 78 | 79 | if (featureId != RGBLedFeatures::RGBLedWake) 80 | { 81 | this->currentState = (RGBLedFeatures)featureId; 82 | } 83 | } -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | All prices below are based 5 pieces (minimum) on: [JLCPCB](https://jlcpcb.com/). 2 | 3 | # Keyboard revison 2 (PCB: $22.34, SMT: $77.29 work in progress) 4 | - PCB based on Rev 1 features, added: 5 | - ⭐ Switch matrix is driven by IO expanders through SPI to achieve <1 ms end to end latencies. 6 | - ⭐ Heavily increased brightness of all LEDs by having separate LED driver for each 2 columns (due to max current per chip). 7 | - ⭐ Fixed bug with swapped GND and VCC, no more bridging needed. 8 | - TKL Case 9 | - ⭐ Added support for magnetically attachable numpad from left or right by inserting magnets into prepared sockets. 10 | - I recommend N52 magnets, with those connection is strong enough to lift numpad part into air :) 11 | - I used these [magnets 20x5x2](https://www.aliexpress.com/item/1005001646834539.html?spm=a2g0o.order_list.0.0.25271802ZhGVrg) from exactly this store. I had bad experience with some other sellers as quality of magnets were lower than advertised. 12 | - You need 18 magnets in total for TKL keyboard (and another 18 for numpad). 13 | - Numpad Case 14 | - ⭐ Created magnetically attachable numpad! :) 15 | - Similar design like main TKL keyboard (just without internal pillars for extra support) 16 | - Requires it's own microcontroller and battery in case of bluetooth usage. 17 | - Top part of numpad is kept empty for this moment - work in progress, meant for display and fingerprint sensor. 18 | 19 | # Keyboard revison 1 (PCB: $21.8, SMT: $30.56) 20 | - PCB based on revision 0 features, added: 21 | - ⭐ Switch matrix is driven by IO expanders through I2C. 22 | - ⭐ Added RGB leds to every switch 23 | - Each LED's color configurable separately. 24 | - Controlled by built-in LED driver controlled through I2C. 25 | - 💪🏻 All solderable [JLCPCB](https://jlcpcb.com/) library components for assembly are moved to top side. 26 | - 💪🏻 Increased clearances. 27 | - 🤜🏻 Collisions of diods with stabilizers are fixed. 28 | - :exclamation: Contains bug with powering MCP23017 chips (GND and VCC are swapped - can be easily fixed by bridging with 2 wires and some scratching :) ) 29 | 30 | # Keyboard revision 0 (PCB: $22.1, SMT: N/A) 31 | - ⭐ TKL matrix for Cherry MX switches. 32 | - ⭐ Holes for stabilizers. 33 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/KeyboardDescriptor.cpp: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) 2 | 3 | #include "KeyboardDescriptor.h" 4 | #include "Features/BluetoothFeature.h" 5 | #include "Features/RGBLedFeature.h" 6 | 7 | KeyboardDescriptor::KeyboardDescriptor(uint8_t numberOfRows, uint8_t numberOfColumns) : BaseKeyboardDescriptor(numberOfRows, numberOfColumns) 8 | { 9 | this->keymaps = this->createKeyMap(); 10 | this->coordMap = this->createCoordinatesMap(this->keymaps); 11 | this->featureMacros = this->createFeatureMacros(); 12 | } 13 | 14 | FeatureMacro** KeyboardDescriptor::createFeatureMacros() 15 | { 16 | this->featureMacroCount = 6; 17 | 18 | featureMacros = new FeatureMacro*[this->featureMacroCount] { 19 | new FeatureMacro(RGBLedFeatures::RGBLedToggle, 2, new KeyCode[2] { KK_NUM_LOCK, KK_PAD_0 }), 20 | new FeatureMacro(RGBLedFeatures::RGBLedRandomizeColors, 2, new KeyCode[2] { KK_NUM_LOCK, KK_PAD_DOT }), 21 | new FeatureMacro(RGBLedFeatures::RGBLedShowBatteryLevel, 2, new KeyCode[2] { KK_NUM_LOCK, KK_ENTER }), 22 | new FeatureMacro(RGBLedFeatures::RGBLedTurnOff, RGBLedFeatures::RGBLedTurnOn, 10000), 23 | new FeatureMacro(BluetoothFeatures::BluetoothReset, 2, new KeyCode[2] { KK_NUM_LOCK, KK_PAD_SUBTRACT }), 24 | new FeatureMacro(BluetoothFeatures::BluetoothToggle, 2, new KeyCode[2] { KK_NUM_LOCK, KK_PAD_1 }), 25 | }; 26 | } 27 | 28 | KeyCode *** KeyboardDescriptor::createKeyMap() 29 | { 30 | KeyCode ***keymap = new KeyCode **[this->getLayersCount()]; 31 | 32 | keymap[0] = new KeyCode *[this->numberOfRows]; 33 | keymap[0][0] = new KeyCode[this->numberOfColumns]{KK_NUM_LOCK, KK_PAD_DIVIDE, KK_PAD_MULTIPLY, KK_PAD_SUBTRACT}; 34 | keymap[0][1] = new KeyCode[this->numberOfColumns]{KK_PAD_7, KK_PAD_8, KK_PAD_9, KK_RESERVED}; 35 | keymap[0][2] = new KeyCode[this->numberOfColumns]{KK_PAD_4, KK_PAD_5, KK_PAD_6, KK_PAD_ADD}; 36 | keymap[0][3] = new KeyCode[this->numberOfColumns]{KK_PAD_1, KK_PAD_2, KK_PAD_3, KK_RESERVED}; 37 | keymap[0][4] = new KeyCode[this->numberOfColumns]{KK_PAD_0, KK_RESERVED, KK_PAD_DOT, KK_PAD_ENTER}; 38 | 39 | return keymap; 40 | } 41 | 42 | uint8_t KeyboardDescriptor::getSelectedLayer(Matrix *pressedKeysMatrix) 43 | { 44 | return 0; 45 | } 46 | 47 | uint8_t KeyboardDescriptor::getLayersCount() 48 | { 49 | return 1; 50 | } 51 | 52 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/KeyPressProcessor.cpp: -------------------------------------------------------------------------------- 1 | #include "KeyPressProcessor.h" 2 | 3 | KeyPressProcessor::KeyPressProcessor(MatrixScanner *matrixScanner, MatrixEvaluator *matrixEvaluator, IKeyboardDriver *keyboardDriver, BaseKeyboardDescriptor *keyboardDescriptor, MacroEvaluator* macroEvaluator, ILogger *logger) 4 | { 5 | this->matrixScanner = matrixScanner; 6 | this->matrixEvaluator = matrixEvaluator; 7 | this->keyboardDriver = keyboardDriver; 8 | this->keyboardDescriptor = keyboardDescriptor; 9 | this->macroEvaluator = macroEvaluator; 10 | //this->logger = logger; 11 | } 12 | 13 | void KeyPressProcessor::scan() 14 | { 15 | // unsigned long startTime = micros(); 16 | 17 | Matrix *matrix = this->matrixScanner->scanKeyPressMatrix(); 18 | 19 | // unsigned long scanTime = millis(); 20 | // unsigned long diffTime = millis(); 21 | // unsigned long sendKeyTime = millis(); 22 | 23 | if (this->previousMatrix != NULL) 24 | { 25 | Matrix *pressedKeysMatrix = this->matrixEvaluator->getPressedKeysMatrix(this->previousMatrix, matrix); 26 | Matrix *releasedKeysMatrix = this->matrixEvaluator->getReleasedKeysMatrix(this->previousMatrix, matrix); 27 | 28 | // diffTime = millis(); 29 | 30 | if (!this->macroEvaluator->evaluate(matrix)) 31 | { 32 | this->keyboardDriver->SendKeys(pressedKeysMatrix, releasedKeysMatrix); 33 | } 34 | 35 | // sendKeyTime = millis(); 36 | 37 | delete pressedKeysMatrix; 38 | delete releasedKeysMatrix; 39 | delete this->previousMatrix; 40 | } 41 | 42 | this->previousMatrix = matrix; 43 | 44 | // if (this->logger->isEnabled()) 45 | // { 46 | // unsigned long endTime = micros(); 47 | // unsigned long scanElapsedTime = scanTime - startTime; 48 | // unsigned long diffElapsedTime = diffTime - scanTime; 49 | // unsigned long sendKeyElapsedTime = sendKeyTime - diffTime; 50 | // unsigned long totalElapsedTime = endTime - startTime; 51 | 52 | // this->logger->logDebug((String("Scan duration: ") + String(scanElapsedTime)).c_str()); 53 | // this->logger->logDebug((String("Diff duration: ") + String(diffElapsedTime)).c_str()); 54 | // this->logger->logDebug((String("Send duration: ") + String(sendKeyElapsedTime)).c_str()); 55 | // this->logger->logDebug((String("Total duration: ") + String(totalElapsedTime)).c_str()); 56 | // } 57 | } 58 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/BaseKeyboardDescriptor.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseKeyboardDescriptor.h" 2 | 3 | BaseKeyboardDescriptor::BaseKeyboardDescriptor(uint8_t numberOfRows, uint8_t numberOfColumns) 4 | { 5 | this->numberOfRows = numberOfRows; 6 | this->numberOfColumns = numberOfColumns; 7 | } 8 | 9 | uint8_t BaseKeyboardDescriptor::getRowCount() 10 | { 11 | return this->numberOfRows; 12 | } 13 | 14 | uint8_t BaseKeyboardDescriptor::getColumnCount() 15 | { 16 | return this->numberOfColumns; 17 | } 18 | 19 | BaseKeyboardDescriptor::Coordinates **BaseKeyboardDescriptor::getCoordinatesMap() 20 | { 21 | return this->coordMap; 22 | } 23 | 24 | KeyCode ***BaseKeyboardDescriptor::getKeyMap() 25 | { 26 | return keymaps; 27 | } 28 | 29 | FeatureMacro** BaseKeyboardDescriptor::getFeatureMacros() 30 | { 31 | return this->featureMacros; 32 | } 33 | 34 | uint8_t BaseKeyboardDescriptor::getFeatureMacroCount() 35 | { 36 | return this->featureMacroCount; 37 | } 38 | 39 | KeyType BaseKeyboardDescriptor::getKeyType(uint8_t layer, uint8_t row, uint8_t column) 40 | { 41 | if (layer == 1 && row == 0) // This is hack as I mostly test on Feather32u4 and I don't have enough of flash storage to send whole map ... 42 | { 43 | auto keyCode = this->getKeyMap()[1][row][column]; 44 | 45 | switch (keyCode) 46 | { 47 | case KK_PREVIOUS: 48 | case KK_NEXT: 49 | case KK_PLAY_PAUSE: 50 | case KK_VOLUME_MUTE: 51 | case KK_VOLUME_DOWN: 52 | case KK_VOLUME_UP: 53 | return KeyType::MEDIA; 54 | 55 | default: 56 | return KeyType::KEY; 57 | } 58 | } 59 | 60 | return KeyType::KEY; 61 | } 62 | 63 | BaseKeyboardDescriptor::Coordinates ** BaseKeyboardDescriptor::createCoordinatesMap(KeyCode ***keymaps) 64 | { 65 | Coordinates ** coordMap = new Coordinates*[0xff + 1]; 66 | 67 | for (uint8_t layer = 0; layer < 1; layer++) 68 | { 69 | for (uint8_t row = 0; row < this->getRowCount(); row++) 70 | { 71 | for (uint8_t column = 0; column < this->getColumnCount(); column++) 72 | { 73 | Coordinates* coord = new Coordinates(row, column); 74 | auto key = keymaps[layer][row][column]; 75 | 76 | coordMap[(uint8_t)key] = coord; 77 | } 78 | } 79 | } 80 | 81 | return coordMap; 82 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V1/RgbLedDriver.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V1) 2 | 3 | #include "RgbLedDriver.h" 4 | 5 | RgbLedDriver::RgbLedDriver(ILogger *logger, uint8_t rowsCount, uint8_t columnCount) 6 | { 7 | //this->logger = logger; 8 | this->rowsCount = rowsCount; 9 | this->columnCount = columnCount; 10 | this->controller1 = new Is31fl3743a(0x2C, &Wire, logger, 0b00101001, 6, 10, 0xFF); 11 | this->controller2 = new Is31fl3743a(0x23, &Wire, logger, 0b00111001, 6, 7, 0xFF); 12 | } 13 | 14 | void RgbLedDriver::blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color) 15 | { 16 | uint8_t r = (uint8_t)((color & 0x00ff0000) >> 16); 17 | uint8_t g = (uint8_t)((color & 0x0000ff00) >> 8); 18 | uint8_t b = (uint8_t)(color & 0x000000ff); 19 | uint8_t intensity = (256 - animationPhase); 20 | 21 | this->setColor(x, y, r / intensity, g / intensity, b / intensity); 22 | } 23 | 24 | void RgbLedDriver::setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity) 25 | { 26 | if (y < 9) 27 | { 28 | controller1->setLedIntensities(x, y, redIntensity, greenIntensity, blueIntensity); 29 | } 30 | else 31 | { 32 | controller2->setLedIntensities(x, y - 9, redIntensity, greenIntensity, blueIntensity); 33 | } 34 | } 35 | 36 | void RgbLedDriver::randomizeColors() 37 | { 38 | for (uint8_t row = 0; row < this->rowsCount; row++) 39 | { 40 | for (uint8_t column = 0; column < this->columnCount; column++) 41 | { 42 | uint32_t color = random(0x00ffffff); 43 | uint8_t r = (uint8_t)((color & 0x00ff0000) >> 16); 44 | uint8_t g = (uint8_t)((color & 0x0000ff00) >> 8); 45 | uint8_t b = (uint8_t)(color & 0x000000ff); 46 | 47 | this->setColor(row, column, r, g, b); 48 | } 49 | } 50 | } 51 | 52 | void RgbLedDriver::turnOn() 53 | { 54 | if (this->controller1->getGlobalIntensity() == 0) 55 | { 56 | this->controller1->setGlobalIntensity(0xff); 57 | } 58 | 59 | if (this->controller2->getGlobalIntensity() == 0) 60 | { 61 | this->controller2->setGlobalIntensity(0xff); 62 | } 63 | } 64 | 65 | void RgbLedDriver::turnOff() 66 | { 67 | this->controller1->setGlobalIntensity(0); 68 | this->controller2->setGlobalIntensity(0); 69 | } 70 | 71 | bool RgbLedDriver::toggle() 72 | { 73 | if (this->controller1->getGlobalIntensity() > 0) 74 | { 75 | turnOff(); 76 | return false; 77 | } 78 | else 79 | { 80 | turnOn(); 81 | return true; 82 | } 83 | } 84 | 85 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/Numpad/V2/RgbLedDriver.cpp: -------------------------------------------------------------------------------- 1 | #if defined(NUMPAD) && defined(V2) 2 | 3 | #include "RgbLedDriver.h" 4 | 5 | RgbLedDriver::RgbLedDriver(ILogger *logger, uint8_t rowsCount, uint8_t columnCount) 6 | { 7 | this->logger = logger; 8 | this->rowsCount = rowsCount; 9 | this->columnCount = columnCount; 10 | this->controller1 = new Is31fl3743a(0x2F, &Wire, logger, 0b10011001, 6, 4, 0xFF); 11 | this->controller2 = new Is31fl3743a(0x20, &Wire, logger, 0b10011001, 6, 4, 0xFF); 12 | } 13 | 14 | void RgbLedDriver::blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color) 15 | { 16 | uint8_t r = (uint8_t)((color & 0x00ff0000) >> 16); 17 | uint8_t g = (uint8_t)((color & 0x0000ff00) >> 8); 18 | uint8_t b = (uint8_t)(color & 0x000000ff); 19 | uint8_t intensity = (256 - animationPhase); 20 | 21 | this->setColor(x, y, r / intensity, g / intensity, b / intensity); 22 | } 23 | 24 | void RgbLedDriver::setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity) 25 | { 26 | if (y < 9) 27 | { 28 | controller1->setLedIntensities(x, y, redIntensity, greenIntensity, blueIntensity); 29 | } 30 | else 31 | { 32 | controller2->setLedIntensities(x, y - 9, redIntensity, greenIntensity, blueIntensity); 33 | } 34 | } 35 | 36 | void RgbLedDriver::randomizeColors() 37 | { 38 | for (uint8_t row = 0; row < this->rowsCount; row++) 39 | { 40 | for (uint8_t column = 0; column < this->columnCount; column++) 41 | { 42 | uint32_t color = random(0x00ffffff); 43 | uint8_t r = (uint8_t)((color & 0x00ff0000) >> 16); 44 | uint8_t g = (uint8_t)((color & 0x0000ff00) >> 8); 45 | uint8_t b = (uint8_t)(color & 0x000000ff); 46 | 47 | this->setColor(row, column, r, g, b); 48 | } 49 | } 50 | } 51 | 52 | void RgbLedDriver::turnOn() 53 | { 54 | if (this->controller1->getGlobalIntensity() == 0) 55 | { 56 | this->controller1->setGlobalIntensity(0xff); 57 | } 58 | 59 | if (this->controller2->getGlobalIntensity() == 0) 60 | { 61 | this->controller2->setGlobalIntensity(0xff); 62 | } 63 | } 64 | 65 | void RgbLedDriver::turnOff() 66 | { 67 | this->controller1->setGlobalIntensity(0); 68 | this->controller2->setGlobalIntensity(0); 69 | } 70 | 71 | bool RgbLedDriver::toggle() 72 | { 73 | if (this->controller1->getGlobalIntensity() > 0) 74 | { 75 | turnOff(); 76 | return false; 77 | } 78 | else 79 | { 80 | turnOn(); 81 | return true; 82 | } 83 | } 84 | 85 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/TinyS3/UsbHidKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef TINYS3 2 | 3 | #include "UsbHidKeyboardDriver.h" 4 | #include "USBHIDConsumerControl.h" 5 | #include "USBHIDSystemControl.h" 6 | 7 | USBHIDKeyboard keyboard; 8 | USBHIDConsumerControl ConsumerControl; 9 | USBHIDSystemControl SystemControl; 10 | 11 | 12 | UsbHidKeyboardDriver::UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor) 13 | { 14 | this->keyboardDescriptor = keyboardDescriptor; 15 | 16 | // Important, default is just self powered and without this line it's not possible to wake up computer from sleep 17 | USB.usbAttributes(TUSB_DESC_CONFIG_ATT_SELF_POWERED | TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP); 18 | 19 | keyboard.begin(); 20 | ConsumerControl.begin(); 21 | USB.begin(); 22 | } 23 | 24 | bool UsbHidKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 25 | { 26 | isKeyMenuHold |= this->keyboardDescriptor->getSelectedLayer(pressedKeysMatrix); 27 | isKeyMenuHold &= ~(this->keyboardDescriptor->getSelectedLayer(releasedKeysMatrix)); 28 | uint8_t currentLayer = isKeyMenuHold ? 1 : 0; 29 | 30 | auto keymap = this->keyboardDescriptor->getKeyMap()[currentLayer]; 31 | 32 | bool isPress = false; 33 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 34 | { 35 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 36 | { 37 | auto currentKey = keymap[row][column]; 38 | 39 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 40 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 41 | 42 | auto keyType = this->keyboardDescriptor->getKeyType(currentLayer, row, column); 43 | 44 | if (isPressed) 45 | { 46 | isPress = true; 47 | 48 | SystemControl.press(SYSTEM_CONTROL_WAKE_HOST); //TODO: call this only when computer is on sleep... 49 | 50 | if (keyType != KeyType::MEDIA) 51 | { 52 | keyboard.pressRaw((uint8_t)currentKey); 53 | } 54 | else 55 | { 56 | ConsumerControl.press((uint8_t)currentKey); 57 | } 58 | } 59 | else if (isReleased) 60 | { 61 | keyboard.releaseRaw((uint8_t)currentKey); 62 | ConsumerControl.release(); 63 | } 64 | } 65 | } 66 | 67 | return isPress; 68 | } 69 | 70 | void UsbHidKeyboardDriver::ResetPairing() 71 | { 72 | } 73 | 74 | void UsbHidKeyboardDriver::ResetState() 75 | { 76 | keyboard.begin(); 77 | ConsumerControl.begin(); 78 | USB.begin(); 79 | keyboard.releaseAll(); 80 | ConsumerControl.release(); 81 | } 82 | 83 | #endif -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Micro/UsbHidKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef ARDUINO_MICRO 2 | 3 | #include "UsbHidKeyboardDriver.h" 4 | #include "HID-Project.h" 5 | 6 | UsbHidKeyboardDriver::UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor) 7 | { 8 | this->keyboardDescriptor = keyboardDescriptor; 9 | Consumer.begin(); 10 | NKROKeyboard.begin(); 11 | } 12 | 13 | bool UsbHidKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 14 | { 15 | bool isPress = false; 16 | 17 | isKeyMenuHold |= this->keyboardDescriptor->getSelectedLayer(pressedKeysMatrix); 18 | isKeyMenuHold &= ~(this->keyboardDescriptor->getSelectedLayer(releasedKeysMatrix)); 19 | 20 | if (isKeyMenuHold && this->keyboardDescriptor->getLayersCount() > 1) { 21 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 22 | { 23 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 24 | { 25 | auto keymap = this->keyboardDescriptor->getKeyMap()[1]; 26 | auto currentKey = keymap[row][column]; 27 | 28 | auto keyType = this->keyboardDescriptor->getKeyType(1, row, column); 29 | 30 | if (keyType != KeyType::MEDIA) 31 | { 32 | continue; 33 | } 34 | 35 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 36 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 37 | 38 | if (isPressed) 39 | { 40 | isPress = true; 41 | Consumer.press((ConsumerKeycode)currentKey); 42 | } 43 | else if (isReleased) 44 | { 45 | Consumer.release((ConsumerKeycode)currentKey); 46 | } 47 | } 48 | } 49 | } 50 | else 51 | { 52 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 53 | { 54 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 55 | { 56 | auto keymap = this->keyboardDescriptor->getKeyMap()[0]; 57 | auto currentKey = keymap[row][column]; 58 | 59 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 60 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 61 | 62 | if (isPressed) 63 | { 64 | NKROKeyboard.press((KeyboardKeycode)currentKey); 65 | isPress = true; 66 | } 67 | else if (isReleased) 68 | { 69 | NKROKeyboard.release((KeyboardKeycode)currentKey); 70 | } 71 | } 72 | } 73 | NKROKeyboard.send(); 74 | } 75 | return isPress; 76 | } 77 | 78 | void UsbHidKeyboardDriver::ResetPairing() 79 | { 80 | } 81 | 82 | void UsbHidKeyboardDriver::ResetState() 83 | { 84 | NKROKeyboard.releaseAll(); 85 | } 86 | 87 | #endif -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Keyboard overview 2 | As usual, I started with this project because I couldn't find keyboard I'd like to use. 3 | 4 | This project is trying to build following: 5 | - :white_check_mark: TKL hotswap keyboard for Cherry MX switches. 6 | - :white_check_mark: RGB LEDs under each switch (individually controllable from connected device). 7 | - :white_check_mark: Bluetooth 5.0. 8 | - :white_check_mark: Charging through USB-C. 9 | - :construction: Anodized aluminium frame of Filco Majestouch 2 design. 10 | - :white_check_mark: Part of case with connector is removable & replacable (to replace either connector or whole microcontroller for any other). 11 | 12 | Side features: 13 | - :white_check_mark: Except of sockets & connectors for connecting to MCU everything is on front side for soldering on JCLPCB side. 14 | - :white_check_mark: Modularity - All logic chips are on separate modules. Main PCB contains just RGB LEDs, sockets and IO expanders with LED drivers. 15 | 16 | ❤️ I have some spare PCBs based on Revision 1 & 2.
17 | **I will donate 1 piece of PCB per person** (develiry paid by you). Be aware, that it's just PCB, components must be soldered by you. 18 | 19 | # Current status 20 | [Revision 2](changelog.md) PCB is working, check details about the [rev 2 build](docs/revisions/rev2.md) and [manual](./docs/manual.md)! 21 | 22 | I am finishing validation of adjusted casing and planning aluminium manufacturing soon. 23 | 24 | If you are interested in more granular updates, I created [this Discord channel](https://discord.com/channels/1029883759740334140/1029884160967442452) where I'll be posting status, photos, ideas, etc. 25 | 26 | ## Achievements 27 | - :zap: It's fast. In [Joltfly test](./docs/images/joltfly_rev_1.png) I got 0 ms latency. My internal measurements are 500 microseconds. 28 | - :high_brightness: It's bright. RGB LED lights are well visible even during the daylight. 29 | 30 | # Next steps 31 | Polishing firmware is main focus. It's working, but there is a lot of technical debt there due to support of multiple microcontrollers for testing. 32 | I started to work on [QMK support](https://github.com/vladimir-aubrecht/qmk_firmware/tree/xboard/keyboards/xboard). 33 | 34 | For more details on long term plans you can check this [document](./docs/future.md). 35 | 36 | ![TKL from top](./docs/images/tkl_rev_2_top.jpg) 37 | ![TKL from detail](./docs/images/tkl_rev_2_detail.jpg) 38 | 39 | Check more [photos](./docs/gallery.md)! :) 40 | 41 | # Credits 42 | 43 | - [Jakub](https://www.printables.com/@null) for printing case for me on Prusa XL so I can have it in single piece :) -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/MCUs/Feather32u4/UsbHidKeyboardDriver.cpp: -------------------------------------------------------------------------------- 1 | #ifdef FEATHER32U4 2 | 3 | #include "UsbHidKeyboardDriver.h" 4 | #include "HID-Project.h" 5 | 6 | UsbHidKeyboardDriver::UsbHidKeyboardDriver(BaseKeyboardDescriptor *keyboardDescriptor) 7 | { 8 | this->keyboardDescriptor = keyboardDescriptor; 9 | Consumer.begin(); 10 | NKROKeyboard.begin(); 11 | } 12 | 13 | bool UsbHidKeyboardDriver::SendKeys(Matrix *pressedKeysMatrix, Matrix *releasedKeysMatrix) 14 | { 15 | bool isChanged = false; 16 | 17 | isKeyMenuHold |= this->keyboardDescriptor->getSelectedLayer(pressedKeysMatrix); 18 | isKeyMenuHold &= ~(this->keyboardDescriptor->getSelectedLayer(releasedKeysMatrix)); 19 | 20 | if (isKeyMenuHold && this->keyboardDescriptor->getLayersCount() > 1) { 21 | 22 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 23 | { 24 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 25 | { 26 | auto keymap = this->keyboardDescriptor->getKeyMap()[1]; 27 | auto currentKey = keymap[row][column]; 28 | 29 | auto keyType = this->keyboardDescriptor->getKeyType(1, row, column); 30 | 31 | if (keyType != KeyType::MEDIA) 32 | { 33 | continue; 34 | } 35 | 36 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 37 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 38 | 39 | if (isPressed) 40 | { 41 | isChanged = true; 42 | Consumer.press((ConsumerKeycode)currentKey); 43 | } 44 | else if (isReleased) 45 | { 46 | Consumer.release((ConsumerKeycode)currentKey); 47 | isChanged = true; 48 | } 49 | } 50 | } 51 | } 52 | else 53 | { 54 | for (uint8_t row = 0; row < pressedKeysMatrix->numberOfRows; row++) 55 | { 56 | for (uint8_t column = 0; column < pressedKeysMatrix->numberOfColumns; column++) 57 | { 58 | auto keymap = this->keyboardDescriptor->getKeyMap()[0]; 59 | auto currentKey = keymap[row][column]; 60 | 61 | uint8_t isPressed = pressedKeysMatrix->getBit(row, column); 62 | uint8_t isReleased = releasedKeysMatrix->getBit(row, column); 63 | 64 | if (isPressed) 65 | { 66 | NKROKeyboard.press((KeyboardKeycode)currentKey); 67 | isChanged = true; 68 | } 69 | else if (isReleased) 70 | { 71 | NKROKeyboard.release((KeyboardKeycode)currentKey); 72 | isChanged = true; 73 | } 74 | } 75 | } 76 | 77 | if (isChanged) { 78 | NKROKeyboard.send(); 79 | } 80 | } 81 | return isChanged; 82 | } 83 | 84 | void UsbHidKeyboardDriver::ResetPairing() 85 | { 86 | } 87 | 88 | void UsbHidKeyboardDriver::ResetState() 89 | { 90 | NKROKeyboard.releaseAll(); 91 | } 92 | 93 | #endif -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/C_0402_1005Metric.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "C_0402_1005Metric" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 5F68FEEE) 4 | (descr "Capacitor SMD 0402 (1005 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator") 5 | (tags "capacitor") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 -1.16) (layer "F.SilkS") hide 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp 3f001d39-98c9-450a-a6f0-b7475527fbd7) 10 | ) 11 | (fp_text value "C_0402_1005Metric" (at 0 1.16) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp 7ef18d46-39df-486f-9543-b00228cf866a) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") 16 | (effects (font (size 0.25 0.25) (thickness 0.04))) 17 | (tstamp 5d9a85df-c718-4dd6-9c1c-7cf078103b70) 18 | ) 19 | (fp_line (start -0.107836 0.36) (end 0.107836 0.36) (layer "F.SilkS") (width 0.12) (tstamp 45c77330-acfb-4107-a599-c9df3e175000)) 20 | (fp_line (start -0.107836 -0.36) (end 0.107836 -0.36) (layer "F.SilkS") (width 0.12) (tstamp 5cd5b77f-bdc3-47d5-b253-f5c1244d375e)) 21 | (fp_line (start -0.91 0.46) (end -0.91 -0.46) (layer "F.CrtYd") (width 0.05) (tstamp 0f646a94-faea-4a50-8b80-909d26d6d7a0)) 22 | (fp_line (start 0.91 -0.46) (end 0.91 0.46) (layer "F.CrtYd") (width 0.05) (tstamp 40007d5f-c471-4d2b-87f0-dfa1629069fb)) 23 | (fp_line (start 0.91 0.46) (end -0.91 0.46) (layer "F.CrtYd") (width 0.05) (tstamp 6897dba4-f95f-426a-ae14-d4aed1cd887f)) 24 | (fp_line (start -0.91 -0.46) (end 0.91 -0.46) (layer "F.CrtYd") (width 0.05) (tstamp 6aa26098-9339-4279-9a36-893fdd4c6950)) 25 | (fp_line (start -0.5 -0.25) (end 0.5 -0.25) (layer "F.Fab") (width 0.1) (tstamp 3b194c04-55c2-4668-b84d-8f5aacd704a2)) 26 | (fp_line (start 0.5 -0.25) (end 0.5 0.25) (layer "F.Fab") (width 0.1) (tstamp 3c7e7f28-d67d-4e18-8c13-2a82b2c60f01)) 27 | (fp_line (start 0.5 0.25) (end -0.5 0.25) (layer "F.Fab") (width 0.1) (tstamp 8a7cad66-4840-4328-b7bf-cbbc635c7362)) 28 | (fp_line (start -0.5 0.25) (end -0.5 -0.25) (layer "F.Fab") (width 0.1) (tstamp fe53c845-ac3c-48e4-9f37-36da777bc994)) 29 | (pad "1" smd roundrect (at -0.48 0) (size 0.56 0.62) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f0d6bdbe-8dea-4984-9c52-f76168ceed26)) 30 | (pad "2" smd roundrect (at 0.48 0) (size 0.56 0.62) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 07bccb1b-781c-4561-a379-63c349828818)) 31 | (model "${KICAD6_3DMODEL_DIR}/Capacitor_SMD.3dshapes/C_0402_1005Metric.wrl" 32 | (offset (xyz 0 0 0)) 33 | (scale (xyz 1 1 1)) 34 | (rotate (xyz 0 0 0)) 35 | ) 36 | ) 37 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/R_0402_1005Metric.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "R_0402_1005Metric" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 5F68FEEE) 4 | (descr "Resistor SMD 0402 (1005 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator") 5 | (tags "resistor") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 -1.17) (layer "F.SilkS") hide 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp 41d78466-b78f-4259-a93b-b5098dbbea74) 10 | ) 11 | (fp_text value "R_0402_1005Metric" (at 0 1.17) (layer "F.Fab") 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp c8b0a43f-eb80-49fa-9f77-e02d4b03d7c9) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab") 16 | (effects (font (size 0.26 0.26) (thickness 0.04))) 17 | (tstamp 3061a90f-a481-4c92-b184-11e8cdb5c40e) 18 | ) 19 | (fp_line (start -0.153641 -0.38) (end 0.153641 -0.38) (layer "F.SilkS") (width 0.12) (tstamp e17efb13-8792-4f70-81c4-4fc1f4995f7f)) 20 | (fp_line (start -0.153641 0.38) (end 0.153641 0.38) (layer "F.SilkS") (width 0.12) (tstamp ef794941-a745-46fd-8982-3bf3b39dd4fc)) 21 | (fp_line (start -0.93 0.47) (end -0.93 -0.47) (layer "F.CrtYd") (width 0.05) (tstamp 1121d59e-f03d-42ac-85a2-357338f6cb7d)) 22 | (fp_line (start 0.93 -0.47) (end 0.93 0.47) (layer "F.CrtYd") (width 0.05) (tstamp 332a6d58-096d-4cc7-9324-96105a58f8d7)) 23 | (fp_line (start -0.93 -0.47) (end 0.93 -0.47) (layer "F.CrtYd") (width 0.05) (tstamp 37a147d4-3d5d-4a47-8102-c954a7e61a94)) 24 | (fp_line (start 0.93 0.47) (end -0.93 0.47) (layer "F.CrtYd") (width 0.05) (tstamp a5090ca4-de76-43ea-a14c-c1e11daae04b)) 25 | (fp_line (start -0.525 0.27) (end -0.525 -0.27) (layer "F.Fab") (width 0.1) (tstamp 3efa2f2c-1877-4dcc-914d-5e9d06a61f10)) 26 | (fp_line (start -0.525 -0.27) (end 0.525 -0.27) (layer "F.Fab") (width 0.1) (tstamp ab9e8747-b37b-4830-9372-c45b6e571f09)) 27 | (fp_line (start 0.525 0.27) (end -0.525 0.27) (layer "F.Fab") (width 0.1) (tstamp b8e0a956-ce18-4779-ad22-ae8f9f8b37c2)) 28 | (fp_line (start 0.525 -0.27) (end 0.525 0.27) (layer "F.Fab") (width 0.1) (tstamp be66e16d-9918-4c52-b0d7-0d397372d213)) 29 | (pad "1" smd roundrect (at -0.51 0) (size 0.54 0.64) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 71bd5113-61af-4f98-a937-b89111941731)) 30 | (pad "2" smd roundrect (at 0.51 0) (size 0.54 0.64) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b2dc4744-6f7a-4267-a134-185dba0d1741)) 31 | (model "${KICAD6_3DMODEL_DIR}/Resistor_SMD.3dshapes/R_0402_1005Metric.wrl" 32 | (offset (xyz 0 0 0)) 33 | (scale (xyz 1 1 1)) 34 | (rotate (xyz 0 0 0)) 35 | ) 36 | ) 37 | -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/Assembly/JLCPCB/Numpad.csv: -------------------------------------------------------------------------------- 1 | "Comment","Designator","Footprint","LCSC" 2 | "C 1uF","C1","Footprints:C_0402_1005Metric","C52923" 3 | "C_100nF","C2","Footprints:C_0402_1005Metric","C1525" 4 | "C_47nF","C5","Footprints:C_0402_1005Metric","C505502" 5 | "LED_NUMPAD","D1","Footprints:19-237","C883183" 6 | "LED_7","D2","Footprints:19-237","C883183" 7 | "LED_4","D3","Footprints:19-237","C883183" 8 | "LED_1","D4","Footprints:19-237","C883183" 9 | "LED_0","D5","Footprints:19-237","C883183" 10 | "LED_SLASH","D6","Footprints:19-237","C883183" 11 | "LED_8","D7","Footprints:19-237","C883183" 12 | "LED_5","D8","Footprints:19-237","C883183" 13 | "LED_2","D9","Footprints:19-237","C883183" 14 | "LED_STAR","D10","Footprints:19-237","C883183" 15 | "LED9","D11","Footprints:19-237","C883183" 16 | "LED_6","D12","Footprints:19-237","C883183" 17 | "LED_3","D13","Footprints:19-237","C883183" 18 | "LED_DOT","D14","Footprints:19-237","C883183" 19 | "LED_MINUS","D15","Footprints:19-237","C883183" 20 | "LED_PLUS","D16","Footprints:19-237","C883183" 21 | "LED_ENTER","D17","Footprints:19-237","C883183" 22 | "D","D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29, D30, D31, D32, D33, D34","Diode_SMD:D_SOD-523","C414017" 23 | "Conn_01x04","J1, J2","Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical","N/A" 24 | ".","K_DOT1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 25 | "8","K_EIGHT1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 26 | "ENTER","K_ENTER1","Footprints:CherryMX_PlateMount_HotSwap_2u_90deg","C2803348" 27 | "5","K_FIVE1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 28 | "4","K_FOUR1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 29 | "-","K_MINUS1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 30 | "9","K_NINE1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 31 | "NUMPAD","K_NUMPAD1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 32 | "1","K_ONE1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 33 | "+","K_PLUS1","Footprints:CherryMX_PlateMount_HotSwap_2u_90deg","C2803348" 34 | "7","K_SEVEN1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 35 | "6","K_SIX1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 36 | "/","K_SLASH1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 37 | "*","K_STAR1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 38 | "3","K_THREE1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 39 | "2","K_TWO1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 40 | "0","K_ZERO1","Footprints:CherryMX_PlateMount_HotSwap_2u","C2803348" 41 | "R_39_kOhm","R1","Footprints:R_0402_1005Metric","C25783" 42 | "R 10 kOhm","R2, R3, R4, R5, R6","Footprints:R_0402_1005Metric","C25744" 43 | "MAX7301ATL+","U1","QFN50P600X600X80-41N","C1522600" 44 | "IS31FL3743-QF","U2","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 45 | "IS31FL3743-QF","U3","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 46 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/Chips/Max7301.cpp: -------------------------------------------------------------------------------- 1 | #include "Max7301.h" 2 | 3 | #define ENABLE_FAST_WRITE 1 4 | 5 | Max7301::Max7301(uint8_t csPin, uint8_t mosiPin, uint8_t sclkPin, uint8_t misoPin) 6 | { 7 | this->sclkPin = sclkPin; 8 | this->mosiPin = mosiPin; 9 | this->csPin = csPin; 10 | this->misoPin = misoPin; 11 | } 12 | 13 | void Max7301::begin() 14 | { 15 | pinMode(this->mosiPin, OUTPUT); 16 | pinMode(this->sclkPin, OUTPUT); 17 | pinMode(this->misoPin, INPUT_PULLUP); 18 | 19 | pinMode(this->csPin, OUTPUT); 20 | digitalWrite(this->csPin, HIGH); 21 | digitalWrite(this->sclkPin, LOW); 22 | 23 | delay(10); 24 | } 25 | 26 | byte Max7301::transferByte(byte data_out) 27 | { 28 | byte current_bit, result; 29 | result = 0; 30 | 31 | for(current_bit = 0; current_bit < 8; current_bit++) 32 | { 33 | #if defined(FEATHER32U4) && defined(ENABLE_FAST_WRITE) 34 | PORTB &= B11011111; 35 | #else 36 | digitalWrite(this->sclkPin, LOW); 37 | #endif 38 | 39 | //uint8_t readBit = (PINC >> PC7) & 1; 40 | result = (result << 1) | digitalRead(this->misoPin); 41 | 42 | #if defined(FEATHER32U4) && defined(ENABLE_FAST_WRITE) 43 | PORTB &= B10111111; 44 | PORTB |= (data_out & 0x80) >> 1; // D10 is bit 6 MOSI, D9 is bit 5 CLK, D11 is bit 7 CS. Significantly faster version of: digitalWrite(this->mosiPin, data_out & 0x80); 45 | #else 46 | digitalWrite(this->mosiPin, data_out & 0x80); 47 | #endif 48 | 49 | data_out <<= 1; 50 | 51 | #if defined(FEATHER32U4) && defined(ENABLE_FAST_WRITE) 52 | PORTB |= B00100000; 53 | #else 54 | digitalWrite(this->sclkPin, HIGH); 55 | #endif 56 | } 57 | 58 | return result; 59 | } 60 | 61 | uint8_t Max7301::transferWord(uint8_t cmdByte, uint8_t dataByte) 62 | { 63 | #if defined(FEATHER32U4) && defined(ENABLE_FAST_WRITE) 64 | PORTB &= B01111111; 65 | #else 66 | digitalWrite(this->csPin, LOW); 67 | #endif 68 | 69 | transferByte(cmdByte); 70 | uint8_t data = transferByte(dataByte); 71 | 72 | #if defined(FEATHER32U4) && defined(ENABLE_FAST_WRITE) 73 | PORTB |= B10000000; 74 | PORTB &= B11011111; 75 | #else 76 | digitalWrite(this->csPin, HIGH); 77 | digitalWrite(this->sclkPin, LOW); 78 | #endif 79 | 80 | return data; 81 | } 82 | 83 | uint8_t Max7301::read(uint8_t address) 84 | { 85 | uint8_t data = 0; 86 | address |= 0x80; 87 | transferWord(address, 0x00); 88 | data = transferWord(0x00, 0x00); 89 | return data; 90 | } 91 | 92 | void Max7301::write(uint8_t address, uint8_t value) 93 | { 94 | address &= ~0x80; 95 | transferWord(address, value); 96 | } 97 | 98 | void Max7301::enable() 99 | { 100 | delay(500); 101 | this->write(0x04, 1); 102 | } -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/MacroEvaluator.cpp: -------------------------------------------------------------------------------- 1 | #include "MacroEvaluator.h" 2 | 3 | MacroEvaluator::MacroEvaluator(BaseKeyboardDescriptor* keyboardDescriptor) 4 | { 5 | this->keyboardDescriptor = keyboardDescriptor; 6 | this->context = new MacroEvaluatorContext(); 7 | } 8 | 9 | void MacroEvaluator::registerFeature(BaseFeature* feature) 10 | { 11 | if (registeredFeatures == NULL) 12 | { 13 | this->registeredFeatures = new BaseFeature*[1] { feature }; 14 | this->registeredFeatureCount = 1; 15 | return; 16 | } 17 | 18 | BaseFeature** backup = this->registeredFeatures; 19 | 20 | this->registeredFeatureCount++; 21 | this->registeredFeatures = new BaseFeature*[this->registeredFeatureCount]; 22 | 23 | for (uint8_t i = 0; i < this->registeredFeatureCount - 1; i++) 24 | { 25 | this->registeredFeatures[i] = backup[i]; 26 | } 27 | 28 | this->registeredFeatures[this->registeredFeatureCount - 1] = feature; 29 | 30 | delete backup; 31 | } 32 | 33 | bool MacroEvaluator::evaluate(Matrix *matrix) 34 | { 35 | for (uint8_t row = 0; row < matrix->numberOfRows; row++) 36 | { 37 | if (matrix->matrixData[row] > 0) 38 | { 39 | this->context->LastKeyPressTime = millis(); 40 | } 41 | } 42 | 43 | bool wasAnythingTriggered = false; 44 | 45 | auto coordinateMap = this->keyboardDescriptor->getCoordinatesMap(); 46 | FeatureMacro** featureMacro = this->keyboardDescriptor->getFeatureMacros(); 47 | uint8_t macroCount = this->keyboardDescriptor->getFeatureMacroCount(); 48 | 49 | for (uint8_t macroIndex=0; macroIndex < macroCount; macroIndex++) 50 | { 51 | auto macro = featureMacro[macroIndex]; 52 | 53 | if (macro->keyCodesCount > 0) 54 | { 55 | bool isAllPressed = true; 56 | for (uint8_t keyCodeIndex = 0; keyCodeIndex < macro->keyCodesCount; keyCodeIndex++) 57 | { 58 | auto keyCode = macro->keyCodes[keyCodeIndex]; 59 | bool isPressed = matrix->getBit(coordinateMap[keyCode]->getRow(), coordinateMap[keyCode]->getColumn()); 60 | 61 | isAllPressed &= isPressed; 62 | } 63 | 64 | if (isAllPressed) 65 | { 66 | delay(80); 67 | this->evaluateAllFeatures(macro->featureId); 68 | 69 | wasAnythingTriggered = true; 70 | } 71 | } 72 | else 73 | { 74 | unsigned long now = millis(); 75 | 76 | if (now >= this->context->LastKeyPressTime + macro->activationTimeSinceLastKeyPress) 77 | { 78 | this->evaluateAllFeatures(macro->featureId); 79 | } 80 | else 81 | { 82 | this->evaluateAllFeatures(macro->otherwiseFeatureId); 83 | } 84 | } 85 | } 86 | 87 | return wasAnythingTriggered; 88 | } 89 | 90 | void MacroEvaluator::evaluateAllFeatures(uint8_t featureId) 91 | { 92 | for (uint8_t i = 0; i < this->registeredFeatureCount; i++) 93 | { 94 | this->registeredFeatures[i]->evaluate(featureId); 95 | } 96 | } -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_1u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_1u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4B2) 4 | (attr smd) 5 | (fp_text reference "K_ESC" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 1f02ce2c-09c0-4c22-a496-9bdfa057e678) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89 180) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp ea245aae-c7ee-4f1c-94ec-a9b1bcc9d655) 12 | ) 13 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 03d4d22a-4bdc-40ff-aaa8-35b106bb9255)) 14 | (fp_line (start 9 4.5) (end 9 9) (layer "F.SilkS") (width 0.15) (tstamp 22f78807-c7ac-4308-bd89-4c8e81265d01)) 15 | (fp_line (start 9 -9) (end 5 -9) (layer "F.SilkS") (width 0.15) (tstamp 2c98e2f6-f857-4ce0-a178-88ba7e1026f9)) 16 | (fp_line (start -9 -9) (end -5 -9) (layer "F.SilkS") (width 0.15) (tstamp 3fc5cd9c-6457-4a96-87d4-c2e3d77b6f36)) 17 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 46a41e62-57ab-4282-9fd9-538a66e5af6e)) 18 | (fp_line (start -9 4.5) (end -9 9) (layer "F.SilkS") (width 0.15) (tstamp 4db0d8c4-6452-4af6-95cd-80e0613dcd68)) 19 | (fp_line (start -9 9) (end -5 9) (layer "F.SilkS") (width 0.15) (tstamp 5786bedd-a72e-4ee4-a7fc-30dc8b6a2614)) 20 | (fp_line (start 6.995 -6.995) (end 6.995 7.005) (layer "F.SilkS") (width 0.15) (tstamp 6444962e-9ae2-4aff-9d27-a3e99199c0bc)) 21 | (fp_line (start 5 9) (end 9 9) (layer "F.SilkS") (width 0.15) (tstamp 711ee89f-498e-4418-b588-3eff0653e24a)) 22 | (fp_line (start -9 -9) (end -9 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 976d3dae-9631-45ee-9db4-91488c974cfb)) 23 | (fp_line (start -7.005 7.005) (end -7.005 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 98d93d6a-8df1-4e74-b1cd-e7524062ac4e)) 24 | (fp_line (start -7.005 -6.995) (end 6.995 -6.995) (layer "F.SilkS") (width 0.15) (tstamp c3779baf-343e-43d1-92f8-973f2cfc389c)) 25 | (fp_line (start 9 -4.5) (end 9 -9) (layer "F.SilkS") (width 0.15) (tstamp d421d20c-b891-464e-9d14-310020ba9fe6)) 26 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp e3f010f3-ce8d-4396-849d-65b591864094)) 27 | (fp_line (start 6.995 7.005) (end -7.005 7.005) (layer "F.SilkS") (width 0.15) (tstamp e8d6733c-fa3b-4ad5-89b5-312fd3e38a62)) 28 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp f2e6c15d-2c82-4142-8055-32414f9e3098)) 29 | (pad "" np_thru_hole circle (at -2.545 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp a81ab25d-caf8-429f-9711-f33fd983d6eb)) 30 | (pad "" np_thru_hole circle (at 3.805 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp d66fbe60-9b3a-43d9-8a84-78a0b06c242d)) 31 | (pad "" np_thru_hole circle (at -0.005 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp d748c48a-746a-414d-8055-347fdb8608dd)) 32 | (pad "1" smd rect (at 7.08 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 7120e9b6-e766-4500-948b-ea7397d0d93b)) 33 | (pad "2" smd rect (at -5.847 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp b83ecd88-607d-4fd0-a17f-356d3cb72040)) 34 | ) 35 | -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/Assembly/JLCPCB/Numpad-top-pos.csv: -------------------------------------------------------------------------------- 1 | Designator,Val,Package,Mid X,Mid Y,Rotation,Layer 2 | "C1","C 1uF","C_0402_1005Metric",51.600328,-91.186000,180.000000,top 3 | "C2","C_100nF","C_0402_1005Metric",51.600328,-89.916000,180.000000,top 4 | "C5","C_47nF","C_0402_1005Metric",37.084000,-34.798000,0.000000,top 5 | "D1","LED_NUMPAD","19-237",34.494000,-56.695000,0.000000,top 6 | "D2","LED_7","19-237",34.494000,-75.745000,0.000000,top 7 | "D3","LED_4","19-237",34.494000,-94.795000,0.000000,top 8 | "D4","LED_1","19-237",34.494000,-113.845000,0.000000,top 9 | "D5","LED_0","19-237",44.019000,-132.895000,0.000000,top 10 | "D6","LED_SLASH","19-237",53.544000,-56.695000,0.000000,top 11 | "D7","LED_8","19-237",53.544000,-75.745000,0.000000,top 12 | "D8","LED_5","19-237",53.544000,-94.795000,0.000000,top 13 | "D9","LED_2","19-237",53.544000,-113.845000,0.000000,top 14 | "D10","LED_STAR","19-237",72.594000,-56.695000,0.000000,top 15 | "D11","LED9","19-237",72.594000,-75.745000,0.000000,top 16 | "D12","LED_6","19-237",72.594000,-94.795000,0.000000,top 17 | "D13","LED_3","19-237",72.594000,-113.845000,0.000000,top 18 | "D14","LED_DOT","19-237",72.594000,-132.895000,0.000000,top 19 | "D15","LED_MINUS","19-237",91.644000,-56.695000,0.000000,top 20 | "D16","LED_PLUS","19-237",91.644000,-85.270000,0.000000,top 21 | "D17","LED_ENTER","19-237",91.644000,-123.370000,0.000000,top 22 | "D18","D","D_SOD-523",26.089000,-61.760000,-90.000000,top 23 | "D19","D","D_SOD-523",26.089000,-80.810000,-90.000000,top 24 | "D20","D","D_SOD-523",26.089000,-99.860000,-90.000000,top 25 | "D21","D","D_SOD-523",26.089000,-118.910000,-90.000000,top 26 | "D22","D","D_SOD-523",35.614000,-137.960000,-90.000000,top 27 | "D23","D","D_SOD-523",45.139000,-61.760000,-90.000000,top 28 | "D24","D","D_SOD-523",45.139000,-80.810000,-90.000000,top 29 | "D25","D","D_SOD-523",45.139000,-99.860000,-90.000000,top 30 | "D26","D","D_SOD-523",45.139000,-118.910000,-90.000000,top 31 | "D27","D","D_SOD-523",64.189000,-61.760000,-90.000000,top 32 | "D28","D","D_SOD-523",64.189000,-80.810000,-90.000000,top 33 | "D29","D","D_SOD-523",64.189000,-99.860000,-90.000000,top 34 | "D30","D","D_SOD-523",64.189000,-118.910000,-90.000000,top 35 | "D31","D","D_SOD-523",64.189000,-137.960000,-90.000000,top 36 | "D32","D","D_SOD-523",83.239000,-61.760000,-90.000000,top 37 | "D33","D","D_SOD-523",83.239000,-90.335000,-90.000000,top 38 | "D34","D","D_SOD-523",83.239000,-128.435000,-90.000000,top 39 | "J1","Conn_01x04","PinHeader_1x04_P2.54mm_Vertical",100.320000,-35.894000,180.000000,top 40 | "J2","Conn_01x04","PinHeader_1x04_P2.54mm_Vertical",41.926000,-35.894000,180.000000,top 41 | "R1","R_39_kOhm","R_0402_1005Metric",37.084000,-33.528000,180.000000,top 42 | "R2","R","R_0402_1005Metric",48.514000,-88.900000,180.000000,top 43 | "R3","R","R_0402_1005Metric",69.700000,-108.000000,180.000000,top 44 | "R4","R 10 kOhm","R_0402_1005Metric",37.084000,-28.956000,0.000000,top 45 | "R5","R 10 kOhm","R_0402_1005Metric",37.084000,-30.226000,0.000000,top 46 | "R6","R 10 kOhm","R_0402_1005Metric",37.084000,-31.496000,180.000000,top 47 | "U1","MAX7301ATL+","QFN50P600X600X80-41N",31.514000,-35.963000,-90.000000,top 48 | "U2","IS31FL3743-QF","QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm",43.942000,-90.424000,0.000000,top 49 | "U3","IS31FL3743-QF","QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm",63.119000,-109.347000,0.000000,top 50 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/D_SOD-523.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "D_SOD-523" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 586419F0) 4 | (descr "http://www.diodes.com/datasheets/ap02001.pdf p.144") 5 | (tags "Diode SOD523") 6 | (attr smd) 7 | (fp_text reference "REF**" (at 0 -1.3) (layer "F.SilkS") hide 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | (tstamp 85eb3387-ef18-49e8-9307-84116999c459) 10 | ) 11 | (fp_text value "D_SOD-523" (at 0 1.4) (layer "F.Fab") hide 12 | (effects (font (size 1 1) (thickness 0.15))) 13 | (tstamp f0958a15-8668-4ddf-979f-73a4e2f116a3) 14 | ) 15 | (fp_text user "${REFERENCE}" (at 0 -1.3) (layer "F.Fab") hide 16 | (effects (font (size 1 1) (thickness 0.15))) 17 | (tstamp ed7f06cf-bc11-434d-8adf-2bf908121cec) 18 | ) 19 | (fp_line (start 0.7 0.6) (end -1.15 0.6) (layer "F.SilkS") (width 0.12) (tstamp 25b644fd-a9e2-404b-8cdc-cdeef8daa222)) 20 | (fp_line (start 0.7 -0.6) (end -1.15 -0.6) (layer "F.SilkS") (width 0.12) (tstamp 6cb64322-0115-4159-8191-42fc6beefc15)) 21 | (fp_line (start -1.15 -0.6) (end -1.15 0.6) (layer "F.SilkS") (width 0.12) (tstamp 8ccaa5e8-c656-4886-9c69-8c5486e6e29b)) 22 | (fp_line (start 1.25 -0.7) (end 1.25 0.7) (layer "F.CrtYd") (width 0.05) (tstamp 081c476d-09af-49e9-b139-65f9b8a7e55f)) 23 | (fp_line (start -1.25 -0.7) (end 1.25 -0.7) (layer "F.CrtYd") (width 0.05) (tstamp 5183cded-523d-4baa-804c-e297711ae782)) 24 | (fp_line (start 1.25 0.7) (end -1.25 0.7) (layer "F.CrtYd") (width 0.05) (tstamp a1d1c2f6-0bde-431a-9ac1-362102344df2)) 25 | (fp_line (start -1.25 0.7) (end -1.25 -0.7) (layer "F.CrtYd") (width 0.05) (tstamp f3fa8101-aa73-49bf-b1b5-15bab46f7e73)) 26 | (fp_line (start -0.2 0) (end 0.1 0.2) (layer "F.Fab") (width 0.1) (tstamp 16090396-5662-4d0b-8bd4-2898f68675cb)) 27 | (fp_line (start 0.1 0) (end 0.25 0) (layer "F.Fab") (width 0.1) (tstamp 2ac2882a-fa0d-4b7c-a82f-6364f40fe709)) 28 | (fp_line (start -0.65 0.45) (end -0.65 -0.45) (layer "F.Fab") (width 0.1) (tstamp 5dd94f6a-8fcb-4b56-b7ef-a75218f29fb8)) 29 | (fp_line (start 0.65 0.45) (end -0.65 0.45) (layer "F.Fab") (width 0.1) (tstamp 5f11e4de-3f31-4ed1-98d6-17edcbcdeb03)) 30 | (fp_line (start 0.65 -0.45) (end 0.65 0.45) (layer "F.Fab") (width 0.1) (tstamp 65ce8d5d-11ad-4f58-a898-02df08871bbc)) 31 | (fp_line (start -0.65 -0.45) (end 0.65 -0.45) (layer "F.Fab") (width 0.1) (tstamp 6b8b8dbd-39ec-49be-8e65-7aac759e29ae)) 32 | (fp_line (start -0.2 0.2) (end -0.2 -0.2) (layer "F.Fab") (width 0.1) (tstamp 96dcc4d4-5735-4d28-a43e-99c7ffeaceaa)) 33 | (fp_line (start -0.2 0) (end -0.35 0) (layer "F.Fab") (width 0.1) (tstamp e60174c0-3a5b-4ec2-aa7e-ad7a34b31058)) 34 | (fp_line (start 0.1 0.2) (end 0.1 -0.2) (layer "F.Fab") (width 0.1) (tstamp e86511a5-97dd-4767-9eef-a2ff4c21b4ab)) 35 | (fp_line (start 0.1 -0.2) (end -0.2 0) (layer "F.Fab") (width 0.1) (tstamp f0c2cd52-89c3-4c85-b20d-5240b12a3caf)) 36 | (pad "1" smd rect (at -0.7 0 180) (size 0.6 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2424c9c5-7b73-49bb-a99a-dd73401598cf)) 37 | (pad "2" smd rect (at 0.7 0 180) (size 0.6 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 0cdca0c3-f6b4-42a3-b29c-247ccd5a3147)) 38 | (model "${KICAD6_3DMODEL_DIR}/Diode_SMD.3dshapes/D_SOD-523.wrl" 39 | (offset (xyz 0 0 0)) 40 | (scale (xyz 1 1 1)) 41 | (rotate (xyz 0 0 0)) 42 | ) 43 | ) 44 | -------------------------------------------------------------------------------- /pcb/Numpad Keyboard/Output/PCB/JLCPCB/Numpad-job.gbrjob: -------------------------------------------------------------------------------- 1 | { 2 | "Header": { 3 | "GenerationSoftware": { 4 | "Vendor": "KiCad", 5 | "Application": "Pcbnew", 6 | "Version": "(6.0.5)" 7 | }, 8 | "CreationDate": "2022-07-11T19:37:47+02:00" 9 | }, 10 | "GeneralSpecs": { 11 | "ProjectId": { 12 | "Name": "Numpad", 13 | "GUID": "4e756d70-6164-42e6-9b69-6361645f7063", 14 | "Revision": "rev?" 15 | }, 16 | "Size": { 17 | "X": 82.65, 18 | "Y": 128.2 19 | }, 20 | "LayerNumber": 2, 21 | "BoardThickness": 1.6, 22 | "Finish": "None" 23 | }, 24 | "DesignRules": [ 25 | { 26 | "Layers": "Outer", 27 | "PadToPad": 0.0, 28 | "PadToTrack": 0.0, 29 | "TrackToTrack": 0.254, 30 | "MinLineWidth": 0.127 31 | } 32 | ], 33 | "FilesAttributes": [ 34 | { 35 | "Path": "Numpad-F_Cu.gtl", 36 | "FileFunction": "Copper,L1,Top", 37 | "FilePolarity": "Positive" 38 | }, 39 | { 40 | "Path": "Numpad-B_Cu.gbl", 41 | "FileFunction": "Copper,L2,Bot", 42 | "FilePolarity": "Positive" 43 | }, 44 | { 45 | "Path": "Numpad-F_Paste.gtp", 46 | "FileFunction": "SolderPaste,Top", 47 | "FilePolarity": "Positive" 48 | }, 49 | { 50 | "Path": "Numpad-B_Paste.gbp", 51 | "FileFunction": "SolderPaste,Bot", 52 | "FilePolarity": "Positive" 53 | }, 54 | { 55 | "Path": "Numpad-F_Silkscreen.gto", 56 | "FileFunction": "Legend,Top", 57 | "FilePolarity": "Positive" 58 | }, 59 | { 60 | "Path": "Numpad-B_Silkscreen.gbo", 61 | "FileFunction": "Legend,Bot", 62 | "FilePolarity": "Positive" 63 | }, 64 | { 65 | "Path": "Numpad-F_Mask.gts", 66 | "FileFunction": "SolderMask,Top", 67 | "FilePolarity": "Negative" 68 | }, 69 | { 70 | "Path": "Numpad-B_Mask.gbs", 71 | "FileFunction": "SolderMask,Bot", 72 | "FilePolarity": "Negative" 73 | }, 74 | { 75 | "Path": "Numpad-Edge_Cuts.gm1", 76 | "FileFunction": "Profile", 77 | "FilePolarity": "Positive" 78 | } 79 | ], 80 | "MaterialStackup": [ 81 | { 82 | "Type": "Legend", 83 | "Name": "Top Silk Screen" 84 | }, 85 | { 86 | "Type": "SolderPaste", 87 | "Name": "Top Solder Paste" 88 | }, 89 | { 90 | "Type": "SolderMask", 91 | "Thickness": 0.01, 92 | "Name": "Top Solder Mask" 93 | }, 94 | { 95 | "Type": "Copper", 96 | "Thickness": 0.035, 97 | "Name": "F.Cu" 98 | }, 99 | { 100 | "Type": "Dielectric", 101 | "Thickness": 1.51, 102 | "Material": "FR4", 103 | "Name": "F.Cu/B.Cu", 104 | "Notes": "Type: dielectric layer 1 (from F.Cu to B.Cu)" 105 | }, 106 | { 107 | "Type": "Copper", 108 | "Thickness": 0.035, 109 | "Name": "B.Cu" 110 | }, 111 | { 112 | "Type": "SolderMask", 113 | "Thickness": 0.01, 114 | "Name": "Bottom Solder Mask" 115 | }, 116 | { 117 | "Type": "SolderPaste", 118 | "Name": "Bottom Solder Paste" 119 | }, 120 | { 121 | "Type": "Legend", 122 | "Name": "Bottom Silk Screen" 123 | } 124 | ] 125 | } 126 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_1.5u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_1.5u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD487) 4 | (attr smd) 5 | (fp_text reference "K_CTRL" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp b1ab6d7e-e9cd-48e4-aee6-9e0a6782fc2b) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89 180) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp f743c870-ba95-414b-8ffc-c389fb0b9838) 12 | ) 13 | (fp_line (start -13.7625 4.5) (end -13.7625 9) (layer "F.SilkS") (width 0.15) (tstamp 095a6a8b-2ed2-41ca-8331-8ada83edf2a6)) 14 | (fp_line (start 13.7625 -9) (end 9.7625 -9) (layer "F.SilkS") (width 0.15) (tstamp 1aff0474-f72c-4f33-9421-660a28d33b62)) 15 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 2c3e8420-088e-44e0-86b7-063d6ab206bd)) 16 | (fp_line (start -13.7625 -9) (end -13.7625 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 319110cc-ec35-4814-b689-932be8d2ab84)) 17 | (fp_line (start 6.995 7.005) (end -7.005 7.005) (layer "F.SilkS") (width 0.15) (tstamp 35b41366-5bce-4187-97a3-696084c42a51)) 18 | (fp_line (start -7.005 -6.995) (end 6.995 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 4716538d-54bb-49ab-b4de-c32dcc2901b4)) 19 | (fp_line (start 13.7625 4.5) (end 13.7625 9) (layer "F.SilkS") (width 0.15) (tstamp 597413d0-ef3a-4016-8cc7-f1adc2fe9bc3)) 20 | (fp_line (start -13.7625 9) (end -9.7625 9) (layer "F.SilkS") (width 0.15) (tstamp 5b99e828-3492-47d7-a1a8-f3266cefc17d)) 21 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 714b7a26-6bd0-4859-a04e-661906e8d521)) 22 | (fp_line (start 9.7625 9) (end 13.7625 9) (layer "F.SilkS") (width 0.15) (tstamp 92f82c2b-e2ac-4166-bf61-18b5631fdd35)) 23 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 9fd63187-dbee-4d7c-96ec-2f53af2b6fed)) 24 | (fp_line (start -7.005 7.005) (end -7.005 -6.995) (layer "F.SilkS") (width 0.15) (tstamp a956ab87-f477-4f4f-ad22-1c4c20f56f4b)) 25 | (fp_line (start -13.7625 -9) (end -9.7625 -9) (layer "F.SilkS") (width 0.15) (tstamp ad2da7e6-21dc-445f-bf64-5699f5785ce5)) 26 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp b1b5b95d-3f26-4717-8d63-9a38b562fdfe)) 27 | (fp_line (start 6.995 -6.995) (end 6.995 7.005) (layer "F.SilkS") (width 0.15) (tstamp bc37b43e-bcb5-4d2f-beee-7bd5ce91c519)) 28 | (fp_line (start 13.7625 -4.5) (end 13.7625 -9) (layer "F.SilkS") (width 0.15) (tstamp c855af15-88ab-4550-b48b-3a63aa3ed436)) 29 | (pad "" np_thru_hole circle (at -2.545 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 10df49fe-9eee-4fbf-b765-3f35dd7a79d5)) 30 | (pad "" np_thru_hole circle (at 3.805 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 3cdac7e7-3c34-4235-856d-fdd6532dc1cd)) 31 | (pad "" np_thru_hole circle (at -0.005 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp 43ff5951-11ea-46f1-9e5b-c8cfaedeef60)) 32 | (pad "1" smd rect (at 7.08 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp c56ff385-461d-45ef-a9a7-5f327e55f5d8)) 33 | (pad "2" smd rect (at -5.847 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 5d1210eb-38f7-45b5-b13c-d916aec96e85)) 34 | ) 35 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_1.25u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_1.25u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD496) 4 | (attr smd) 5 | (fp_text reference "K_CTRL" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 6a394a87-1904-49b4-ba61-8c1b84f8d557) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89 180) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 0a848d27-cbf8-4cd2-977c-c9455e698b5f) 12 | ) 13 | (fp_line (start -11.38125 9) (end -7.38125 9) (layer "F.SilkS") (width 0.15) (tstamp 3838c050-e0b4-407d-9d48-5b026382dde0)) 14 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 3ffec157-a2d2-4080-833e-bec0292bd0c1)) 15 | (fp_line (start -7.005 7.005) (end -7.005 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 46ef4437-65ac-4374-8f53-cca64c6bd72a)) 16 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 48e4ccb4-008e-4677-b4da-092acbd38fd0)) 17 | (fp_line (start -11.38125 4.5) (end -11.38125 9) (layer "F.SilkS") (width 0.15) (tstamp 55c28890-e4a1-4b43-9e90-0e060a77a216)) 18 | (fp_line (start 11.38125 4.5) (end 11.38125 9) (layer "F.SilkS") (width 0.15) (tstamp 5fade720-f8b7-4118-9ae0-3508cc264a0a)) 19 | (fp_line (start 6.995 -6.995) (end 6.995 7.005) (layer "F.SilkS") (width 0.15) (tstamp 7218ff92-d137-4c05-a68a-7b901e3e14f7)) 20 | (fp_line (start -11.38125 -9) (end -11.38125 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 8cbdd67d-4071-4cab-9345-d5daeec6d3c3)) 21 | (fp_line (start 6.995 7.005) (end -7.005 7.005) (layer "F.SilkS") (width 0.15) (tstamp ae93a2bb-b703-4001-9fa6-0451f52ccebb)) 22 | (fp_line (start 11.38125 -9) (end 7.38125 -9) (layer "F.SilkS") (width 0.15) (tstamp b3eafa74-547f-4b85-b0f5-b9474344328b)) 23 | (fp_line (start 11.38125 -4.5) (end 11.38125 -9) (layer "F.SilkS") (width 0.15) (tstamp b6831bd9-9af2-4613-88e9-4a473a3f5fd7)) 24 | (fp_line (start 7.38125 9) (end 11.38125 9) (layer "F.SilkS") (width 0.15) (tstamp c57cb1b6-3994-4b44-b63b-bbabdb52ff0e)) 25 | (fp_line (start -11.38125 -9) (end -7.38125 -9) (layer "F.SilkS") (width 0.15) (tstamp d362880d-d675-481c-acdf-92b3082c9652)) 26 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp ee2c954f-b0d6-46b6-9f3c-eb2851166b99)) 27 | (fp_line (start -7.005 -6.995) (end 6.995 -6.995) (layer "F.SilkS") (width 0.15) (tstamp efa8ea36-f6b5-4296-8f18-0db4d2d3f596)) 28 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp f009d7d6-7121-49df-8a38-dc40544b7d89)) 29 | (pad "" np_thru_hole circle (at -2.545 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 2ee7b19f-1a37-4c5a-bff6-2757a3c41f6e)) 30 | (pad "" np_thru_hole circle (at 3.805 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp d09a9f83-d88b-4168-9c3e-67b3390d675d)) 31 | (pad "" np_thru_hole circle (at -0.005 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp e226a6e9-8a0a-4bd1-8025-78d9bc3b40f4)) 32 | (pad "1" smd rect (at 7.08 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp ed621852-db55-4388-be80-5cb4230b1a75)) 33 | (pad "2" smd rect (at -5.847 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 3b5d6d61-d172-4f16-a344-e3eb4303e1e1)) 34 | ) 35 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_1.75u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_1.75u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4A4) 4 | (attr smd) 5 | (fp_text reference "K_CAPSL" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 875c9383-c9c9-4d83-8e28-dceb83818d8f) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89 180) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 2246e7e7-0718-45ba-a13f-5bd4dac30b77) 12 | ) 13 | (fp_line (start 6.995 -6.995) (end 6.995 7.005) (layer "F.SilkS") (width 0.15) (tstamp 0b94f737-66a8-45e6-987d-32d4d0612c83)) 14 | (fp_line (start -16.14375 4.5) (end -16.14375 9) (layer "F.SilkS") (width 0.15) (tstamp 17eb69a7-9a6f-4889-8830-16914a73ec03)) 15 | (fp_line (start -7.005 7.005) (end -7.005 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 2977f820-0b2d-4a21-b7a6-db793af3f4ac)) 16 | (fp_line (start 16.14375 4.5) (end 16.14375 9) (layer "F.SilkS") (width 0.15) (tstamp 5a46a98e-c64d-46f6-8584-1ef403f0fe3d)) 17 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 6795c226-e054-448b-9852-f08aec1c4653)) 18 | (fp_line (start 16.14375 -9) (end 12.14375 -9) (layer "F.SilkS") (width 0.15) (tstamp 692f9cf4-86da-45bc-b0f7-aebff525278a)) 19 | (fp_line (start -7.005 -6.995) (end 6.995 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 6e132110-864b-4c21-aab0-e9d724bbb01c)) 20 | (fp_line (start -16.14375 -9) (end -16.14375 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 7055a02d-7585-40ca-a03d-6086227b3087)) 21 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 8546afbd-da4f-4e6f-bec8-237d55c8974b)) 22 | (fp_line (start 12.14375 9) (end 16.14375 9) (layer "F.SilkS") (width 0.15) (tstamp 87061afb-2e8f-4b24-a3c9-3131eb5ccd2a)) 23 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 8e96d0af-fabf-4a00-86df-d87f036b8019)) 24 | (fp_line (start -16.14375 9) (end -12.14375 9) (layer "F.SilkS") (width 0.15) (tstamp a109d4f0-78dc-43e9-9619-523c99204670)) 25 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp a4b27071-7a24-44b7-b521-19c77935edd9)) 26 | (fp_line (start -16.14375 -9) (end -12.14375 -9) (layer "F.SilkS") (width 0.15) (tstamp c0fdc2ec-d7b7-4511-801a-f8a190bbd518)) 27 | (fp_line (start 6.995 7.005) (end -7.005 7.005) (layer "F.SilkS") (width 0.15) (tstamp dc4b5c5b-1921-432c-b636-1baf7f5f46f0)) 28 | (fp_line (start 16.14375 -4.5) (end 16.14375 -9) (layer "F.SilkS") (width 0.15) (tstamp f9be1856-34b9-41e0-8954-b93836638c49)) 29 | (pad "" np_thru_hole circle (at 3.805 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 2aef5602-3fdb-4363-978e-8af41e2d0604)) 30 | (pad "" np_thru_hole circle (at -2.545 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 6ffe1529-bbaf-4bd3-b2cd-3b7acd40c488)) 31 | (pad "" np_thru_hole circle (at -0.005 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp aae57dfb-e45c-4124-ad01-914151680063)) 32 | (pad "1" smd rect (at 7.08 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp d094f2bd-d6c3-4541-b1c1-93aa9df1e7c8)) 33 | (pad "2" smd rect (at -5.847 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp a5572a5a-c57c-46d5-b723-4f9348e083de)) 34 | ) 35 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/V2/RgbLedDriver.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) && defined(V2) 2 | 3 | #include "RgbLedDriver.h" 4 | 5 | RgbLedDriver::RgbLedDriver(ILogger *logger, uint8_t rowsCount, uint8_t columnCount, Tca9548a* tca) 6 | { 7 | this->logger = logger; 8 | this->rowsCount = rowsCount; 9 | this->columnCount = columnCount; 10 | this->tca = tca; 11 | 12 | tca->selectChannel(0); 13 | 14 | uint8_t maxCurrent = 0x0E; 15 | this->controllers = new Is31fl3743a*[this->controllersCount]; 16 | this->controllers[0] = new Is31fl3743a(0x20, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 17 | this->controllers[1] = new Is31fl3743a(0x23, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 18 | this->controllers[2] = new Is31fl3743a(0x2C, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 19 | this->controllers[3] = new Is31fl3743a(0x2F, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 20 | 21 | tca->selectChannel(1); 22 | 23 | this->controllers[4] = new Is31fl3743a(0x20, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 24 | this->controllers[5] = new Is31fl3743a(0x23, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 25 | this->controllers[6] = new Is31fl3743a(0x2C, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 26 | this->controllers[7] = new Is31fl3743a(0x2F, &Wire, logger, 0b10011001, 6, 2, maxCurrent); 27 | 28 | tca->selectChannel(2); 29 | this->controllers[8] = new Is31fl3743a(0x20, &Wire, logger, 0b10101001, 6, 1, maxCurrent); 30 | } 31 | 32 | void RgbLedDriver::blink(uint8_t animationPhase, uint8_t x, uint8_t y, uint32_t color) 33 | { 34 | uint8_t r = (uint8_t)((color & 0x00ff0000) >> 16); 35 | uint8_t g = (uint8_t)((color & 0x0000ff00) >> 8); 36 | uint8_t b = (uint8_t)(color & 0x000000ff); 37 | uint8_t intensity = (256 - animationPhase); 38 | 39 | this->setColor(x, y, r / intensity, g / intensity, b / intensity); 40 | } 41 | 42 | void RgbLedDriver::setColor(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity) 43 | { 44 | uint8_t index = y / 2; 45 | this->tca->selectChannel(index / 4); 46 | this->controllers[index]->setLedIntensities(x, y % 2, redIntensity, greenIntensity, blueIntensity); 47 | } 48 | 49 | void RgbLedDriver::randomizeColors() 50 | { 51 | for (uint8_t row = 0; row < this->rowsCount; row++) 52 | { 53 | for (uint8_t column = 0; column < this->columnCount; column++) 54 | { 55 | uint32_t color = random(0x00ffffff); 56 | uint8_t r = (uint8_t)((color & 0x00ff0000) >> 16); 57 | uint8_t g = (uint8_t)((color & 0x0000ff00) >> 8); 58 | uint8_t b = (uint8_t)(color & 0x000000ff); 59 | 60 | this->setColor(row, column, r, g, b); 61 | } 62 | } 63 | } 64 | 65 | void RgbLedDriver::turnOn() 66 | { 67 | for (uint8_t i = 0; i < this->controllersCount; i++) 68 | { 69 | this->tca->selectChannel(i / 4); 70 | if (this->controllers[i]->getGlobalIntensity() == 0) 71 | { 72 | this->controllers[i]->setGlobalIntensity(0xff); 73 | } 74 | } 75 | } 76 | 77 | void RgbLedDriver::turnOff() 78 | { 79 | for (uint8_t i = 0; i < this->controllersCount; i++) 80 | { 81 | this->tca->selectChannel(i / 4); 82 | this->controllers[i]->setGlobalIntensity(0); 83 | } 84 | } 85 | 86 | bool RgbLedDriver::toggle() 87 | { 88 | if (this->controllers[0]->getGlobalIntensity() > 0) 89 | { 90 | turnOff(); 91 | return false; 92 | } 93 | else 94 | { 95 | turnOn(); 96 | return true; 97 | } 98 | } 99 | 100 | #endif -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Output/Assembly/JLCPCB/vakeyboard.csv: -------------------------------------------------------------------------------- 1 | "Comment","Designator","Footprint","LCSC" 2 | "C 1uF","C1, C3, C11, C14, C16, C20","Footprints:C_0402_1005Metric","C52923" 3 | "C_100nF","C2, C4, C8, C10, C13, C15, C17, C19, C21","Footprints:C_0402_1005Metric","C1525" 4 | "C_47nF","C5","Footprints:C_0402_1005Metric","C505502" 5 | "D","D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9, D_10, D_'1, D_.1, D_/1, D_;1, D_[1, D_\1, D_]1, D_A1, D_B1, D_BCKSP1, D_C1, D_CAPSL1, D_Coma1, D_D1, D_DEL1, D_DOWN1, D_E1, D_END1, D_ENTER1, D_EQUAL1, D_ESC1, D_F1, D_F2, D_F3, D_F4, D_F5, D_F6, D_F7, D_F8, D_F9, D_F10, D_F11, D_F12, D_F_1, D_FN1, D_G1, D_H1, D_HOME1, D_I1, D_INS1, D_J1, D_K1, D_L1, D_LALT1, D_LCTRL1, D_LEFT1, D_LSHIFT1, D_LWIN1, D_M1, D_MINUS1, D_N1, D_O1, D_P1, D_PAUSE1, D_PGDOWN1, D_PGUP1, D_PRNT1, D_Q1, D_R1, D_RALT1, D_RCTRL1, D_RIGHT1, D_RSHIFT1, D_RWIN1, D_S1, D_SCRL1, D_SPACE1, D_T1, D_TAB1, D_TILDA1, D_U1, D_UP1, D_V1, D_W1, D_X1, D_Y1, D_Z1","Diode_SMD:D_SOD-523","C414017" 6 | "Conn_01x04","J1","Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical","N/A" 7 | "Conn_01x04","J2","Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical","N/A" 8 | "KEYSW","K_0, K_1, K_2, K_3, K_4, K_5, K_6, K_7, K_8, K_9, K_'1, K_.1, K_/1, K_;1, K_[1, K_\1, K_]1, K_A1, K_B1, K_BCKSP1, K_C1, K_CAPSL1, K_COMA1, K_D1, K_DEL1, K_DOWN1, K_E1, K_END1, K_ENTER1, K_EQUAL1, K_ESC1, K_F1, K_F2, K_F3, K_F4, K_F5, K_F6, K_F7, K_F8, K_F9, K_F10, K_F11, K_F12, K_F_1, K_FN1, K_G1, K_H1, K_HOME1, K_I1, K_INS1, K_J1, K_K1, K_L1, K_LALT1, K_LCTRL1, K_LEFT1, K_LSHIFT1, K_LWIN1, K_M1, K_MINUS1, K_N1, K_O1, K_P1, K_PAUSE1, K_PGDOWN1, K_PGUP1, K_PRNT1, K_Q1, K_R1, K_RALT1, K_RCTRL1, K_RIGHT1, K_RSHIFT1, K_RWIN1, K_S1, K_SCRL1, K_SPACE1, K_T1, K_TAB1, K_TILDA1, K_U1, K_UP1, K_V1, K_W1, K_X1, K_Y1, K_Z1","Footprints:CherryMX_PlateMount_HotSwap_1u","C2803348" 9 | "R 10 kOhm","R1, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20","Footprints:R_0402_1005Metric","C25744" 10 | "R_39_kOhm","R2","Footprints:R_0402_1005Metric","C25783" 11 | "LED","RGB_'1, RGB_.1, RGB_/1, RGB_;1, RGB_[1, RGB_\1, RGB_]1, RGB_A1, RGB_B1, RGB_BCKSP1, RGB_C1, RGB_CAPSL1, RGB_COMA1, RGB_D1, RGB_DEL1, RGB_DOWN1, RGB_E1, RGB_EIGHT1, RGB_END1, RGB_ENTER1, RGB_EQUAL1, RGB_ESC1, RGB_F1, RGB_F2, RGB_F3, RGB_F4, RGB_F5, RGB_F6, RGB_F7, RGB_F8, RGB_F9, RGB_F10, RGB_F11, RGB_F12, RGB_F13, RGB_FIVE1, RGB_FN1, RGB_FOUR1, RGB_G1, RGB_H1, RGB_HOME1, RGB_I1, RGB_INS1, RGB_J1, RGB_K1, RGB_L1, RGB_LALT1, RGB_LCTRL1, RGB_LEFT1, RGB_LSHIFT1, RGB_LWIN1, RGB_M1, RGB_MINUS1, RGB_N1, RGB_NINE1, RGB_O1, RGB_ONE1, RGB_P1, RGB_PAUSE1, RGB_PGDOWN1, RGB_PGUP1, RGB_PRNT1, RGB_Q1, RGB_R1, RGB_RALT1, RGB_RCTRL1, RGB_RIGHT1, RGB_RSHIFT1, RGB_RWIN1, RGB_S1, RGB_SCRL1, RGB_SEVEN1, RGB_SIX1, RGB_SPACE1, RGB_T1, RGB_TAB1, RGB_THREE1, RGB_TILDA1, RGB_TWO1, RGB_U1, RGB_UP1, RGB_V1, RGB_W1, RGB_X1, RGB_Y1, RGB_Z1, RGB_ZERO1","Footprints:19-237","C883183" 12 | "MAX7301ATL+","U1","QFN50P600X600X80-41N","C1522600" 13 | "IS31FL3743-QF","U3","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 14 | "IS31FL3743-QF","U4","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 15 | "IS31FL3743-QF","U5","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 16 | "IS31FL3743-QF","U6","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 17 | "TCA9548ARGER","U7","Package_DFN_QFN:Texas_RGE0024C_EP2.1x2.1mm","C555456" 18 | "IS31FL3743-QF","U8","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 19 | "IS31FL3743-QF","U9","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 20 | "IS31FL3743-QF","U10","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 21 | "IS31FL3743-QF","U11","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 22 | "IS31FL3743-QF","U12","Footprints:QFN-40-1EP_5x5mm_P0.4mm_EP3.4x3.4mm","C2678953" 23 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_2u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_2u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4D8) 4 | (attr smd) 5 | (fp_text reference "K_ENTER" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 841b13a5-5d3d-4a89-a38e-8aee22293dda) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 63c5abd2-5faf-4d69-9f91-933924141350) 12 | ) 13 | (fp_line (start -18.525 4.5) (end -18.525 9) (layer "F.SilkS") (width 0.15) (tstamp 07f83c42-0119-4c4d-a4d5-8a843549b1f0)) 14 | (fp_line (start 7 -7) (end 7 7) (layer "F.SilkS") (width 0.15) (tstamp 0a9c4126-4f22-4d15-92d3-ea3b420fbef9)) 15 | (fp_line (start 18.525 4.5) (end 18.525 9) (layer "F.SilkS") (width 0.15) (tstamp 0d5037cd-1734-4f88-8f6f-e4ca306195b6)) 16 | (fp_line (start 4.975 9) (end 18.525 9) (layer "F.SilkS") (width 0.15) (tstamp 0e1a3b74-6134-4e0b-8278-f685ed499fd2)) 17 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 34748074-3144-4d7b-86d8-574ea40c6364)) 18 | (fp_line (start -7 -7) (end 7 -7) (layer "F.SilkS") (width 0.15) (tstamp 36b815c8-d9f8-43cc-926d-c52720f0a758)) 19 | (fp_line (start -7 7) (end -7 -7) (layer "F.SilkS") (width 0.15) (tstamp 4053e401-c846-4f10-aee8-6f2b9de8cdf6)) 20 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 4fa3277d-2c08-4759-8a74-01ba524ec47a)) 21 | (fp_line (start -18.525 -9) (end -4.975 -9) (layer "F.SilkS") (width 0.15) (tstamp 5af5de21-c042-4469-9376-f003e2ff8a9e)) 22 | (fp_line (start 4.975 -9) (end 18.525 -9) (layer "F.SilkS") (width 0.15) (tstamp 5e45c2db-6ced-49ee-a399-df449cf3847c)) 23 | (fp_line (start -18.525 9) (end -4.975 9) (layer "F.SilkS") (width 0.15) (tstamp 715b205a-7875-49cd-9ef8-bcb9dcbda16d)) 24 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp a259dfd0-f884-44ad-838a-cc9368d97b04)) 25 | (fp_line (start 18.525 -4.5) (end 18.525 -9) (layer "F.SilkS") (width 0.15) (tstamp b500d86d-8684-4744-9680-d0c23f4899c1)) 26 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp c3ebb257-e218-4256-a004-8bef8a4594d3)) 27 | (fp_line (start -18.525 -9) (end -18.525 -4.5) (layer "F.SilkS") (width 0.15) (tstamp dd1fe835-526d-4f61-a667-79942abcd7cc)) 28 | (fp_line (start 7 7) (end -7 7) (layer "F.SilkS") (width 0.15) (tstamp f28910fe-7193-4315-b626-ba7a4156f150)) 29 | (pad "" np_thru_hole circle (at 3.81 2.54 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 005759ec-c65d-4d6e-a27d-d8bb69ba4127)) 30 | (pad "" np_thru_hole circle (at -11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp 516a74f4-2a56-4dc4-a5b0-dd43ecabcff6)) 31 | (pad "" np_thru_hole circle (at -2.54 5.08 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 99258556-b293-455b-b0d1-49f9460ef49e)) 32 | (pad "" np_thru_hole circle (at 11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp aa6e541a-eb3d-4dfe-a4a2-0828675e0479)) 33 | (pad "" np_thru_hole circle (at 11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp b346322f-c838-4bbc-a682-dd671edef89c)) 34 | (pad "" np_thru_hole circle (at 0 0 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp f8fbc090-187c-4a20-b4cf-94529a4c39e4)) 35 | (pad "" np_thru_hole circle (at -11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp faa950fd-a6a0-4f4a-9e60-9f5e4ec91ca4)) 36 | (pad "1" smd rect (at 7.085 2.54 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp ecab800d-0899-4cf7-91be-16b213ced0c1)) 37 | (pad "2" smd rect (at -5.842 5.08 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 773390cc-6cb1-4995-b35c-66fff00e51e2)) 38 | ) 39 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_2u_90deg.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_2u_90deg" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4D8) 4 | (attr smd) 5 | (fp_text reference "K_ENTER" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp e3805de2-97ff-4fa9-9be7-456d8f8f2f3b) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp b5bb8690-9008-461b-ab54-7c1fc50ce944) 12 | ) 13 | (fp_line (start 5.69 1.245) (end 5.69 -1.255) (layer "F.SilkS") (width 0.12) (tstamp 00e27de7-3853-448f-967d-c53cd35e4211)) 14 | (fp_line (start 4.44 1.245) (end 4.44 -1.255) (layer "F.SilkS") (width 0.12) (tstamp 01462fcb-7232-4915-a9ca-6517ef2c2a7f)) 15 | (fp_line (start 7 7) (end -7 7) (layer "F.SilkS") (width 0.15) (tstamp 0ebd76dc-ab6e-471f-abdf-e4b1f7bc7911)) 16 | (fp_line (start -7 7) (end -7 -7) (layer "F.SilkS") (width 0.15) (tstamp 11183757-6210-4c0b-a2d0-3705b408755c)) 17 | (fp_line (start -18.525 -9) (end -4.975 -9) (layer "F.SilkS") (width 0.15) (tstamp 23601584-0410-436e-ae3b-3e7ad08c9c26)) 18 | (fp_line (start 4.44 1.245) (end 5.69 1.245) (layer "F.SilkS") (width 0.12) (tstamp 2acf6df9-3b42-4ae5-ac7b-23438edbc113)) 19 | (fp_line (start 18.525 4.5) (end 18.525 9) (layer "F.SilkS") (width 0.15) (tstamp 36032a07-ed85-4245-99b6-2559d82c89f3)) 20 | (fp_line (start 7 -7) (end 7 7) (layer "F.SilkS") (width 0.15) (tstamp 3d2c1a02-f060-4c1f-83cf-c931c2677e5d)) 21 | (fp_line (start -18.525 9) (end -4.975 9) (layer "F.SilkS") (width 0.15) (tstamp 4d41c279-7b33-4460-950c-ea19fefce467)) 22 | (fp_line (start -7 -7) (end 7 -7) (layer "F.SilkS") (width 0.15) (tstamp 54c1ae43-3617-4b32-8436-e37e94ae0b77)) 23 | (fp_line (start 5.69 -1.255) (end 4.44 -1.255) (layer "F.SilkS") (width 0.12) (tstamp 63d63f93-e68e-4eb0-997b-5111df3d24c5)) 24 | (fp_line (start -18.525 4.5) (end -18.525 9) (layer "F.SilkS") (width 0.15) (tstamp 982129c0-c326-4297-91f3-960baa6ec6c4)) 25 | (fp_line (start 4.975 -9) (end 18.525 -9) (layer "F.SilkS") (width 0.15) (tstamp c11cde6a-b5c2-4d98-a6bf-9a3a4213b47f)) 26 | (fp_line (start -18.525 -9) (end -18.525 -4.5) (layer "F.SilkS") (width 0.15) (tstamp cf7857fa-56a7-46c3-979a-b0f21d1f19ec)) 27 | (fp_line (start 18.525 -4.5) (end 18.525 -9) (layer "F.SilkS") (width 0.15) (tstamp eac92558-bbdd-4a1a-92e6-fb5842ac62fd)) 28 | (fp_line (start 4.975 9) (end 18.525 9) (layer "F.SilkS") (width 0.15) (tstamp f0a9ce9f-c9f6-4748-a123-547f040f8bce)) 29 | (pad "" np_thru_hole circle (at -5.08 -2.54 90) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 1b0cc0ea-b887-4d4b-a0b7-c03a7b4c9e2b)) 30 | (pad "" np_thru_hole circle (at -2.54 3.81 90) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 58d0698d-cc20-45fd-9a95-689bc239f960)) 31 | (pad "" np_thru_hole circle (at -11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp 72881460-5c47-44c6-921a-fc7853244d3e)) 32 | (pad "" np_thru_hole circle (at 11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp c55f5920-5e15-41da-93d3-f8192fca5fd8)) 33 | (pad "" np_thru_hole circle (at -11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp c626e9fa-cf67-4ccb-8ad3-f55cff7b53a6)) 34 | (pad "" np_thru_hole circle (at 11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp d090907a-d2a7-4d64-bf9c-a8682af78fce)) 35 | (pad "" np_thru_hole circle (at 0 0 90) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp ef112ae4-b51b-4c6b-8e87-d958f459dc26)) 36 | (pad "1" smd rect (at -2.54 7.085 90) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp bd93a77a-6301-4a39-bcf8-77b88b610a69)) 37 | (pad "2" smd rect (at -5.08 -5.842 90) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp b3be2d1c-4489-4311-93bb-65295349a8d2)) 38 | ) 39 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_2.75u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_2.75u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4CA) 4 | (attr smd) 5 | (fp_text reference "K_RSHIFT" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp a6476ea4-2981-401e-a379-ff3c0c9ba323) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 5b6b1ddb-0eea-4d14-acc0-605681e5fdcf) 12 | ) 13 | (fp_line (start -25.66625 4.5) (end -25.66625 9) (layer "F.SilkS") (width 0.15) (tstamp 062f8d26-f20d-4434-aff1-2e19c007c5c0)) 14 | (fp_line (start -25.66625 9) (end -4.9725 9) (layer "F.SilkS") (width 0.15) (tstamp 2d3ac80a-bd59-4c04-ab9c-cb745cb86430)) 15 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 35f292af-452b-422a-8614-b1aadd845093)) 16 | (fp_line (start 25.66625 4.5) (end 25.66625 9) (layer "F.SilkS") (width 0.15) (tstamp 3aeb6220-5a57-4e88-9bbc-d51a9831ea6e)) 17 | (fp_line (start 7 -6.995) (end 7 7.005) (layer "F.SilkS") (width 0.15) (tstamp 58e9cc69-2678-4a3e-89a1-d7879aa32210)) 18 | (fp_line (start -7 7.005) (end -7 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 5f650e4a-d2f8-404b-a30c-621d3c247751)) 19 | (fp_line (start 4.9725 9) (end 25.66625 9) (layer "F.SilkS") (width 0.15) (tstamp 6c79cd25-1324-4a00-a941-1e5271843cbe)) 20 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 72d3c0fc-3ce0-4047-8314-fe3ed652cb1c)) 21 | (fp_line (start -25.66625 -9) (end -25.66625 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 7d147d87-6307-45a4-bdf8-4d678ae753de)) 22 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 869c2fc6-babb-4261-a38c-104add4652cb)) 23 | (fp_line (start 4.9725 -9) (end 25.66625 -9) (layer "F.SilkS") (width 0.15) (tstamp aaf61dae-501b-41b0-a892-46ec4f6f09fd)) 24 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp b077d3a1-59ca-4c54-9682-46a29198d0c5)) 25 | (fp_line (start -7 -6.995) (end 7 -6.995) (layer "F.SilkS") (width 0.15) (tstamp bc23b41c-5fac-490e-9a76-71368fc25c9e)) 26 | (fp_line (start 7 7.005) (end -7 7.005) (layer "F.SilkS") (width 0.15) (tstamp e687bbb9-cc58-4e42-8375-a31ad41eae76)) 27 | (fp_line (start 25.66625 -4.5) (end 25.66625 -9) (layer "F.SilkS") (width 0.15) (tstamp e702c514-00ef-4b78-b832-616ed2174538)) 28 | (fp_line (start -25.66625 -9) (end -4.9725 -9) (layer "F.SilkS") (width 0.15) (tstamp ec1a9a4c-73a1-4215-b1c1-5ee8d046f381)) 29 | (pad "" np_thru_hole circle (at -11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp 078805a7-5a46-46c7-9127-dd0ad0857957)) 30 | (pad "" np_thru_hole circle (at -2.54 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 0f82811b-e46b-45ae-a813-0c9adc5347ee)) 31 | (pad "" np_thru_hole circle (at -11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp 52231359-f2a7-4d08-9710-3dc67467667d)) 32 | (pad "" np_thru_hole circle (at 3.81 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 8c8c5eef-fb05-4c8e-a33b-bcca9d7f510e)) 33 | (pad "" np_thru_hole circle (at 0 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp b8118e34-81b3-465b-a279-01b8b0d17963)) 34 | (pad "" np_thru_hole circle (at 11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp f04fd1f7-f1f8-4f20-8b11-dac646c94b26)) 35 | (pad "" np_thru_hole circle (at 11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp fb9ea3b7-002a-49e6-9cca-7c8319e84261)) 36 | (pad "1" smd rect (at 7.085 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 30a50784-d1f6-4506-afdb-af8f1b050077)) 37 | (pad "2" smd rect (at -5.842 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 5d27fbe6-c188-464f-a638-9e8b01af0eb8)) 38 | ) 39 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_2.25u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_2.25u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4BD) 4 | (attr smd) 5 | (fp_text reference "K_LSHIFT" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp e54bac2d-e936-487f-866f-33be344ee87a) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 51517a42-3a64-4f5e-b3f1-3c65be3752ad) 12 | ) 13 | (fp_line (start -20.9045 -9) (end -20.9045 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 06fac9b7-8812-46b8-9a70-38ee24ee300e)) 14 | (fp_line (start 4.97325 -9) (end 20.9045 -9) (layer "F.SilkS") (width 0.15) (tstamp 0dd26be3-cdd0-4328-839c-0afba7e75760)) 15 | (fp_line (start 6.99875 7.005) (end -7.00125 7.005) (layer "F.SilkS") (width 0.15) (tstamp 1a5c0e22-cb7a-4e0e-a890-a6ab92670d51)) 16 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 4c658eb5-c527-472c-98ee-80b137f91906)) 17 | (fp_line (start -20.9045 -9) (end -4.97325 -9) (layer "F.SilkS") (width 0.15) (tstamp 5cbac206-5b9d-4eb6-a594-74572ed88df3)) 18 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 5fee86f3-3c69-4bbc-9374-427cb68f731e)) 19 | (fp_line (start -7.00125 7.005) (end -7.00125 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 68021d45-8758-47fb-9ba7-17b5170d144d)) 20 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 6a5c1252-db0b-4d37-9045-de418144785a)) 21 | (fp_line (start -7.00125 -6.995) (end 6.99875 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 6cc9f028-fdc6-4807-b4ec-4ce6725190c9)) 22 | (fp_line (start -20.9045 9) (end -4.97325 9) (layer "F.SilkS") (width 0.15) (tstamp 748f5421-af3c-403e-95ce-9f29ba57dfb3)) 23 | (fp_line (start 6.99875 -6.995) (end 6.99875 7.005) (layer "F.SilkS") (width 0.15) (tstamp acd63871-3b34-4e06-887e-413f736b9305)) 24 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp b089df0d-b6d8-4961-94d1-1a58c18bf172)) 25 | (fp_line (start 20.9045 -4.5) (end 20.9045 -9) (layer "F.SilkS") (width 0.15) (tstamp b5e3f9a3-c666-4e3c-be31-5b9e170ca99a)) 26 | (fp_line (start 4.97325 9) (end 20.9045 9) (layer "F.SilkS") (width 0.15) (tstamp d4ad3912-e466-476c-aa64-77594a2a5e3f)) 27 | (fp_line (start 20.9045 4.5) (end 20.9045 9) (layer "F.SilkS") (width 0.15) (tstamp f3933936-6271-4b10-b6f2-42da0d6ad2be)) 28 | (fp_line (start -20.9045 4.5) (end -20.9045 9) (layer "F.SilkS") (width 0.15) (tstamp fd438618-7d84-4d82-8af5-3fba37f148e0)) 29 | (pad "" np_thru_hole circle (at -0.00125 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp 08455e73-f292-4c25-adf1-05364ae49882)) 30 | (pad "" np_thru_hole circle (at 3.80875 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 1e2f0b65-7c69-40f3-a641-a107021bd4b5)) 31 | (pad "" np_thru_hole circle (at -2.54125 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 276f067d-1b29-47ca-98d9-333dea5cf526)) 32 | (pad "" np_thru_hole circle (at 11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp 2db63825-92e4-4105-b18b-47069d80476e)) 33 | (pad "" np_thru_hole circle (at -11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp 8375536f-0864-40d8-9dbf-1711e41ce4a0)) 34 | (pad "" np_thru_hole circle (at -11.938 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp 9a0b699d-2f6a-4ab5-9373-9af1ccef5135)) 35 | (pad "" np_thru_hole circle (at 11.938 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp 9d03b673-8b41-44c8-a22d-fad5ffe53f87)) 36 | (pad "1" smd rect (at 7.08375 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 4f325306-8791-40fc-a75b-9dd11258f3b9)) 37 | (pad "2" smd rect (at -5.84325 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 5b276a52-9bac-4ef7-99d6-b17ae283fd6e)) 38 | ) 39 | -------------------------------------------------------------------------------- /pcb/TKL Keyboard/Footprints/CherryMX_PlateMount_HotSwap_6.25u.kicad_mod: -------------------------------------------------------------------------------- 1 | (footprint "CherryMX_PlateMount_HotSwap_6.25u" (version 20211014) (generator pcbnew) 2 | (layer "F.Cu") 3 | (tedit 603AD4E7) 4 | (attr smd) 5 | (fp_text reference "K_SPACE" (at 0 -8.89) (layer "F.SilkS") hide 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | (tstamp 32aee798-8151-4898-a2c1-b8cd5c7dd4eb) 8 | ) 9 | (fp_text value "KEYSW" (at 0 8.89) (layer "F.SilkS") 10 | (effects (font (size 1 1) (thickness 0.15))) 11 | (tstamp 88a30666-60f7-4d18-b4c1-f66b38778a09) 12 | ) 13 | (fp_line (start -1.255 -5.69) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 216a45e0-672d-4877-9a74-3244ea85ff26)) 14 | (fp_line (start 4.97625 -9) (end 59.0075 -9) (layer "F.SilkS") (width 0.15) (tstamp 4bec1e57-e1f7-4fab-85b0-8c33088fd118)) 15 | (fp_line (start 1.245 -4.44) (end -1.255 -4.44) (layer "F.SilkS") (width 0.12) (tstamp 52bc8b4d-01b4-4397-97c2-40c59588e8c9)) 16 | (fp_line (start -6.99625 -6.995) (end 7.00375 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 5a4295e5-978f-4815-8cfb-01f581ea903e)) 17 | (fp_line (start -59.0075 -9) (end -4.97625 -9) (layer "F.SilkS") (width 0.15) (tstamp 66d9f093-3f3d-4e8b-af7a-67833da64193)) 18 | (fp_line (start 4.97625 9) (end 59.0075 9) (layer "F.SilkS") (width 0.15) (tstamp 74e119ad-12d3-4693-bc2b-8054c7855f3b)) 19 | (fp_line (start -59.0075 9) (end -4.97625 9) (layer "F.SilkS") (width 0.15) (tstamp 78e0e0fb-be33-4686-839b-5b55f103fc5a)) 20 | (fp_line (start 1.245 -5.69) (end -1.255 -5.69) (layer "F.SilkS") (width 0.12) (tstamp 796b4d39-23ad-4670-aa2c-d7d7be9515d8)) 21 | (fp_line (start -59.0075 -9) (end -59.0075 -4.5) (layer "F.SilkS") (width 0.15) (tstamp 852a15cb-c462-467a-a3e5-b452b4c8d8c0)) 22 | (fp_line (start 59.0075 4.5) (end 59.0075 9) (layer "F.SilkS") (width 0.15) (tstamp 8f815a88-832a-488d-956f-831d04ee93c9)) 23 | (fp_line (start -6.99625 7.005) (end -6.99625 -6.995) (layer "F.SilkS") (width 0.15) (tstamp 94377a70-2642-42ea-97f7-adf752c28686)) 24 | (fp_line (start -59.0075 4.5) (end -59.0075 9) (layer "F.SilkS") (width 0.15) (tstamp b3b8d234-7534-44c5-b7e6-0d4d0c44b6a4)) 25 | (fp_line (start 7.00375 7.005) (end -6.99625 7.005) (layer "F.SilkS") (width 0.15) (tstamp cbe21702-e796-485e-997e-90a1aa3cf803)) 26 | (fp_line (start 1.245 -4.44) (end 1.245 -5.69) (layer "F.SilkS") (width 0.12) (tstamp d76c959d-c0d9-444a-992b-866967fb2e70)) 27 | (fp_line (start 7.00375 -6.995) (end 7.00375 7.005) (layer "F.SilkS") (width 0.15) (tstamp eb01524f-c838-4b64-b5fb-5896d55bde2e)) 28 | (fp_line (start 59.0075 -4.5) (end 59.0075 -9) (layer "F.SilkS") (width 0.15) (tstamp fb632be1-2a94-4e9c-ab16-a66180faabcf)) 29 | (pad "" np_thru_hole circle (at 49.9999 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp 0eb4a2fd-dc91-4fbf-8059-e6addac88d62)) 30 | (pad "" np_thru_hole circle (at 3.81375 2.545 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 8698f6a2-e0ee-45c8-bfc1-57bc244c110f)) 31 | (pad "" np_thru_hole circle (at -2.53625 5.085 180) (size 3 3) (drill 3) (layers *.Cu *.Mask) (tstamp 9122b6a8-33a6-4534-8348-cb86319083b1)) 32 | (pad "" np_thru_hole circle (at -49.9999 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp 958640c0-40c8-40fc-a215-e1747b884720)) 33 | (pad "" np_thru_hole circle (at 49.9999 8.255) (size 3.9878 3.9878) (drill 3.9878) (layers *.Cu *.Mask) (tstamp 9b51a955-4ef6-4aec-a1b1-a1dd42e7f1ab)) 34 | (pad "" np_thru_hole circle (at 0.00375 0.005 180) (size 4 4) (drill 4) (layers *.Cu *.Mask) (tstamp b1271ca9-d64a-4ef6-9ef7-8019f791caee)) 35 | (pad "" np_thru_hole circle (at -49.9999 -6.985) (size 3.048 3.048) (drill 3.048) (layers *.Cu *.Mask) (tstamp cb4bb81e-d831-42b5-8826-17cc3e611f8d)) 36 | (pad "1" smd rect (at 7.08875 2.545 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp 786455fa-c1f4-4fc5-b628-f08fb0d542d1)) 37 | (pad "2" smd rect (at -5.83825 5.085 180) (size 2.55 2.5) (layers "B.Cu" "B.Paste" "B.Mask") (tstamp a0395c90-c62d-4c9f-baa0-c23b25bc1eed)) 38 | ) 39 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/KeyCodes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef uint8_t KeyCode; 6 | 7 | enum KeyType : uint8_t 8 | { 9 | KEY = 0, 10 | MEDIA = 1 11 | }; 12 | 13 | enum SDKKeyboardKeycode : uint8_t { 14 | KK_RESERVED = 0, 15 | KK_A = 4, 16 | KK_B = 5, 17 | KK_C = 6, 18 | KK_D = 7, 19 | KK_E = 8, 20 | KK_F = 9, 21 | KK_G = 10, 22 | KK_H = 11, 23 | KK_I = 12, 24 | KK_J = 13, 25 | KK_K = 14, 26 | KK_L = 15, 27 | KK_M = 16, 28 | KK_N = 17, 29 | KK_O = 18, 30 | KK_P = 19, 31 | KK_Q = 20, 32 | KK_R = 21, 33 | KK_S = 22, 34 | KK_T = 23, 35 | KK_U = 24, 36 | KK_V = 25, 37 | KK_W = 26, 38 | KK_X = 27, 39 | KK_Y = 28, 40 | KK_Z = 29, 41 | KK_1 = 30, 42 | KK_2 = 31, 43 | KK_3 = 32, 44 | KK_4 = 33, 45 | KK_5 = 34, 46 | KK_6 = 35, 47 | KK_7 = 36, 48 | KK_8 = 37, 49 | KK_9 = 38, 50 | KK_0 = 39, 51 | KK_ENTER = 40, 52 | KK_ESC = 41, 53 | KK_BACKSPACE = 42, 54 | KK_TAB = 43, 55 | KK_SPACE = 44, 56 | KK_MINUS = 45, 57 | KK_EQUAL = 46, 58 | KK_LEFT_BRACE = 47, 59 | KK_RIGHT_BRACE = 48, 60 | KK_BACKSLASH = 49, 61 | KK_NON_US_NUM = 50, 62 | KK_SEMICOLON = 51, 63 | KK_QUOTE = 52, 64 | KK_TILDE = 53, 65 | KK_COMMA = 54, 66 | KK_PERIOD = 55, 67 | KK_SLASH = 56, 68 | KK_CAPS_LOCK = 0x39, 69 | KK_F1 = 0x3A, 70 | KK_F2 = 0x3B, 71 | KK_F3 = 0x3C, 72 | KK_F4 = 0x3D, 73 | KK_F5 = 0x3E, 74 | KK_F6 = 0x3F, 75 | KK_F7 = 0x40, 76 | KK_F8 = 0x41, 77 | KK_F9 = 0x42, 78 | KK_F10 = 0x43, 79 | KK_F11 = 0x44, 80 | KK_F12 = 0x45, 81 | KK_PRINT = 0x46, 82 | KK_SCROLL_LOCK = 0x47, 83 | KK_PAUSE = 0x48, 84 | KK_INSERT = 0x49, 85 | KK_HOME = 0x4A, 86 | KK_PAGE_UP = 0x4B, 87 | KK_DELETE = 0x4C, 88 | KK_END = 0x4D, 89 | KK_PAGE_DOWN = 0x4E, 90 | KK_RIGHT = 0x4F, 91 | KK_LEFT = 0x50, 92 | KK_DOWN = 0x51, 93 | KK_UP = 0x52, 94 | KK_NUM_LOCK = 0x53, 95 | KK_PAD_DIVIDE = 0x54, 96 | KK_PAD_MULTIPLY = 0x55, 97 | KK_PAD_SUBTRACT = 0x56, 98 | KK_PAD_ADD = 0x57, 99 | KK_PAD_ENTER = 0x58, 100 | KK_PAD_1 = 0x59, 101 | KK_PAD_2 = 0x5A, 102 | KK_PAD_3 = 0x5B, 103 | KK_PAD_4 = 0x5C, 104 | KK_PAD_5 = 0x5D, 105 | KK_PAD_6 = 0x5E, 106 | KK_PAD_7 = 0x5F, 107 | KK_PAD_8 = 0x60, 108 | KK_PAD_9 = 0x61, 109 | KK_PAD_0 = 0x62, 110 | KK_PAD_DOT = 0x63, 111 | 112 | KK_LEFT_CTRL = 0xE0, 113 | KK_LEFT_SHIFT = 0xE1, 114 | KK_LEFT_ALT = 0xE2, 115 | KK_LEFT_GUI = 0xE3, 116 | KK_RIGHT_CTRL = 0xE4, 117 | KK_RIGHT_SHIFT = 0xE5, 118 | KK_RIGHT_ALT = 0xE6, 119 | KK_RIGHT_GUI = 0xE7, 120 | 121 | KK_MENU = 0x76, 122 | 123 | KK_NEXT = 0, 124 | KK_PREVIOUS = 0xB6, 125 | KK_PLAY_PAUSE = 0xCD, 126 | KK_VOLUME_MUTE = 0xE2, 127 | KK_VOLUME_UP = 0xE9, 128 | KK_VOLUME_DOWN = 0xEA 129 | }; 130 | -------------------------------------------------------------------------------- /firmware/VaKeyboard/lib/KeyboardSDK/src/HAL/Chips/Is31fl3743a.cpp: -------------------------------------------------------------------------------- 1 | #include "Is31fl3743a.h" 2 | #include 3 | 4 | Is31fl3743a::Is31fl3743a(uint8_t i2c_addr, TwoWire *wire, ILogger *logger, uint8_t columnMask, uint8_t rowCount, uint8_t columnCount, uint8_t maxCurrent) 5 | { 6 | this->i2c_addr = i2c_addr; 7 | this->wire = wire; 8 | this->rowCount = rowCount; 9 | this->columnCount = columnCount; 10 | this->logger = logger; 11 | this->columnMask = columnMask; 12 | 13 | this->i2c_dev = new Adafruit_I2CDevice(this->i2c_addr, this->wire); 14 | 15 | if (!this->i2c_dev->begin()) 16 | { 17 | this->logger->logError(F("Failed to initialise IS31FL3743A.")); 18 | return; 19 | } 20 | 21 | Adafruit_BusIO_Register CRWL(i2c_dev, 0xFE); 22 | Adafruit_BusIO_Register CR(i2c_dev, 0xFD); 23 | 24 | this->setGlobalIntensity(0xFF); 25 | 26 | CRWL.write(0xC5); // unlock CR 27 | CR.write(0x01); // lets write scaling 28 | for (int column = 0; column < columnCount; column++) 29 | { 30 | for (int row = 0; row < rowCount * 3; row++) 31 | { 32 | uint8_t index = row + (rowCount * 3 * column) + 1; //3 colors in LED 33 | Adafruit_BusIO_Register SL(i2c_dev, index); 34 | SL.write(0xFF); 35 | } 36 | } 37 | 38 | CRWL.write(0xC5); // unlock CR 39 | CR.write(0x02); 40 | Adafruit_BusIO_Register GCC(i2c_dev, 0x01); // global current 41 | GCC.write(maxCurrent); 42 | 43 | Adafruit_BusIO_Register CONF(i2c_dev, 0x00); 44 | CONF.write(this->columnMask); // normal mode + enabled columns 45 | 46 | Adafruit_BusIO_Register PDU(i2c_dev, 0x02); 47 | // PDU.write(0b00110011); 48 | 49 | Adafruit_BusIO_Register TS(i2c_dev, 0x24); 50 | // TS.write(0b00000110); // temperature control: > 120 C will decrease current to LEDs to 55%. 51 | 52 | Adafruit_BusIO_Register SS(i2c_dev, 0x25); 53 | // SS.write(0b00000011); // configure timing to 660 us 54 | 55 | this->i2c_dev->end(); 56 | 57 | delay(2); 58 | } 59 | 60 | uint8_t Is31fl3743a::getGlobalIntensity() 61 | { 62 | return this->currentGlobalIntensity; 63 | } 64 | 65 | void Is31fl3743a::setGlobalIntensity(uint8_t intensity) 66 | { 67 | 68 | if (!this->i2c_dev->begin()) 69 | { 70 | this->logger->logError(F("Failed to initialise IS31FL3743A.")); 71 | return; 72 | } 73 | 74 | Adafruit_BusIO_Register CRWL(this->i2c_dev, 0xFE); 75 | Adafruit_BusIO_Register CR(this->i2c_dev, 0xFD); 76 | 77 | CRWL.write(0xC5); // unlock CR 78 | CR.write(0x00); // lets write pwm 79 | 80 | 81 | for (int column = 0; column < columnCount; column++) 82 | { 83 | for (int row = 0; row < rowCount * 3; row++) 84 | { 85 | uint8_t r = intensity; 86 | uint8_t g = intensity; 87 | uint8_t b = intensity; 88 | 89 | uint8_t index = row + (rowCount * 3 * column) + 1; //3 colors in LED 90 | Adafruit_BusIO_Register PWM(i2c_dev, index); 91 | 92 | if ((index - 1) % 3 == 0) //red led 93 | { 94 | PWM.write(r / redFactor); 95 | } 96 | else if ((index - 2) % 3 == 0) //green led 97 | { 98 | PWM.write(g / greenFactor); 99 | } 100 | else //blue led 101 | { 102 | PWM.write(b / blueFactor); 103 | } 104 | } 105 | } 106 | 107 | this->currentGlobalIntensity = intensity; 108 | 109 | this->i2c_dev->end(); 110 | } 111 | 112 | void Is31fl3743a::setLedIntensities(uint8_t x, uint8_t y, uint8_t redIntensity, uint8_t greenIntensity, uint8_t blueIntensity) 113 | { 114 | if (!this->i2c_dev->begin()) 115 | { 116 | this->logger->logError(F("Failed to initialise IS31FL3743A.")); 117 | return; 118 | } 119 | 120 | Adafruit_BusIO_Register CRWL(this->i2c_dev, 0xFE); 121 | Adafruit_BusIO_Register CR(this->i2c_dev, 0xFD); 122 | 123 | CRWL.write(0xC5); // unlock CR 124 | CR.write(0x00); // lets write pwm 125 | 126 | // registers starts at address 0x1 127 | Adafruit_BusIO_Register rPWM(i2c_dev, y * this->rowCount * 3 + x * 3 + 1); 128 | Adafruit_BusIO_Register gPWM(i2c_dev, y * this->rowCount * 3 + x * 3 + 2); 129 | Adafruit_BusIO_Register bPWM(i2c_dev, y * this->rowCount * 3 + x * 3 + 3); 130 | rPWM.write(redIntensity / redFactor); 131 | gPWM.write(greenIntensity / greenFactor); 132 | bPWM.write(blueIntensity / blueFactor); 133 | 134 | this->i2c_dev->end(); 135 | } -------------------------------------------------------------------------------- /docs/revisions/rev1.md: -------------------------------------------------------------------------------- 1 | # Build Revision 1 2 | This repository contains all necessary artefact to build the keyboard. 3 | 4 | Meaning: 5 | - PCB 6 | - [List of components](#List-of-components) 7 | - [Firmware](#Firmware) 8 | - [Plate](#Plate) 9 | - Frame (not done yet) 10 | 11 | ## Dimensions 12 | - Plate: 343x119 mm 13 | - PCB: 349x128 mm 14 | 15 | ## List of components 16 | LCSC numbers are based on [JLCPCB](http://jlcpcb.com/) catalog. 17 | 18 | | Type | Name | LCSC | Package | Amount | Description | 19 | | ----------------- | ---------------------------------------------------------------------------------------------------------------------- | ------- | ------- | ------ | --------------------------------------------------------------------- | 20 | | Diods | [1N4148WT](https://datasheet.lcsc.com/szlcsc/1908191708_MDD-Microdiode-Electronics-1N4148WT_C414017.pdf) | C414017 | SOD-523 | 87 | Preventing key ghosting & masking effects. | 21 | | RGB LED | [19-237/R6GHBHC-A04/2T](https://datasheet.lcsc.com/szlcsc/2010222107_Everlight-Elec-19-237-R6GHBHC-A04-2T_C883183.pdf) | C883183 | 19-237 | 87 | Light under each switch. | 22 | | IO Expanders | [MCP23017-E/SO](https://datasheet.lcsc.com/szlcsc/Microchip-Tech-MCP23017-E-SO_C47023.pdf) | C47023 | SOIC-28 | 2 | Connecting rows & columns from switch matrix through I2C. | 23 | | LED Driver | [IS31FL3743A](https://cz.mouser.com/datasheet/2/198/IS31FL3743A_DS-1949512.pdf) | N/A | QFN-40 | 2 | Addressing LED and controlling RGB LED diods through I2C. | 24 | | Hotswap sockets | [Kailh sockets](https://www.kailhswitch.com/info/kailh-switch-pcb-hot-swapping-socket-33463528.html) | N/A | N/A | 87 | Connecting Cherry MX switches | 25 | | Stabilizers | [Cherry stabilizers](https://www.aliexpress.com/item/32951252318.html) | N/A | N/A | 5 | Stabilizing long keycaps. | 26 | | Capacitor 1uF | [CL05A105KA5NQNC](https://datasheet.lcsc.com/szlcsc/Samsung-Electro-Mechanics-CL05A105KA5NQNC_C52923.pdf) | C52923 | 0402 | 4 | Stabilizing power circuit for LED drivers. | 27 | | Resistor 10 KOhm | [0402WGF1002TCE](https://datasheet.lcsc.com/szlcsc/Uniroyal-Elec-0402WGF1002TCE_C25744.pdf) | C25744 | 0402 | 6 | Controlling brightness & pull ups for IO expanders. | 28 | | Resistor 4.7 KOhm | [0402WGF4701TCE](https://datasheet.lcsc.com/szlcsc/Uniroyal-Elec-0402WGF4701TCE_C25900.pdf) | C25900 | 0402 | 4 | Pull up resistor for LED drivers. | 29 | | Resistor 200 Ohm | [0402WGF2000TCE](https://datasheet.lcsc.com/szlcsc/Uniroyal-Elec-0402WGF2000TCE_C25087.pdf) | C25087 | 0402 | 12 | Green and blue LED channels to limit current and prevent overheating. | 30 | | Resistor 150 Ohm | [0402WGF1500TCE](https://datasheet.lcsc.com/szlcsc/Uniroyal-Elec-0402WGF1500TCE_C25082.pdf) | C25082 | 0402 | 6 | Red LED channel to limit current and prevent overheating. | 31 | 32 | ## Firmware 33 | Currently there are 2 firmwares. 34 | - Original built on top of [QMK](https://qmk.fm/). This firmware currently do not support RGB LEDs, thou it shouldn't be hard to add support. 35 | - Custom made firmware (source code in repo). This has full feature set, keyboard functionality and RGB LEDs are working here. 36 | 37 | ## Plate 38 | Built with the help of [Keyboard Layout Editor](http://www.keyboard-layout-editor.com/#/) & Keeb's Plate tool (https://plate.keeb.io/). 39 | 40 | ## Case 41 | Built in OnShape CAD software, [check out](https://cad.onshape.com/documents/c60788452082993ff7acdd11/w/b14733d6a8d57351c8582e21/e/f5989423f9dc86a71831a4e9) the models! -------------------------------------------------------------------------------- /firmware/VaKeyboard/src/Drivers/TKL/KeyboardDescriptor.cpp: -------------------------------------------------------------------------------- 1 | #if defined(TKL) 2 | 3 | #include "KeyboardDescriptor.h" 4 | #include "Features/BluetoothFeature.h" 5 | #include "Features/RGBLedFeature.h" 6 | 7 | KeyboardDescriptor::KeyboardDescriptor(uint8_t numberOfRows, uint8_t numberOfColumns) : BaseKeyboardDescriptor(numberOfRows, numberOfColumns) 8 | { 9 | this->keymaps = this->createKeyMap(); 10 | this->coordMap = this->createCoordinatesMap(this->keymaps); 11 | this->featureMacros = this->createFeatureMacros(); 12 | 13 | } 14 | 15 | FeatureMacro** KeyboardDescriptor::createFeatureMacros() 16 | { 17 | this->featureMacroCount = 6; 18 | 19 | return new FeatureMacro*[this->featureMacroCount] { 20 | new FeatureMacro(RGBLedFeatures::RGBLedToggle, 3, new KeyCode[3] { KK_LEFT_CTRL, KK_LEFT_GUI, KK_F1}), 21 | new FeatureMacro(RGBLedFeatures::RGBLedRandomColors, 3, new KeyCode[3] { KK_LEFT_CTRL, KK_LEFT_GUI, KK_F3}), 22 | new FeatureMacro(RGBLedFeatures::RGBLedBatteryLevel, 3, new KeyCode[3] { KK_LEFT_CTRL, KK_LEFT_GUI, KK_F4}), 23 | new FeatureMacro(RGBLedFeatures::RGBLedSuspend, RGBLedFeatures::RGBLedWake, 90000), 24 | new FeatureMacro(BluetoothFeatures::BluetoothReset, 3, new KeyCode[3] { KK_LEFT_CTRL, KK_LEFT_GUI, KK_ESC}), 25 | new FeatureMacro(BluetoothFeatures::BluetoothToggle, 3, new KeyCode[3] { KK_LEFT_CTRL, KK_LEFT_GUI, KK_F2}), 26 | }; 27 | } 28 | 29 | KeyCode *** KeyboardDescriptor::createKeyMap() 30 | { 31 | KeyCode ***keymap = new KeyCode **[this->getLayersCount()]; 32 | 33 | keymap[0] = new KeyCode*[this->numberOfRows]; 34 | 35 | keymap[0][0] = new KeyCode[this->numberOfColumns]{KK_ESC, KK_RESERVED, KK_F1, KK_F2, KK_F3, KK_F4, KK_F5, KK_F6, KK_F7, KK_F8, KK_F9, KK_F10, KK_F11, KK_F12, KK_PRINT, KK_SCROLL_LOCK, KK_PAUSE}; 36 | keymap[0][1] = new KeyCode[this->numberOfColumns]{KK_TILDE, KK_1, KK_2, KK_3, KK_4, KK_5, KK_6, KK_7, KK_8, KK_9, KK_0, KK_MINUS, KK_EQUAL, KK_BACKSPACE, KK_INSERT, KK_HOME, KK_PAGE_UP}; 37 | keymap[0][2] = new KeyCode[this->numberOfColumns]{KK_TAB, KK_Q, KK_W, KK_E, KK_R, KK_T, KK_Y, KK_U, KK_I, KK_O, KK_P, KK_LEFT_BRACE, KK_RIGHT_BRACE, KK_BACKSLASH, KK_DELETE, KK_END, KK_PAGE_DOWN}; 38 | keymap[0][3] = new KeyCode[this->numberOfColumns]{KK_CAPS_LOCK, KK_A, KK_S, KK_D, KK_F, KK_G, KK_H, KK_J, KK_K, KK_L, KK_SEMICOLON, KK_QUOTE, KK_RESERVED, KK_ENTER, KK_RESERVED, KK_RESERVED, KK_RESERVED}; 39 | keymap[0][4] = new KeyCode[this->numberOfColumns]{KK_LEFT_SHIFT, KK_Z, KK_X, KK_C, KK_V, KK_B, KK_N, KK_M, KK_COMMA, KK_PERIOD, KK_SLASH, KK_RESERVED, KK_RESERVED, KK_RIGHT_SHIFT, KK_RESERVED, KK_UP, KK_RESERVED}; 40 | keymap[0][5] = new KeyCode[this->numberOfColumns]{KK_LEFT_CTRL, KK_LEFT_GUI, KK_LEFT_ALT, KK_RESERVED, KK_RESERVED, KK_RESERVED, KK_SPACE, KK_RESERVED, KK_RESERVED, KK_RESERVED, KK_RIGHT_ALT, KK_RIGHT_GUI, KK_MENU, KK_RIGHT_CTRL, KK_LEFT, KK_DOWN, KK_RIGHT}; 41 | 42 | keymap[1] = new KeyCode*[this->numberOfRows]; 43 | keymap[1][0] = new KeyCode[this->numberOfColumns]{KK_ESC, KK_RESERVED, KK_F1, KK_F2, KK_F3, KK_F4, KK_F5, KK_F6, KK_PREVIOUS, KK_PLAY_PAUSE, KK_NEXT, KK_VOLUME_MUTE, KK_VOLUME_DOWN, KK_VOLUME_UP, KK_PRINT, KK_SCROLL_LOCK, KK_PAUSE}; 44 | keymap[1][1] = new KeyCode[this->numberOfColumns]{KK_TILDE, KK_1, KK_2, KK_3, KK_4, KK_5, KK_6, KK_7, KK_8, KK_9, KK_0, KK_MINUS, KK_EQUAL, KK_BACKSPACE, KK_INSERT, KK_HOME, KK_PAGE_UP}; 45 | keymap[1][2] = new KeyCode[this->numberOfColumns]{KK_TAB, KK_Q, KK_W, KK_E, KK_R, KK_T, KK_Y, KK_U, KK_I, KK_O, KK_P, KK_LEFT_BRACE, KK_RIGHT_BRACE, KK_BACKSLASH, KK_DELETE, KK_END, KK_PAGE_DOWN}; 46 | keymap[1][3] = new KeyCode[this->numberOfColumns]{KK_CAPS_LOCK, KK_A, KK_S, KK_D, KK_F, KK_G, KK_H, KK_J, KK_K, KK_L, KK_SEMICOLON, KK_QUOTE, KK_RESERVED, KK_ENTER, KK_RESERVED, KK_RESERVED, KK_RESERVED}; 47 | keymap[1][4] = new KeyCode[this->numberOfColumns]{KK_LEFT_SHIFT, KK_Z, KK_X, KK_C, KK_V, KK_B, KK_N, KK_M, KK_COMMA, KK_PERIOD, KK_SLASH, KK_RESERVED, KK_RESERVED, KK_RIGHT_SHIFT, KK_RESERVED, KK_UP, KK_RESERVED}; 48 | keymap[1][5] = new KeyCode[this->numberOfColumns]{KK_LEFT_CTRL, KK_LEFT_GUI, KK_LEFT_ALT, KK_RESERVED, KK_RESERVED, KK_RESERVED, KK_SPACE, KK_RESERVED, KK_RESERVED, KK_RESERVED, KK_RIGHT_ALT, KK_RIGHT_GUI, KK_MENU, KK_RIGHT_CTRL, KK_LEFT, KK_DOWN, KK_RIGHT}; 49 | 50 | return keymap; 51 | } 52 | 53 | uint8_t KeyboardDescriptor::getSelectedLayer(Matrix *pressedKeysMatrix) 54 | { 55 | return pressedKeysMatrix->getBit(coordMap[KK_MENU]->getRow(), coordMap[KK_MENU]->getColumn()); 56 | } 57 | 58 | uint8_t KeyboardDescriptor::getLayersCount() 59 | { 60 | return 2; 61 | } 62 | 63 | #endif 64 | --------------------------------------------------------------------------------