[Docs] added the description of the reading order of the config.h files. (#8545)

* added the description of the reading order of the config.h files.

* Update docs/hardware_keyboard_guidelines.md

* Update docs/hardware_keyboard_guidelines.md

* Added a description of post_config.h.

* sample bug fix

* sample update

* Update docs/hardware_keyboard_guidelines.md

* Update docs/hardware_keyboard_guidelines.md

* update docs/hardware_keyboard_guidelines.md

* Update docs/hardware_keyboard_guidelines.md
master
Takeshi ISHII 2020-03-26 13:13:16 +09:00 committed by GitHub
parent 9fbf17b90e
commit 5bd0a5a585
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 51 additions and 0 deletions

View File

@ -61,6 +61,57 @@ This file is used by the [QMK API](https://github.com/qmk/qmk_api). It contains
All 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.
The `config.h` files can also be placed in sub-folders, and the order in which they are read is as follows:
* `keyboards/top_folder/config.h`
* `keyboards/top_folder/sub_1/config.h`
* `keyboards/top_folder/sub_1/sub_2/config.h`
* `keyboards/top_folder/sub_1/sub_2/sub_3/config.h`
* `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/config.h`
* `users/a_user_folder/config.h`
* `keyboards/top_folder/keymaps/a_keymap/config.h`
* `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/post_config.h`
* `keyboards/top_folder/sub_1/sub_2/sub_3/post_config.h`
* `keyboards/top_folder/sub_1/sub_2/post_config.h`
* `keyboards/top_folder/sub_1/post_config.h`
* `keyboards/top_folder/post_config.h`
The `post_config.h` file can be used for additional post-processing, depending on what is specified in the `config.h` file. For example, if you define the `IOS_DEVICE_ENABLE` macro in your keymap-level `config.h` file as follows, you can configure more detailed settings accordingly in the `post_config.h` file:
* `keyboards/top_folder/keymaps/a_keymap/config.h`
```c
#define IOS_DEVICE_ENABLE
```
* `keyboards/top_folder/post_config.h`
```c
#ifndef IOS_DEVICE_ENABLE
// USB_MAX_POWER_CONSUMPTION value for this keyboard
#define USB_MAX_POWER_CONSUMPTION 400
#else
// fix iPhone and iPad power adapter issue
// iOS device need lessthan 100
#define USB_MAX_POWER_CONSUMPTION 100
#endif
#ifdef RGBLIGHT_ENABLE
#ifndef IOS_DEVICE_ENABLE
#define RGBLIGHT_LIMIT_VAL 200
#define RGBLIGHT_VAL_STEP 17
#else
#define RGBLIGHT_LIMIT_VAL 35
#define RGBLIGHT_VAL_STEP 4
#endif
#ifndef RGBLIGHT_HUE_STEP
#define RGBLIGHT_HUE_STEP 10
#endif
#ifndef RGBLIGHT_SAT_STEP
#define RGBLIGHT_SAT_STEP 17
#endif
#endif
```
?> If you define options using `post_config.h` as in the above example, you should not define the same options in the keyboard- or user-level `config.h`.
### `rules.mk`
The presence of this file means that the folder is a keyboard target and can be used in `make` commands. This is where you setup the build environment for your keyboard and configure the default set of features.