aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/_summary.md1
-rw-r--r--docs/hardware_keyboard_guidelines.md97
-rw-r--r--docs/reference_info_json.md70
3 files changed, 87 insertions, 81 deletions
diff --git a/docs/_summary.md b/docs/_summary.md
index c467a7231..6bc747189 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -40,6 +40,7 @@
40 * [Unit Testing](unit_testing.md) 40 * [Unit Testing](unit_testing.md)
41 * [Useful Functions](ref_functions.md) 41 * [Useful Functions](ref_functions.md)
42 * [Configurator Support](reference_configurator_support.md) 42 * [Configurator Support](reference_configurator_support.md)
43 * [info.json Format](reference_info_json.md)
43 44
44* [Features](features.md) 45* [Features](features.md)
45 * [Basic Keycodes](keycodes_basic.md) 46 * [Basic Keycodes](keycodes_basic.md)
diff --git a/docs/hardware_keyboard_guidelines.md b/docs/hardware_keyboard_guidelines.md
index e6be7aece..3a74e5f5c 100644
--- a/docs/hardware_keyboard_guidelines.md
+++ b/docs/hardware_keyboard_guidelines.md
@@ -1,6 +1,7 @@
1# QMK Keyboard Guidelines 1# QMK Keyboard Guidelines
2 2
3Since starting, QMK has grown by leaps and bounds thanks to people like you who contribute to creating and maintaining our community keyboards. As we have grown we have discovered some patterns that work well, and ask that you conform to them to make it easier for other people to make use of your hard work. 3Since starting, QMK has grown by leaps and bounds thanks to people like you who contribute to creating and maintaining our community keyboards. As we've grown we've discovered some patterns that work well, and ask that you conform to them to make it easier for other people to benefit from your hard work.
4
4 5
5## Naming Your Keyboard/Project 6## Naming Your Keyboard/Project
6 7
@@ -30,18 +31,19 @@ Clueboard uses sub-folders for both purposes, organization and keyboard revision
30 31
31* [`qmk_firmware`](https://github.com/qmk/qmk_firmware/tree/master) 32* [`qmk_firmware`](https://github.com/qmk/qmk_firmware/tree/master)
32 * [`keyboards`](https://github.com/qmk/qmk_firmware/tree/master/keyboards) 33 * [`keyboards`](https://github.com/qmk/qmk_firmware/tree/master/keyboards)
33 * [`clueboard`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard) ← This is the organization directory, there's no `rules.mk` file. 34 * [`clueboard`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard) ← This is the organization folder, there's no `rules.mk` file
34 * [`60`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/60) ← This is a compilable keyboard, it has a `rules.mk` file. 35 * [`60`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/60) ← This is a compilable keyboard, it has a `rules.mk` file
35 * [`66`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66) ← This is also compilable- it uses `DEFAULT_FOLDER` to specify `rev3` as the default revision. 36 * [`66`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66) ← This is also compilable- it uses `DEFAULT_FOLDER` to specify `rev3` as the default revision
36 * [`rev1`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev1) ← compilable: `make clueboard/66/rev1` 37 * [`rev1`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev1) ← compilable: `make clueboard/66/rev1`
37 * [`rev2`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev2) ← compilable: `make clueboard/66/rev2` 38 * [`rev2`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev2) ← compilable: `make clueboard/66/rev2`
38 * [`rev3`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev3) ← compilable: `make clueboard/66/rev3` or `make clueboard/66` 39 * [`rev3`](https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev3) ← compilable: `make clueboard/66/rev3` or `make clueboard/66`
39 40
40## Keyboard Folder Structure 41## Keyboard Folder Structure
41 42
42Your keyboard should be located in `qmk_firmware/keyboards/` and the directory name should be your keyboard's name as described in the previous section. Inside this directory should be several files: 43Your keyboard should be located in `qmk_firmware/keyboards/` and the folder name should be your keyboard's name as described in the previous section. Inside this folder should be several files:
43 44
44* `readme.md` 45* `readme.md`
46* `info.json`
45* `config.h` 47* `config.h`
46* `rules.mk` 48* `rules.mk`
47* `<keyboard_name>.c` 49* `<keyboard_name>.c`
@@ -51,6 +53,10 @@ Your keyboard should be located in `qmk_firmware/keyboards/` and the directory n
51 53
52All projects need to have a `readme.md` file that explains what the keyboard is, who made it and where it's available. If applicable, it should also contain links to more information, such as the maker's website. Please follow the [published template](documentation_templates.md#keyboard-readmemd-template). 54All projects need to have a `readme.md` file that explains what the keyboard is, who made it and where it's available. If applicable, it should also contain links to more information, such as the maker's website. Please follow the [published template](documentation_templates.md#keyboard-readmemd-template).
53 55
56### `info.json`
57
58This file is used by the [QMK API](https://github.com/qmk/qmk_api). It contains the information [QMK Configurator](https://config.qmk.fm/) needs to display a representation of your keyboard. You can also set metadata here. For more information see the [reference page](reference_info_json.md).
59
54### `config.h` 60### `config.h`
55 61
56All projects need to have a `config.h` file that sets things like the matrix size, product name, USB VID/PID, description and other settings. In general, use this file to set essential information and defaults for your keyboard that will always work. 62All projects need to have a `config.h` file that sets things like the matrix size, product name, USB VID/PID, description and other settings. In general, use this file to set essential information and defaults for your keyboard that will always work.
@@ -74,7 +80,7 @@ The following functions are typically defined in this file:
74 80
75This file is used to define the matrix for your keyboard. You should define at least one C macro named `LAYOUT` which translates an array into a matrix representing the physical switch matrix for your keyboard. If it's possible to build your keyboard with multiple layouts you may define additional macros. 81This file is used to define the matrix for your keyboard. You should define at least one C macro named `LAYOUT` which translates an array into a matrix representing the physical switch matrix for your keyboard. If it's possible to build your keyboard with multiple layouts you may define additional macros.
76 82
77When defining multiple layouts you should have a base layout, named `LAYOUT`, that supports all possible switch positions on your matrix, even if that layout is impossible to build physically. This is the macro you should use in your `default` keymap. You should then have additional keymaps named `default-<layout>` that use your other layout macros. This will make it easier for people to use the layouts you define. 83When defining multiple layouts you should have a base layout, named `LAYOUT`, that supports all possible switch positions on your matrix, even if that layout is impossible to build physically. This is the macro you should use in your `default` keymap. You should then have additional keymaps named `default_<layout>` that use your other layout macros. This will make it easier for people to use the layouts you define.
78 84
79Layout macro names are entirely lowercase, except for the word `LAYOUT` at the front. 85Layout macro names are entirely lowercase, except for the word `LAYOUT` at the front.
80 86
@@ -82,15 +88,15 @@ As an example, if you have a 60% PCB that supports ANSI and ISO you might define
82 88
83| Layout Name | Keymap Name | Description | 89| Layout Name | Keymap Name | Description |
84|-------------|-------------|-------------| 90|-------------|-------------|-------------|
85| LAYOUT | default | A keymap that supports both ISO and ANSI | 91| LAYOUT | default | A layout that supports both ISO and ANSI |
86| LAYOUT_ansi | default-ansi | An ANSI layout | 92| LAYOUT_ansi | default_ansi | An ANSI layout |
87| LAYOUT_iso | default-iso | An ISO layout | 93| LAYOUT_iso | default_iso | An ISO layout |
88 94
89## Image/Hardware Files 95## Image/Hardware Files
90 96
91In an effort to keep the repo size down we're no longer accepting binary files of any format, with few exceptions. Hosting them elsewhere (such as <https://imgur.com>) and linking them in the `readme.md` is preferred. 97In an effort to keep the repo size down we're no longer accepting binary files of any format, with few exceptions. Hosting them elsewhere (such as <https://imgur.com>) and linking them in the `readme.md` is preferred.
92 98
93Any sort of hardware file (plate, case, pcb) can't be stored in qmk_firmware, but we have the [qmk.fm repo](https://github.com/qmk/qmk.fm) where such files (as well as in-depth info) can be stored and viewed on [qmk.fm](http://qmk.fm). Downloadable files are stored in `/<keyboard>/` (name follows the same format as above) which are served at `http://qmk.fm/<keyboard>/`, and pages are generated from `/_pages/<keyboard>/` which are served at the same location (.md files are generated into .html files through Jekyll). Check out the `lets_split` directory for an example. 99Hardware files (such as plates, cases, pcb) can be contributed to the [qmk.fm repo](https://github.com/qmk/qmk.fm) and they will be made available on [qmk.fm](http://qmk.fm). Downloadable files are stored in `/<keyboard>/` (name follows the same format as above) which are served at `http://qmk.fm/<keyboard>/`, and pages are generated from `/_pages/<keyboard>/` which are served at the same location (.md files are generated into .html files through Jekyll). Check out the `lets_split` folder for an example.
94 100
95## Keyboard Defaults 101## Keyboard Defaults
96 102
@@ -108,77 +114,6 @@ If your keyboard does not have 2 shift keys you should provide a working default
108 114
109As documented on [Customizing Functionality](custom_quantum_functions.md) you can define custom functions for your keyboard. Please keep in mind that your users may want to customize that behavior as well, and make it possible for them to do that. If you are providing a custom function, for example `process_record_kb()`, make sure that your function calls the `_user()` version of the call too. You should also take into account the return value of the `_user()` version, and only run your custom code if the user returns `true`. 115As documented on [Customizing Functionality](custom_quantum_functions.md) you can define custom functions for your keyboard. Please keep in mind that your users may want to customize that behavior as well, and make it possible for them to do that. If you are providing a custom function, for example `process_record_kb()`, make sure that your function calls the `_user()` version of the call too. You should also take into account the return value of the `_user()` version, and only run your custom code if the user returns `true`.
110 116
111## Keyboard Metadata
112
113As QMK grows so does the ecosystem surrounding QMK. To make it easier for projects in that ecosystem to tie into QMK as we make changes we are developing a metadata system to expose information about keyboards in QMK.
114
115You can create `info.json` files at every level under `qmk_firmware/keyboards/<name>` to specify this metadata. These files are combined, with more specific files overriding keys in less specific files. This means you do not need to duplicate your metadata information. For example, `qmk_firmware/keyboards/clueboard/info.json` specifies `manufacturer` and `maintainer`, while `qmk_firmware/keyboards/clueboard/66/info.json` specifies more specific information about Clueboard 66%.
116
117### `info.json` Format
118
119The `info.json` file is a JSON formatted dictionary with the following keys available to be set. You do not have to set all of them, merely the keys that apply to your keyboard.
120
121* `keyboard_name`
122 * A free-form text string describing the keyboard.
123 * Example: `Clueboard 66%`
124* `url`
125 * A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
126* `maintainer`
127 * GitHub username of the maintainer, or `qmk` for community maintained boards
128* `width`
129 * Width of the board in Key Units
130* `height`
131 * Height of the board in Key Units
132* `layouts`
133 * Physical Layout representations. See the next section for more detail.
134
135#### Layout Format
136
137Within our `info.json` file the `layouts` portion of the dictionary contains several nested dictionaries. The outer layer consists of QMK layout macros, for example `LAYOUT_ansi` or `LAYOUT_iso`. Within each layout macro are keys for `width`, `height`, and `key_count`, each of which should be self-explanatory.
138
139* `width`
140 * Optional: The width of the layout in Key Units
141* `height`
142 * Optional: The height of the layout in Key Units
143* `key_count`
144 * **Required**: The number of keys in this layout
145* `layout`
146 * A list of Key Dictionaries describing the physical layout. See the next section for more details.
147
148#### Key Dictionary Format
149
150Each Key Dictionary in a layout describes the physical properties of a key. If you are familiar with the Raw Code for <http://keyboard-layout-editor.com> you will find many of the concepts the same. We re-use the same key names and layout choices wherever possible, but unlike keyboard-layout-editor each key is stateless, inheriting no properties from the keys that came before it.
151
152All key positions and rotations are specified in relation to the top-left corner of the keyboard, and the top-left corner of each key.
153
154* `X`
155 * **Required**: The absolute position of the key in the horizontal axis, in Key Units.
156* `Y`
157 * **Required**: The absolute position of the key in the vertical axis, in Key Units.
158* `W`
159 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
160* `H`
161 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
162* `R`
163 * How many degrees clockwise to rotate the key.
164* `RX`
165 * The absolute position of the point to rotate the key around in the horizontal axis. Default: `x`
166* `RY`
167 * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
168* `KS`
169 * Key Shape: define a polygon by providing a list of points, in Key Units.
170 * **Important**: These are relative to the top-left of the key, not absolute.
171 * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`
172
173### How is the Metadata Exposed?
174
175This metadata is primarily used in two ways:
176
177* To allow web-based configurators to dynamically generate UI
178* To support the new `make keyboard:keymap:qmk` target, which bundles this metadata up with the firmware to allow QMK Toolbox to be smarter.
179
180Configurator authors can see the [QMK Compiler](https://docs.compile.qmk.fm/api_docs.html) docs for more information on using the JSON API.
181
182## Non-Production/Handwired Projects 117## Non-Production/Handwired Projects
183 118
184We're happy to accept any project that uses QMK, including prototypes and handwired ones, but we have a separate `/keyboards/handwired/` folder for them, so the main `/keyboards/` folder doesn't get overcrowded. If a prototype project becomes a production project at some point in the future, we'd be happy to move it to the main `/keyboards/` folder! 119We're happy to accept any project that uses QMK, including prototypes and handwired ones, but we have a separate `/keyboards/handwired/` folder for them, so the main `/keyboards/` folder doesn't get overcrowded. If a prototype project becomes a production project at some point in the future, we'd be happy to move it to the main `/keyboards/` folder!
diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md
new file mode 100644
index 000000000..8f903a2e0
--- /dev/null
+++ b/docs/reference_info_json.md
@@ -0,0 +1,70 @@
1# `info.json`
2
3This file is used by the [QMK API](https://github.com/qmk/qmk_api). It contains the information [QMK Configurator](https://config.qmk.fm/) needs to display a representation of your keyboard. You can also set metadata here.
4
5You can create `info.json` files at every level under `qmk_firmware/keyboards/<name>` to specify this metadata. These files are combined, with more specific files overriding keys in less specific files. This means you do not need to duplicate your metadata information. For example, `qmk_firmware/keyboards/clueboard/info.json` specifies `manufacturer` and `maintainer`, while `qmk_firmware/keyboards/clueboard/66/info.json` specifies more specific information about Clueboard 66%.
6
7## `info.json` Format
8
9The `info.json` file is a JSON formatted dictionary with the following keys available to be set. You do not have to set all of them, merely the keys that apply to your keyboard.
10
11* `keyboard_name`
12 * A free-form text string describing the keyboard.
13 * Example: `Clueboard 66%`
14* `url`
15 * A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
16* `maintainer`
17 * GitHub username of the maintainer, or `qmk` for community maintained boards
18* `width`
19 * Width of the board in Key Units
20* `height`
21 * Height of the board in Key Units
22* `layouts`
23 * Physical Layout representations. See the next section for more detail.
24
25### Layout Format
26
27Within our `info.json` file the `layouts` portion of the dictionary contains several nested dictionaries. The outer layer consists of QMK layout macros, for example `LAYOUT_ansi` or `LAYOUT_iso`. Within each layout macro are keys for `width`, `height`, and `key_count`, each of which should be self-explanatory.
28
29* `width`
30 * Optional: The width of the layout in Key Units
31* `height`
32 * Optional: The height of the layout in Key Units
33* `key_count`
34 * **Required**: The number of keys in this layout
35* `layout`
36 * A list of Key Dictionaries describing the physical layout. See the next section for more details.
37
38### Key Dictionary Format
39
40Each Key Dictionary in a layout describes the physical properties of a key. If you are familiar with the Raw Code for <http://keyboard-layout-editor.com> you will find many of the concepts the same. We re-use the same key names and layout choices wherever possible, but unlike keyboard-layout-editor each key is stateless, inheriting no properties from the keys that came before it.
41
42All key positions and rotations are specified in relation to the top-left corner of the keyboard, and the top-left corner of each key.
43
44* `X`
45 * **Required**: The absolute position of the key in the horizontal axis, in Key Units.
46* `Y`
47 * **Required**: The absolute position of the key in the vertical axis, in Key Units.
48* `W`
49 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
50* `H`
51 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
52* `R`
53 * How many degrees clockwise to rotate the key.
54* `RX`
55 * The absolute position of the point to rotate the key around in the horizontal axis. Default: `x`
56* `RY`
57 * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
58* `KS`
59 * Key Shape: define a polygon by providing a list of points, in Key Units.
60 * **Important**: These are relative to the top-left of the key, not absolute.
61 * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`
62
63## How is the Metadata Exposed?
64
65This metadata is primarily used in two ways:
66
67* To allow web-based configurators to dynamically generate UI
68* To support the new `make keyboard:keymap:qmk` target, which bundles this metadata up with the firmware to allow QMK Toolbox to be smarter.
69
70Configurator authors can see the [QMK Compiler](https://docs.compile.qmk.fm/api_docs.html) docs for more information on using the JSON API.