diff options
47 files changed, 4807 insertions, 0 deletions
diff --git a/docs/Adding-features-to-QMK.md b/docs/Adding-features-to-QMK.md new file mode 100644 index 0000000000..f6f7cba208 --- /dev/null +++ b/docs/Adding-features-to-QMK.md @@ -0,0 +1,7 @@ +If you have an idea for a custom feature or extra hardware connection, we'd love to accept it into QMK! These are generally done via [pull request](https://github.com/qmk/qmk_firmware/pulls) after forking, and here are some things to keep in mind when creating one: + +* **Disable by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, [open an issue](https://github.com/qmk/qmk_firmware/issues) for everyone to discuss it! +* **Compile locally before submitting** - hopefully this one is obvious, but things need to compile! Our Travis system will catch any issues, but it's generally faster for you to compile a few keyboards locally instead of waiting for the results to come back. +* **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects that have allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled in one that doesn't work. +* **Explain your feature** - submitting a markdown write-up of what your feature does with your PR may be needed, and it will allow a collaborator to easily copy it into the wiki for documentation (after proofing and editing). +* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues).
\ No newline at end of file diff --git a/docs/Becoming-a-QMK-Collaborator.md b/docs/Becoming-a-QMK-Collaborator.md new file mode 100644 index 0000000000..1427675fdd --- /dev/null +++ b/docs/Becoming-a-QMK-Collaborator.md @@ -0,0 +1,7 @@ +A QMK collaborator is a keyboard maker/designer that is interested in helping QMK grow and fully support their keyboard(s), and encouraging their users/customers to submit features, ideas, and keymaps. We're always looking to add more keyboards and collaborators, but we ask that they fulfill these requirements: + +* **Have a PCB available for sale** - unfortunately there's just too much variation and complications with handwired keyboards. +* **Maintain the your keyboard's directory** - this may just require an initial setup to get your keyboard working, but it could also include accommodating changes made to QMK's core. +* **Approve and merge your keyboard's keymap pull requests** - we like to encourage users to contribute their keymaps for others to see and work from when creating their own. + +If you feel you meet these requirements, shoot us an email at hello@qmk.fm with an introduction and some links to your keyboard!
\ No newline at end of file diff --git a/docs/Build-Environment-Setup.md b/docs/Build-Environment-Setup.md new file mode 100644 index 0000000000..35e02924b9 --- /dev/null +++ b/docs/Build-Environment-Setup.md @@ -0,0 +1,112 @@ +### Windows 10 + +Due to some issues with the "Windows (Vista and later)" instructions below, we now recommend following these instructions if you use Windows, which will allow you to use the Windows Subsystem for Linux to compile the firmware. If you are not using Windows 10 with the Anniversary Update installed (which came out in July 2016), you will need to use one of the other methods, such as Docker, Vagrant, or the instructions for Vista and later. + +If you use this method, you will need to use a standalone tool to flash the firmware to the keyboard after you compile it. We recommend the official [QMK Firmware Flasher](https://github.com/qmk/qmk_firmware_flasher/releases). This is because the Windows 10 Subsystem for Linux lacks [libUSB support](https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13355724-unable-to-access-usb-devices-from-bash), so it can't access the keyboard's microcontroller. Please add your vote for Microsoft to fix this issue using the link! + +Here are the steps + +1. Install the Windows 10 subsystem for Linux, following [these instructions](http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/). +2. If you have cloned the repository using git before August 20, 2016, clean up the line endings from wherever you currently access git: + 1. Make sure that you have no changes you haven't committed by running `git status`. ANY UNCOMMITTED CHANGES WILL BE PERMANENTLY LOST. + 2. Run `git rm --cached -r .` + 3. Run `git reset --hard` +3. Open "Bash On Ubuntu On Windows" from the start menu +4. With the bash window open, navigate to your copy of the [qmk_firmware repository](https://github.com/qmk/qmk_firmware) using the `cd` command. The harddisks can be accessed from `/mnt/<driveletter>`. For example, your main hard drive (C:) can be accessed by executing the command `cd /mnt/c`. If your username is John and the qmk_firmware folder is in your Downloads folder, you can move to it with the command `cd /mnt/c/Users/John/Downloads/qmk_firmware`. You can use the Tab key as you go to help you autocomplete the folder names. +5. Run `sudo util/install_dependencies.sh`. **This will run `apt-get upgrade`.** +6. After a while the installation will finish, and you are good to go + +**Note** From time to time, the dependencies might change, so just run `install_dependencies.sh` again if things are not working. + +**Warning:** If you edit Makefiles or shell scripts, make sure you are using an editor that saves the files with Unix line endings. Otherwise the compilation might not work. + + +### Windows (Vista and later) +1. If you have ever installed WinAVR, uninstall it. +2. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**. +3. If you are going to flash Infinity based keyboards you will need to install dfu-util, refer to the instructions by [Input Club](https://github.com/kiibohd/controller/wiki/Loading-DFU-Firmware). +4. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location. +5. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/qmk/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer. +6. Open the `\util` folder. +7. Double-click on the `1-setup-path-win` batch script to run it. You'll need to accept a User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up. +8. Right-click on the `2-setup-environment-win` batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete! + +If you have trouble and want to ask for help, it is useful to generate a *Win_Check_Output.txt* file by running `Win_Check.bat` in the `\util` folder. + +### Mac +If you're using [homebrew,](http://brew.sh/) you can use the following commands: + + brew tap osx-cross/avr + brew install avr-libc + brew install dfu-programmer + +This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of avr-libc can take over 20 minutes and exhibit high CPU usage. + +You can also try these instructions: + +1. Install Xcode from the App Store. +2. Install the Command Line Tools from `Xcode->Preferences->Downloads`. +3. Install [DFU-Programmer](https://dfu-programmer.github.io/). + +If you are going to flash Infinity based keyboards you will also need dfu-util + + brew install dfu-util + +### Linux + +To ensure you are always up to date, you can just run `sudo util/install_dependencies.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.** + +You can also install things manually, but this documentation might not be always up to date with all requirements. + +The current requirements are the following, but not all might be needed depending on what you do. Also note that some systems might not have all the dependencies available as packages, or they might be named differently. + +``` +build-essential +gcc +unzip +wget +zip +gcc-avr +binutils-avr +avr-libc +dfu-programmer +dfu-util +gcc-arm-none-eabi +binutils-arm-none-eabi +libnewlib-arm-none-eabi +git +``` + +Install the dependencies with your favorite package manager. + +Debian/Ubuntu example: + + sudo apt-get update + sudo apt-get install gcc unzip wget zip gcc-avr binutils-avr avr-libc dfu-programmer dfu-util gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi + +### Docker + +If this is a bit complex for you, Docker might be the turn-key solution you need. After installing [Docker](https://www.docker.com/products/docker), run the following command at the root of the QMK folder to build a keyboard/keymap: + +```bash +# You'll run this every time you want to build a keymap +# modify the keymap and keyboard assigment to compile what you want +# defaults are ergodox/default + +docker run -e keymap=gwen -e subproject=ez -e keyboard=ergodox --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware + +# On windows docker seems to have issue with VOLUME tag in Dockerfile, and $('pwd') won't print a windows compliant path, use full path instead like this +docker run -e keymap=default -e subproject=ez -e keyboard=ergobox --rm -v D:/Users/Sacapuces/Documents/Repositories/qmk:/qmk:rw edasque/qmk_firmware + +``` + +This will compile the targeted keyboard/keymap and leave it in your QMK directory for you to flash. + +### Vagrant +If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [VAGRANT_GUIDE file](https://github.com/qmk/qmk_firmware/blob/master/doc/VAGRANT_GUIDE.md). + +## Verify Your Installation +1. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application. +2. Open up a terminal or command prompt and navigate to the `qmk_firmware` folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead. +3. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `readme.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`. +4. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below.
\ No newline at end of file diff --git a/docs/Compatible-Microcontrollers.md b/docs/Compatible-Microcontrollers.md new file mode 100644 index 0000000000..20ba620f6d --- /dev/null +++ b/docs/Compatible-Microcontrollers.md @@ -0,0 +1,25 @@ +# Atmel AVR + +QMK should run on any Atmel AVR processor with enough Flash. It has been tested on the following: + +* ATmega32U4 ([PJRC Teensy 2.0](http://www.pjrc.com/teensy/)) +* AT90USB1286 ([PJRC Teensy++ 2.0](http://www.pjrc.com/teensy/)) +* AT90USB1287 ([Atmel USBKEY](http://www.atmel.com/tools/AT90USBKEY.aspx)) +* ATmega168P with using [V-USB](http://www.obdev.at/products/vusb/index.html) +* ATmega328P with using [V-USB](http://www.obdev.at/products/vusb/index.html) +* ATmega32U2 +* AT90USB1286, 646, 647 should work +* AT90USB162 testing... + +NOTE: To enable full features of firmware you'll need 32KB flash size. + +Please add any tested microcontrollers to this list. + +# ARM + +You can also use any ARM processor that [ChibiOS](http://www.chibios.org) supports. The following processors have been tested: + +* [Kinetis MKL26Z64](http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x) +* [Kinetis MK20DX128](http://www.nxp.com/assets/documents/data/en/data-sheets/K20P64M50SF0.pdf) +* [Kinetis MK20DX128](http://www.nxp.com/assets/documents/data/en/data-sheets/K20P64M50SF0.pdf) +* [Kinetis MK20DX256](http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/k-series-performance-m4/k2x-usb/kinetis-k20-72-mhz-full-speed-usb-mixed-signal-integration-microcontrollers-mcus-based-on-arm-cortex-m4-core:K20_72)
\ No newline at end of file diff --git a/docs/Custom-Quantum-Functions.md b/docs/Custom-Quantum-Functions.md new file mode 100644 index 0000000000..1c4929e5a8 --- /dev/null +++ b/docs/Custom-Quantum-Functions.md @@ -0,0 +1,123 @@ +A custom keyboard is about more than sending button presses to your computer. QMK has designed hooks to allow you to inject code, override functionality, and otherwise customize how your keyboard responds in different situations. + +## A Word on Keyboards vs Keymap + +We have structured QMK as a hierarchy: + +* Core + * Keyboard/Revision (`_kb`) + * Keymap (`_user`) + +Each of the functions described below can be defined with a `_kb()` suffix or an `_user()` suffix. We intend for you to use the `_kb()` suffix at the Keyboard/Revision level, while the `_user()` suffix should be used at the Keymap level. + +When defining functions at the Keyboard/Revision level it is important that your `_kb()` implementation call `_user()` before executing anything else- otherwise the keymap level function will never be called. + +## Matrix Initialization Code + +* Keyboard/Revision: `void matrix_init_kb(void)` +* Keymap: `void matrix_init_user(void)` + +This function gets called when the matrix is initiated. You should use this function to initialize any custom hardware you may have, such as speakers, LED drivers, or other features which need to be setup after the keyboard powers on. + +### Example + +``` +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + + // JTAG disable for PORT F. write JTD bit twice within four cycles. + MCUCR |= (1<<JTD); + MCUCR |= (1<<JTD); + + // * Set our LED pins as output + DDRB |= (1<<0); + DDRB |= (1<<1); + DDRB |= (1<<2); + DDRB |= (1<<3); + DDRB |= (1<<4); +} +``` + +## Matrix Scanning Code + +* Keyboard/Revision: `void matrix_scan_kb(void)` +* Keymap: `void matrix_scan_user(void)` + +This function gets called at every matrix scan, which is basically as often as the MCU can handle. Be careful what you put here, as it will get run a lot. + +You should use this function if you need custom matrix scanning code. It can also be used for custom status output (such as LED's or a display) or other functionality that you want to trigger regularly even when the user isn't typing. + +## Hook Into Key Presses + +* Keyboard/Revision: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` +* Keymap: `bool process_record_user(uint16_t keycode, keyrecord_t *record)` + +This function gets called every time a key is pressed or released. This is particularly useful when defining custom keys or overriding the behavior of existing keys. + +The return value is whether or not QMK should continue processing the keycode - returning `false` stops the execution. + +The `keycode` variable is whatever is defined in your keymap, eg `MO(1)`, `KC_L`, etc. and can be switch-cased to execute code whenever a particular code is pressed. + +The `record` variable contains infomation about the actual press: + +``` +keyrecord_t record { + keyevent_t event { + keypos_t key { + uint8_t col + uint8_t row + } + bool pressed + uint16_t time + } +} +``` + +The conditional `if (record->event.pressed)` can tell if the key is being pressed or released, and you can execute code based on that. + +## LED Control + +* Keyboard/Revision: `void led_set_kb(uint8_t usb_led)` +* Keymap: `void led_set_user(uint8_t usb_led)` + +This allows you to control the 5 LED's defined as part of the USB Keyboard spec. It will be called when the state of one of those 5 LEDs changes. + +* `USB_LED_NUM_LOCK` +* `USB_LED_CAPS_LOCK` +* `USB_LED_SCROLL_LOCK` +* `USB_LED_COMPOSE` +* `USB_LED_KANA` + +### Example: + +``` +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1<<USB_LED_NUM_LOCK)) { + PORTB |= (1<<0); + } else { + PORTB &= ~(1<<0); + } + if (usb_led & (1<<USB_LED_CAPS_LOCK)) { + PORTB |= (1<<1); + } else { + PORTB &= ~(1<<1); + } + if (usb_led & (1<<USB_LED_SCROLL_LOCK)) { + PORTB |= (1<<2); + } else { + PORTB &= ~(1<<2); + } + if (usb_led & (1<<USB_LED_COMPOSE_LOCK)) { + PORTB |= (1<<3); + } else { + PORTB &= ~(1<<3); + } + if (usb_led & (1<<USB_LED_KANA_LOCK)) { + PORTB |= (1<<4); + } else { + PORTB &= ~(1<<4); + } +} +```
\ No newline at end of file diff --git a/docs/Differences-from-TMK.md b/docs/Differences-from-TMK.md new file mode 100644 index 0000000000..8b43570955 --- /dev/null +++ b/docs/Differences-from-TMK.md @@ -0,0 +1,8 @@ +Understanding the essential changes made on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) should help you understand the QMK Firmware. + +| Firmware |TMK |QMK | +|------------------------------|-----------------------|-------------------------| +| Maintainer |hasu (@tmk) |Jack Humbert et al. | +| Build path customization | `TMK_DIR = ...` | `include .../Makefile` | +| `keymaps` array data | 3D array of `uint8_t` holding **keycode** | 3D array of `uint16_t` holding **keycode** | +| `fn_actions` array data | 1D array of `uint16_t` holding **action code** | 1D array of `uint16_t` holding **action code** |
\ No newline at end of file diff --git a/docs/Eclipse.md b/docs/Eclipse.md new file mode 100644 index 0000000000..b9aa676370 --- /dev/null +++ b/docs/Eclipse.md @@ -0,0 +1,84 @@ +[Eclipse](https://en.wikipedia.org/wiki/Eclipse_(software)) is an open-source [Integrated Development Environment](https://en.wikipedia.org/wiki/Integrated_development_environment) (IDE) widely used for Java development, but with an extensible plugin system that allows to customize it for other languages and usages. + +Using an IDE such as Eclipse provides many advantages over a plain text editor, such as: +* intelligent code completion +* convenient navigation in the code +* refactoring tools +* build automation (no need for the command-line) +* a GUI for GIT +* static code analysis +* many other tools such as debugging, code formatting, showing call hierarchies etc. + +The purpose of the is page is to document how to set-up Eclipse for developing AVR software, and working on the QMK code base. + +Note that this set-up has been tested on Ubuntu 16.04 only for the moment. + +# Prerequisites +## Build environment +Before starting, you must have followed the [Getting Started](/Home.md#getting-started) section corresponding to your system. In particular, you must have been able to build the firmware with [the `make` command](../#the-make-command). + +## Java +Eclipse is a Java application, so you will need to install Java 8 or more recent to be able to run it. You may choose between the JRE or the JDK, the latter being useful if you intend to do Java development. + +# Install Eclipse and its plugins +Eclipse comes in [several flavours](http://www.eclipse.org/downloads/eclipse-packages/) depending on the target usage that you will have. There is no package comprising the AVR stack, so we will need to start from Eclipse CDT (C/C++ Development Tooling) and install the necessary plugins. + +## Download and install Eclipse CDT +If you already have Eclipse CDT on your system, you can skip this step. However it is advised to keep it up-to-date for better support. + +If you have another Eclipse package installed, it is normally possible to [install the CDT plugin over it](https://eclipse.org/cdt/downloads.php). However it is probably better to reinstall it from scratch to keep it light and avoid the clutter of tools that you don't need for the projects you will be working on. + +Installation is very simple: follow the [5 Steps to Install Eclipse](https://eclipse.org/downloads/eclipse-packages/?show_instructions=TRUE), and choose **Eclipse IDE for C/C++ Developers** at Step 3. + +Alternatively, you can also directly [download Eclipse IDE for C/C++ Developers](http://www.eclipse.org/downloads/eclipse-packages/) ([direct link to current version](http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/neonr)) and extract the package to the location of your choice (this creates an `eclipse` folder). + +## First Launch +When installation is complete, click the <kbd>Launch</kbd> button. (If you extracted the package manually, open the Eclipse installation folder and double-click the `eclipse` executable) + +When you are prompted with the Workspace Selector, select a directory that will hold Eclipse metadata and usually your projects. **Do not select the `qmk_firmware` directory**, this will be the project directory. Select the parent folder instead, or another (preferably empty) folder of your choice (the default is fine if you do not use it yet). + +Once started, click the <kbd>Workbench</kbd> button at the top right to switch to the workbench view (there is a also checkbox at the bottom to skip the welcome screen at startup). + +## Install the necessary plugins +Note: you do not need to restart Eclipse after installing each plugin. Simply restart once all plugins are installed. + +### [The AVR plugin](http://avr-eclipse.sourceforge.net/) +This is the most important plugin as it will allow Eclipse to _understand_ AVR C code. Follow [the instructions for using the update site](http://avr-eclipse.sourceforge.net/wiki/index.php/Plugin_Download#Update_Site), and agree with the security warning for unsigned content. + +### [ANSI Escape in Console](https://marketplace.eclipse.org/content/ansi-escape-console) +This plugin is necessary to properly display the colored build output generated by the QMK makefile. + +1. Open <kbd><kbd>Help</kbd> > <kbd>Eclipse Marketplace…</kbd></kbd> +2. Search for _ANSI Escape in Console_ +3. Click the <samp>Install</samp> button of the plugin +4. Follow the instructions and agree again with the security warning for unsigned content. + +Once both plugins are installed, restart Eclipse as prompted. + +# Configure Eclipse for QMK +## Importing the project +1. Click <kbd><kbd>File</kbd> > <kbd>New</kbd> > <kbd>Makefile Project with Existing Code</kbd></kbd> +2. On the next screen: + * Select the directory where you cloned the repository as _Existing Code Location_; + * (Optional) Give a different name to the project¹, e.g. _QMK_ or _Quantum_; + * Select the _AVR-GCC Toolchain_; + * Keep the rest as-is and click <kbd>Finish</kbd> + + ![Importing QMK in Eclipse](http://i.imgur.com/oHYR1yW.png) + +3. The project will now be loaded and indexed. Its files can be browsed easily through the _Project Explorer_ on the left. + +¹ There might be issues for importing the project with a custom name. If it does not work properly, try leaving the default project name (i.e. the name of the directory, probably `qmk_firmware`). + +## Build your keyboard +We will now configure a make target that cleans the project and builds the keymap of your choice. + +1. On the right side of the screen, select the <kbd>Make Target</kbd> tab +2. Expand the folder structure to the keyboard of your choice, e.g. `qmk_firmware/keyboards/ergodox` +3. Right-click on the keyboard folder and select <kbd>New…</kbd> (or select the folder and click the <kbd>New Make Target</kbd> icon above the tree) +4. Choose a name for your build target, e.g. _clean \<your keymap\>_ +5. Make Target: this is the arguments that you give to `make` when building from the command line. If your target name does not match these arguments, uncheck <kbd>Same as target name</kbd> and input the correct arguments, e.g. `clean <your keymap>` +6. Leave the other options checked and click <kbd>OK</kbd>. Your make target will now appear under the selected keyboard. +7. (Optional) Toggle the <kbd>Hide Empty Folders</kbd> icon button above the targets tree to only show your build target. +8. Double-click the build target you created to trigger a build. +9. Select the <kbd>Console</kbd> view at the bottom to view the running build.
\ No newline at end of file diff --git a/docs/Embedding.md b/docs/Embedding.md new file mode 100644 index 0000000000..5c2f3b31e0 --- /dev/null +++ b/docs/Embedding.md @@ -0,0 +1,64 @@ +# WARNING: Until issue [#173](https://github.com/tmk/tmk_keyboard/issues/173) goes through, the [core][1] repository will not be up-to-date with the latest changes and fixes, but can still be used. + +If you want to use TMK for your own keyboard project, you've got three options for embedding the [core][1]. +The recommended option is [subtrees](#1-git-subtree). + +After adding the embed you'll need to [modify the Makefile](#modifications-to-the-makefile) of your project to point to the core correctly. + +## 1. git subtree + +In order to set up the subtree in your project, first add the core repository as a remote: +``` +git remote add -f core https://github.com/tmk/tmk_core +``` + +Then add the core as a subtree (directory) in your local repository: +``` +git subtree add -P tmk_core core master --squash +``` + +And that's it! + +When you want to update the subtree in your repository to match the master on [tmk_core][1], do this: +``` +git subtree pull -P tmk_core core master --squash +``` + +## 2. git submodule + +In order to set up the submodule in your project, first add a new submodule: +``` +git submodule add https://github.com/tmk/tmk_core tmk_core +``` + +Then pull, sync and update the submodule: +``` +git pull +git submodule sync --recursive +git submodule update --init --recursive +``` + +And that's it! + +When you want to update the subtree in your repository to match the master on [tmk_core][1], follow the same steps as above. + +If you want to clone a repository from GitHub that has submodule(s) in it, pass <kbd>--recursive</kbd> when cloning, like so: +`git clone --recursive https://github.com/<username>/<repository>` + +## 3. Manually (without git) + +*Note: This is not recommended in any way, but it's still possible.* + |