Browse Source

document

tags/v0.5.0
wolfv6 8 years ago
parent
commit
f97ae6d23d

+ 21
- 0
doc/keybrd_library_developer_guide.md View File

This convention leads to class names that convey information about the classes inheritance. This convention leads to class names that convey information about the classes inheritance.
Underscore delineates base class name and sub-class name. Capital letters delineate words. Underscore delineates base class name and sub-class name. Capital letters delineate words.
## Layer-class naming conventions
*Code_Layer* class names are concatenations of "Code_", "Layer" or layer name, and persistence.
Example persistences are:
* "Lock" - layer remains active after the layer key is released
* "Hold" - layer is active for as long as layer key is held down
Example Code_Layer class names:
* Code_LayerHold
* Code_LayerLock
*StateLayer* class names start with "StateLayer" and end with a descriptive name.
Example StateLayer class names:
* StateLayer - basic StateLayer class in keybrd library
* StateLayer_DH - main StateLayer for the keybrd_DH library
* StateLayer_MF - StateLayer for Mouse Function sub-layers in the keybrd_DH library
*Code_Layered* class names start with "Code_Layered" and end with a descriptive name.
Example Code_Layered class names:
* Code_LayeredScSc
* Key_LayeredKeysArray
## Style guide ## Style guide
Following the style guide makes it easier for the next programmer to understand your code. Following the style guide makes it easier for the next programmer to understand your code.
* For class names, see above section "Class naming conventions" * For class names, see above section "Class naming conventions"

+ 1
- 1
doc/keybrd_library_user_guide.md View File

Many compact keyboards have an additional [Fn layer](http://en.wikipedia.org/wiki/Fn_key). Many compact keyboards have an additional [Fn layer](http://en.wikipedia.org/wiki/Fn_key).
The [Neo layout](http://neo-layout.org/index_en.html) has 6 layers. The [Neo layout](http://neo-layout.org/index_en.html) has 6 layers.
**Layer code** - is an integer assigned to a layer.
**Layer id** - is an integer assigned to a layer.
**Layer scheme** - is a system for changing layers while typing. **Layer scheme** - is a system for changing layers while typing.
A single-layer scheme does not change layers. A single-layer scheme does not change layers.

BIN
tutorials/breadboard_keyboard_supplies.ods View File


+ 16
- 15
tutorials/tutorial_3a_multi-layer_keyboard.md View File

## Multi-layer nomenclature ## Multi-layer nomenclature
**[layers](http://deskthority.net/wiki/Layer)** are key bindings provided by the keyboard firmware. For example, **[layers](http://deskthority.net/wiki/Layer)** are key bindings provided by the keyboard firmware. For example,
* The full-size [IBM PC keyboard](http://en.wikipedia.org/wiki/IBM_PC_keyboard) has one layer.
* The classic [IBM PC keyboard](http://en.wikipedia.org/wiki/IBM_PC_keyboard) has one layer.
* Many compact keyboards have an additional [Fn layer](http://en.wikipedia.org/wiki/Fn_key). * Many compact keyboards have an additional [Fn layer](http://en.wikipedia.org/wiki/Fn_key).
* The [Neo layout](http://neo-layout.org/index_en.html) has 6 layers. * The [Neo layout](http://neo-layout.org/index_en.html) has 6 layers.
**layer code** - is an integer used to identify a layer.
**layer id** - is an integer used to identify a layer.
**active layer** - is the layer currently used by the keyboard. **active layer** - is the layer currently used by the keyboard.
## Pseudo code for simple layer scheme ## Pseudo code for simple layer scheme
The following pseudo code has just enough detail to show how layer schemes work. The following pseudo code has just enough detail to show how layer schemes work.
**Layer** objects select the active layer.
When a Layer object is pressed, it tells StateLayer to update the active layer.
There is one Key_Layer object for each layer. Each Key_Layer object has a unique layer Id number.
**Key_Layer** objects select the active layer.
The "layer" variable is a layer id number.
When a Key_Layer object is pressed, it tells StateLayer to update the active layer.
``` ```
class Key_Layer class Key_Layer
{ {
int layer int layer
StateLayer& refStateLayer StateLayer& refStateLayer
press() { refStateLayer.setLayer(layer) }
press() { refStateLayer.setActiveLayer(layer) }
} }
``` ```
A **StateLayer**'s activeLayer is always up to date.
**StateLayer** objects keep track of the active layer.
A StateLayer's activeLayer is always up to date.
``` ```
class StateLayer class StateLayer
{ {
} }
``` ```
**Layered** objects contain an array of Key pointers, one Key pointer for each layer.
Layer Id numbers are used as array indexes in the Key_Layered ptrsKeys array.
When a Layered object is pressed, it gets the active layer from StateLayer, and then presses the key of the active layer.
**Key_Layered** objects contain multiple Key pointers, one Key pointer for each layer.
Layer ids are used like indexes to select the appropriate key.
When a Key_Layered object is pressed, it gets the active layer from StateLayer, and then sends the key of the active layer.
``` ```
class Key_Layered class Key_Layered
{ {
| Key_Layer | | Key_Layer |
+-----------+ +-----------+
| |
|setLayer()
|setActiveLayer()
| |
v v
+------------+ +------------+
+------------+ +------------+
^ ^
| |
|getLayer()
|getActiveLayer()
| |
+-------------+ +-------------+
| Key_Layered | | Key_Layered |
There are several layer scheme-classes to choose from. There are several layer scheme-classes to choose from.
You can view all the class definitions in the [keybrd library](../src/). You can view all the class definitions in the [keybrd library](../src/).
Layer classes include:
Key_Layer classes include:
* Code_LayerHold * Code_LayerHold
* Code_LayerLock * Code_LayerLock
There is only one StateLayer class:
A basic StateLayer class is:
* StateLayer * StateLayer
Layered classes include:
Key_Layered classes include:
* Code_LayeredScSc * Code_LayeredScSc
* Code_LayeredCodeSc * Code_LayeredCodeSc
* Code_LayeredCodeCode * Code_LayeredCodeCode