]> git.donarmstrong.com Git - qmk_firmware.git/blob - docs/getting_started_introduction.md
Fix typo in keyboard_post_init_user example, remove EPRM from Persistent Configuratio...
[qmk_firmware.git] / docs / getting_started_introduction.md
1 # Introduction
2
3 This page attempts to explain the basic information you need to know to work with the QMK project. It assumes that you are familiar with navigating a Unix shell, but does not assume you are familiar with C or with compiling using make.
4
5 ## Basic QMK Structure
6
7 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.
8
9 ### Userspace Structure
10
11 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.
12
13 ### Keyboard Project Structure
14
15 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:
16
17 * `keymaps/`: Different keymaps that can be built
18 * `rules.mk`: The file that sets the default "make" options. Do not edit this file directly, instead use a keymap specific `rules.mk`.
19 * `config.h`: The file that sets the default compile time options. Do not edit this file directly, instead use a keymap specific `config.h`.
20
21 ### Keymap Structure
22
23 In every keymap folder, the following files may be found. Only `keymap.c` is required, and if the rest of the files are not found the default options will be chosen.
24
25 * `config.h`: the options to configure your keymap
26 * `keymap.c`: all of your keymap code, required
27 * `rules.mk`: the features of QMK that are enabled
28 * `readme.md`: a description of your keymap, how others might use it, and explanations of features. Please upload images to a service like imgur.
29
30 # The `config.h` File
31
32 There are 3 possible `config.h` locations:
33
34 * keyboard (`/keyboards/<keyboard>/config.h`)
35 * userspace (`/users/<user>/config.h`)
36 * keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`)
37
38 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.
39
40 ```
41 #pragma once
42 ```
43
44 Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again.
45
46 The boilerplate code and setting look like this together:
47
48 ```
49 #pragma once
50
51 // overrides go here!
52 #undef MY_SETTING
53 #define MY_SETTING 4
54 ```