Skip to content

Commit

Permalink
added description of keyboard_features.mk in hardware_keyboard_guidel…
Browse files Browse the repository at this point in the history
…ines.md.
  • Loading branch information
mtei committed Mar 4, 2021
1 parent 37a484d commit 7418a4b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/hardware_keyboard_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,38 @@ The `rules.mk` file can also be placed in a sub-folder, and its reading order is
* `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/rules.mk`
* `keyboards/top_folder/keymaps/a_keymap/rules.mk`
* `users/a_user_folder/rules.mk`
* `keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/keyboard_features.mk`
* `keyboards/top_folder/sub_1/sub_2/sub_3/keyboard_features.mk`
* `keyboards/top_folder/sub_1/sub_2/keyboard_features.mk`
* `keyboards/top_folder/sub_1/keyboard_features.mk`
* `keyboards/top_folder/keyboard_features.mk`
* `common_features.mk`

Many of the settings written in the `rules.mk` file are interpreted by `common_features.mk`, which sets the necessary source files and compiler options.

The `keyboard_features.mk` file can interpret `features` of a keyboard-level before `common_features.mk`. For example, when your designed keyboard has the option to implement backlighting or underglow using rgblight.c, writing the following in the `keyboard_features.mk` makes it easier for the user to configure the `rules.mk`.

* `keyboards/top_folder/keymaps/a_keymap/rules.mk`
```makefile
# Please set the following according to the selection of the hardware implementation option.
RGBLED_OPTION_TYPE = backlight ## none, backlight or underglow
```
* `keyboards/top_folder/keyboard_features.mk`
```makefile
ifeq ($(filter $(strip $(RGBLED_OPTION_TYPE))x, nonex backlightx underglowx x),)
$(error unknown RGBLED_OPTION_TYPE value "$(RGBLED_OPTION_TYPE)")
endif

ifeq ($(strip $(RGBLED_OPTION_TYPE)),backlight)
RGBLIGHT_ENABLE = yes
OPT_DEFS += -DRGBLED_NUM=30
endif
ifeq ($(strip $(RGBLED_OPTION_TYPE)),underglow)
RGBLIGHT_ENABLE = yes
OPT_DEFS += -DRGBLED_NUM=6
endif
```
?> See `build_keyboard.mk` and `common_features.mk` for more details.
### `<keyboard_name.c>`
Expand Down

0 comments on commit 7418a4b

Please sign in to comment.