]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - Keymap.md
Created Unit testing (markdown)
[qmk_firmware.git] / Keymap.md
index a3f40d392e8431b402a81c9e2980f8073e604e6e..9f519d5e6aecbbcf953728068b9f4f12dd20a4fb 100644 (file)
--- a/Keymap.md
+++ b/Keymap.md
@@ -1,14 +1,16 @@
 # Keymap Overview
 
-QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a KEYMAP() macro to help you create this array of arrays.
+QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a `KEYMAP()` macro to help you create this array of arrays.
 
 ## Anatomy Of A `keymap.c`
 
-For this example we will walk through the [default Clueboard keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/default/keymap.c). There are 3 main sections of a `keymap.c` file you'll want to concern yourself with:
+For this example we will walk through the [default Clueboard keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/default/keymap.c). You'll find it helpful to open that file in another browser window so you can look at everything in context.
 
-* The Definitions
-* The Layer/Keymap Datastructure
-* Custom Functions, if any
+There are 3 main sections of a `keymap.c` file you'll want to concern yourself with:
+
+* [The Definitions](#definitions)
+* [The Layer/Keymap Datastructure](#layers-and-keymaps)
+* [Custom Functions](#custom-functions), if any
 
 ### Definitions
 
@@ -20,10 +22,12 @@ At the top of the file you'll find this:
     #define GRAVE_MODS  (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
     #define _______ KC_TRNS
 
-    // Each layer gets a name for readability, which is then used in the keymap matrix below.
-    // The underscores don't mean anything - you can have a layer called STUFF or any other name.
-    // Layer names don't all need to be of the same length, obviously, and you can also skip them
-    // entirely and just use numbers.
+    // Each layer gets a name for readability.
+    // The underscores don't mean anything - you can
+    // have a layer called STUFF or any other name.
+    // Layer names don't all need to be of the same 
+    // length, and you can also skip them entirely
+    // and just use numbers.
     #define _BL 0
     #define _FL 1
     #define _CL 2
@@ -80,7 +84,7 @@ At the bottom of the file we've defined a single custom function. This function
 
 #### `fn_actions[]`
 
-We define the `fn_actions[]` array to point to custom functions. `F(N)` in a keymap will call element N of that array. In the Clueboard's case that definition looks like this:
+We define the `fn_actions[]` array to point to custom functions. `F(N)` in a keymap will call element N of that array. For the Clueboard's that looks like this:
 
     const uint16_t PROGMEM fn_actions[] = {
       [0] = ACTION_FUNCTION(0),  // Calls action_function()