Compare commits

...

5 Commits

Author SHA1 Message Date
81756d7b21 Fix tapdance when one-shot is disabled. 2018-07-15 13:29:59 -04:00
c5c112ae29 Update config.h boilerplate to use #pragma once
According to @fredizzimo, this is a safer and easier way to handle the
boilerplate.
2018-07-15 13:21:20 -04:00
3d7bfae232 Add Userspace mention
@drashna mentioned it'd be good to have a mention of the userspace in
the QMK structure section. Rather than rewrite the docs on userspace, I
chose to link to the existing documentation.
2018-07-15 13:21:20 -04:00
b666921e25 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.
2018-07-15 13:21:20 -04:00
b4f4576631 Update docs: Makefile -> rules.mk
I think this was a typo, or perhaps an older way to handle it.
2018-07-15 13:21:20 -04:00
2 changed files with 22 additions and 9 deletions

View File

@ -6,12 +6,16 @@ This page attempts to explain the basic information you need to know to work wit
QMK is a fork of [Jun Wako](https://github.com/tmk)'s [tmk_keyboard](https://github.com/tmk/tmk_keyboard) project. The original TMK code, with modifications, can be found in the `tmk` folder. The QMK additions to the project may be found in the `quantum` folder. Keyboard projects may be found in the `handwired` and `keyboard` folders.
### Userspace Structure
Within the folder `users` is a directory for each user. This is a place for users to put code that they might use between keyboards. See the docs for [Userspace feature](feature_userspace.md) for more information.
### Keyboard Project Structure
Within the folder `keyboards` and its subfolder `handwired` is a directory for each keyboard project, for example `qmk_firmware/keyboards/clueboard`. Within it you'll find the following structure:
* `keymaps/`: Different keymaps that can be built
* `rules.mk`: The file that sets the default "make" options. Do not edit this file directly, instead use a keymap specific `Makefile`
* `rules.mk`: The file that sets the default "make" options. Do not edit this file directly, instead use a keymap specific `rules.mk`.
* `config.h`: The file that sets the default compile time options. Do not edit this file directly, instead use a keymap specific `config.h`.
### Keymap Structure
@ -25,23 +29,26 @@ In every keymap folder, the following files may be found. Only `keymap.c` is req
# The `config.h` File
There are 2 `config.h` locations:
There are 3 possible `config.h` locations:
* keyboard (`/keyboards/<keyboard>/config.h`)
* userspace (`/users/<user>/config.h`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`)
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:
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 for the settings you wish to change.
```
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "config_common.h"
#pragma once
```
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:
Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again.
```c
The boilerplate code and setting look like this together:
```
#pragma once
// overrides go here!
#undef MY_SETTING
#define MY_SETTING 4
```

View File

@ -16,7 +16,9 @@
#include "quantum.h"
#include "action_tapping.h"
#ifndef NO_ACTION_ONESHOT
uint8_t get_oneshot_mods(void);
#endif
static uint16_t last_td;
static int8_t highest_td = -1;
@ -146,7 +148,11 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
action->state.keycode = keycode;
action->state.count++;
action->state.timer = timer_read();
#ifndef NO_ACTION_ONESHOT
action->state.oneshot_mods = get_oneshot_mods();
#else
action->state.oneshot_mods = 0;
#endif
action->state.weak_mods = get_mods();
action->state.weak_mods |= get_weak_mods();
process_tap_dance_action_on_each_tap (action);