diff --git a/doc/keybrd_library_developer_guide.md b/doc/keybrd_library_developer_guide.md index 1f67fff..40b5624 100644 --- a/doc/keybrd_library_developer_guide.md +++ b/doc/keybrd_library_developer_guide.md @@ -106,6 +106,27 @@ Most derived-class names start with the base class name followed by "_" and a na 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. +## 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 Following the style guide makes it easier for the next programmer to understand your code. * For class names, see above section "Class naming conventions" diff --git a/doc/keybrd_library_user_guide.md b/doc/keybrd_library_user_guide.md index 30c66b9..8df2b00 100644 --- a/doc/keybrd_library_user_guide.md +++ b/doc/keybrd_library_user_guide.md @@ -205,7 +205,7 @@ The standard [IBM PC keyboard](http://en.wikipedia.org/wiki/IBM_PC_keyboard) has 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. -**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. A single-layer scheme does not change layers. diff --git a/tutorials/breadboard_keyboard_supplies.ods b/tutorials/breadboard_keyboard_supplies.ods index 292159b..1e5f209 100644 Binary files a/tutorials/breadboard_keyboard_supplies.ods and b/tutorials/breadboard_keyboard_supplies.ods differ diff --git a/tutorials/tutorial_3a_multi-layer_keyboard.md b/tutorials/tutorial_3a_multi-layer_keyboard.md index a1d397b..f4b98dd 100644 --- a/tutorials/tutorial_3a_multi-layer_keyboard.md +++ b/tutorials/tutorial_3a_multi-layer_keyboard.md @@ -4,11 +4,11 @@ When you finish this tutorial you will be able to be able to modify a multi-laye ## Multi-layer nomenclature **[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). * 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. @@ -17,19 +17,20 @@ When you finish this tutorial you will be able to be able to modify a multi-laye ## Pseudo code for simple layer scheme 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 { int layer 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 { @@ -39,9 +40,9 @@ 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 { @@ -58,7 +59,7 @@ Dependency diagram | Key_Layer | +-----------+ | - |setLayer() + |setActiveLayer() | v +------------+ @@ -66,7 +67,7 @@ Dependency diagram +------------+ ^ | - |getLayer() + |getActiveLayer() | +-------------+ | Key_Layered | @@ -76,14 +77,14 @@ Dependency diagram There are several layer scheme-classes to choose from. You can view all the class definitions in the [keybrd library](../src/). -Layer classes include: +Key_Layer classes include: * Code_LayerHold * Code_LayerLock -There is only one StateLayer class: +A basic StateLayer class is: * StateLayer -Layered classes include: +Key_Layered classes include: * Code_LayeredScSc * Code_LayeredCodeSc * Code_LayeredCodeCode