diff options
author | Evan Travers <evantravers@gmail.com> | 2018-07-14 15:33:50 -0500 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-07-15 13:21:20 -0400 |
commit | b666921e258838f8eb8dcd9038f6f4f7f4159453 (patch) | |
tree | a362dc092f7d05f92adfb0b44491081d1685e9a8 /docs/getting_started_introduction.md | |
parent | b4f45766315a84ad5e8a01953f8a10ac0657fe37 (diff) | |
download | qmk_firmware-b666921e258838f8eb8dcd9038f6f4f7f4159453.tar.gz qmk_firmware-b666921e258838f8eb8dcd9038f6f4f7f4159453.zip |
Reword the `config.h` section
This section didn't include the possibility of a user `config.h`, and it
wasn't clear exactly how the settings override works.
Diffstat (limited to 'docs/getting_started_introduction.md')
-rw-r--r-- | docs/getting_started_introduction.md | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/docs/getting_started_introduction.md b/docs/getting_started_introduction.md index cf80d40b5..504af7ba7 100644 --- a/docs/getting_started_introduction.md +++ b/docs/getting_started_introduction.md | |||
@@ -25,23 +25,34 @@ In every keymap folder, the following files may be found. Only `keymap.c` is req | |||
25 | 25 | ||
26 | # The `config.h` File | 26 | # The `config.h` File |
27 | 27 | ||
28 | There are 2 `config.h` locations: | 28 | There are 3 possible `config.h` locations: |
29 | 29 | ||
30 | * keyboard (`/keyboards/<keyboard>/config.h`) | 30 | * keyboard (`/keyboards/<keyboard>/config.h`) |
31 | * userspace (`/users/<user>/config.h`) | ||
31 | * keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`) | 32 | * keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`) |
32 | 33 | ||
33 | If the keymap `config.h` exists, that file is included by the build system and the keyboard `config.h` is not included. If you wish to override settings in your keymap's `config.h` you will need to include some glue code: | 34 | The build system automatically picks up the config files in the above order. If you wish to override any setting set by a previous `config.h` you will need to first include some boilerplate code around the settings you wish to change. |
34 | 35 | ||
35 | ``` | 36 | ``` |
36 | #ifndef CONFIG_USER_H | 37 | #ifndef CONFIG_USER_H |
37 | #define CONFIG_USER_H | 38 | #define CONFIG_USER_H |
38 | 39 | ||
39 | #include "config_common.h" | 40 | // overrides go here! |
41 | |||
42 | #endif | ||
40 | ``` | 43 | ``` |
41 | 44 | ||
42 | If you want to override a setting from the parent `config.h` file, you need to `#undef` and then `#define` the setting again, like this: | 45 | Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again. |
46 | |||
47 | The boilerplate code and setting look like this together: | ||
43 | 48 | ||
44 | ```c | 49 | ``` |
50 | #ifndef CONFIG_USER_H | ||
51 | #define CONFIG_USER_H | ||
52 | |||
53 | // overrides go here! | ||
45 | #undef MY_SETTING | 54 | #undef MY_SETTING |
46 | #define MY_SETTING 4 | 55 | #define MY_SETTING 4 |
56 | |||
57 | #endif | ||
47 | ``` | 58 | ``` |