Archived
1
0
This commit is contained in:
wolfv6 2016-05-28 12:37:40 -06:00
parent 004806554b
commit f97ae6d23d
4 changed files with 38 additions and 16 deletions

View File

@ -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. 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"

View File

@ -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). 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.

View File

@ -4,11 +4,11 @@ When you finish this tutorial you will be able to be able to modify a multi-laye
## 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.
@ -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 ## 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. **Key_Layer** objects select the active layer.
When a Layer object is pressed, it tells StateLayer to update the active layer. The "layer" variable is a layer id number.
There is one Key_Layer object for each layer. Each Key_Layer object has a unique 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
{ {
@ -39,9 +40,9 @@ class StateLayer
} }
``` ```
**Layered** objects contain an array of Key pointers, one Key pointer for each layer. **Key_Layered** objects contain multiple Key pointers, one Key pointer for each layer.
Layer Id numbers are used as array indexes in the Key_Layered ptrsKeys array. Layer ids are used like indexes to select the appropriate key.
When a Layered object is pressed, it gets the active layer from StateLayer, and then presses the key of the active layer. 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
{ {
@ -58,7 +59,7 @@ Dependency diagram
| Key_Layer | | Key_Layer |
+-----------+ +-----------+
| |
|setLayer() |setActiveLayer()
| |
v v
+------------+ +------------+
@ -66,7 +67,7 @@ Dependency diagram
+------------+ +------------+
^ ^
| |
|getLayer() |getActiveLayer()
| |
+-------------+ +-------------+
| Key_Layered | | Key_Layered |
@ -76,14 +77,14 @@ Dependency diagram
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