keybrd library for creating custom-keyboard firmware | |||||
keybrd library for creating keyboard firmware | |||||
==================================================== | ==================================================== | ||||
keybrd library is an open source library for creating custom-keyboard firmware. | keybrd library is an open source library for creating custom-keyboard firmware. | ||||
The resulting keyboard firmware is compatible with standard USB keyboard drivers. | The resulting keyboard firmware is compatible with standard USB keyboard drivers. | ||||
Example minimal keybrd sketch | Example minimal keybrd sketch | ||||
----------------------------- | ----------------------------- | ||||
<!-- todo after teensy LC bb, copy and remove annotations from keybrd_single-layer_2_annotated.ino --> | <!-- todo after teensy LC bb, copy and remove annotations from keybrd_single-layer_2_annotated.ino --> | ||||
Here is a [minimal keybrd sketch](blob/master/tutorials/keybrd_2_single-layer_annotated/keybrd_2_single-layer_annotated.ino). | |||||
Here is a [minimal keybrd sketch](tutorials/keybrd_2_single-layer_annotated/keybrd_2_single-layer_annotated.ino). | |||||
The sketch has about 50 lines of code and runs on a 4-key keyboard. | The sketch has about 50 lines of code and runs on a 4-key keyboard. | ||||
It runs on a breadboard with rows, columns, and diodes just like the big keyboards. | It runs on a breadboard with rows, columns, and diodes just like the big keyboards. | ||||
The sketch is small because the keybrd library takes care of the low-level details. | The sketch is small because the keybrd library takes care of the low-level details. | ||||
Example complex keybrd sketch | Example complex keybrd sketch | ||||
----------------------------- | ----------------------------- | ||||
The keybrd_DH emulates the DataHand keyboard. | The keybrd_DH emulates the DataHand keyboard. | ||||
It has 72 keys, 4 layers, a sub-layers, 2 matrices, and is loaded with features. | |||||
The keybrd_DH and its instantiation files, contain about 800 lines of code. | |||||
It has 72 keys, 4 layers, a sub-layer, 2 matrices, and many features. | |||||
The keybrd_DH and its instantiation files contain about 800 lines of code. | |||||
[mainSketch.ino](../keybrd_DH/blob/master/examples/keybrd_DH/mainSketch.cpp) | |||||
[instantiations_ports.h](../keybrd_DH/tree/master/src/instantiations_ports.h) | |||||
[instantiations_LEDs.h](../keybrd_DH/tree/master/src/instantiations_LEDs.h) | |||||
[instantiations_codes.h](../keybrd_DH/tree/master/src/instantiations_codes.h) | |||||
[instantiations_matrix.h](../keybrd_DH/tree/master/src/instantiations_matrix.h) | |||||
[mainSketch.ino](../keybrd_DH/blob/master/examples/keybrd_DH/mainSketch.cpp)<br> | |||||
[instantiations_ports.h](../keybrd_DH/tree/master/src/instantiations_ports.h)<br> | |||||
[instantiations_LEDs.h](../keybrd_DH/tree/master/src/instantiations_LEDs.h)<br> | |||||
[instantiations_codes.h](../keybrd_DH/tree/master/src/instantiations_codes.h)<br> | |||||
[instantiations_matrix.h](../keybrd_DH/tree/master/src/instantiations_matrix.h) | |||||
Support | Support | ||||
------- | ------- | ||||
[Guides](tree/master/doc) and [tutorials](/tree/master/tutorials) are provided. | |||||
[Guides](doc) and [tutorials](tutorials) are provided. | |||||
Please ask a questions in [issues](https://github.com/wolfv6/Keybrd/issues) if something is not clear. | Please ask a questions in [issues](https://github.com/wolfv6/Keybrd/issues) if something is not clear. |
* Code should be self-documenting. | * Code should be self-documenting. | ||||
The only comments should be things that may need clarification. | The only comments should be things that may need clarification. | ||||
A simple function with a good name needs no comment. | A simple function with a good name needs no comment. | ||||
<-- http://stackoverflow.com/questions/2198241/best-practice-for-c-function-commenting !--> | |||||
<--! http://stackoverflow.com/questions/2198241/best-practice-for-c-function-commenting --> | |||||
* Code is automatically formated before being pushed to the keybrd repository | * Code is automatically formated before being pushed to the keybrd repository | ||||
The options file doc/astyle_cpp specifies the format: | The options file doc/astyle_cpp specifies the format: | ||||
* Allman style indentation | * Allman style indentation |
4. Launch Arduino IDE from /opt/arduino-1.x.x/arduino | 4. Launch Arduino IDE from /opt/arduino-1.x.x/arduino | ||||
### Download and unpack keybrd-master.zip into your Arduino directory | ### Download and unpack keybrd-master.zip into your Arduino directory | ||||
<-- todo update after testing Arduino library manager | |||||
<--! todo update after testing Arduino library manager | |||||
link from tutorial 7 ## Publishing | link from tutorial 7 ## Publishing | ||||
https://www.arduino.cc/en/Guide/Libraries | https://www.arduino.cc/en/Guide/Libraries | ||||
> Installing Additional Arduino Libraries | > Installing Additional Arduino Libraries | ||||
> Using the Library Manager | > Using the Library Manager | ||||
!--> | |||||
--> | |||||
Down load keybrd-master.zip from the [Download ZIP](https://github.com/wolfv6/keybrd) button. | Down load keybrd-master.zip from the [Download ZIP](https://github.com/wolfv6/keybrd) button. | ||||
Unpack keybrd-master.zip into your Arduino directory on your system (default location is ~/Documents/Arduino/). | Unpack keybrd-master.zip into your Arduino directory on your system (default location is ~/Documents/Arduino/). | ||||
### keybrd library and keybrd extension libraries | ### keybrd library and keybrd extension libraries | ||||
<-- todo update after testing Arduino library manager !--> | |||||
<--! todo update after testing Arduino library manager --> | |||||
The keybrd library contains the foundation classes for creating a keyboard firmware. | The keybrd library contains the foundation classes for creating a keyboard firmware. | ||||
For emphasis, it is referred to as the "core keybrd library". | For emphasis, it is referred to as the "core keybrd library". | ||||
## Diode orientation | ## Diode orientation | ||||
The physical martix rows and columns on a keyboard can be in any direction or shape. | The physical martix rows and columns on a keyboard can be in any direction or shape. | ||||
[diode](https://en.wikipedia.org/wiki/Diode) orientation is specified in [Matrix.h](todo) | |||||
[diode](https://en.wikipedia.org/wiki/Diode) orientation is specified in [Matrix.h](https://github.com/wolfv6/keybrd/blob/master/src/Matrix.h) | |||||
![Diode](../tutorials/images/120px-Diode_pinout_en_fr.svg.png) | |||||
[Diode](../tutorials/images/120px-Diode_pinout_en_fr.svg.png) | |||||
Diagram is of typical through-the-hole diode in same alignment as diode symbol. | Diagram is of typical through-the-hole diode in same alignment as diode symbol. | ||||
Cross bar and band depict the cathode. | Cross bar and band depict the cathode. |